Skip to content

Commit 018f247

Browse files
authored
Fix failing tests (#4070)
1 parent ddf32b3 commit 018f247

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

extension/src/test/suite/repository/model/tree.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
buildDependencies,
2222
closeAllEditors,
2323
getActiveTextEditorFilename,
24-
stubPrivatePrototypeMethod
24+
stubPrivatePrototypeMethod,
25+
waitForEditorText
2526
} from '../../util'
2627
import { dvcDemoPath } from '../../../util'
2728
import {
@@ -70,6 +71,7 @@ suite('Repositories Tree Test Suite', () => {
7071

7172
await commands.executeCommand('workbench.action.files.newUntitledFile')
7273
await commands.executeCommand('editor.action.clipboardPasteAction')
74+
await waitForEditorText()
7375

7476
expect(
7577
Uri.file(window.activeTextEditor?.document.getText() as string).fsPath
@@ -85,6 +87,7 @@ suite('Repositories Tree Test Suite', () => {
8587

8688
await commands.executeCommand('workbench.action.files.newUntitledFile')
8789
await commands.executeCommand('editor.action.clipboardPasteAction')
90+
await waitForEditorText()
8891

8992
expect(window.activeTextEditor?.document.getText()).to.equal(relPath)
9093
})

extension/src/test/suite/util.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,12 @@ export const getTimeSafeDisposer = (): Disposer & {
303303

304304
export const bypassProgressCloseDelay = () =>
305305
stub(Toast, 'delayProgressClosing').resolves(undefined)
306+
307+
export const waitForEditorText = async (): Promise<unknown> => {
308+
await Time.delay(500)
309+
const text = window.activeTextEditor?.document.getText()
310+
if (text) {
311+
return
312+
}
313+
return waitForEditorText()
314+
}

0 commit comments

Comments
 (0)