Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing tests #4070

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion extension/src/test/suite/repository/model/tree.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
buildDependencies,
closeAllEditors,
getActiveTextEditorFilename,
stubPrivatePrototypeMethod
stubPrivatePrototypeMethod,
waitForEditorText
} from '../../util'
import { dvcDemoPath } from '../../../util'
import {
Expand Down Expand Up @@ -70,6 +71,7 @@ suite('Repositories Tree Test Suite', () => {

await commands.executeCommand('workbench.action.files.newUntitledFile')
await commands.executeCommand('editor.action.clipboardPasteAction')
await waitForEditorText()

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

await commands.executeCommand('workbench.action.files.newUntitledFile')
await commands.executeCommand('editor.action.clipboardPasteAction')
await waitForEditorText()

expect(window.activeTextEditor?.document.getText()).to.equal(relPath)
})
Expand Down
9 changes: 9 additions & 0 deletions extension/src/test/suite/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,12 @@ export const getTimeSafeDisposer = (): Disposer & {

export const bypassProgressCloseDelay = () =>
stub(Toast, 'delayProgressClosing').resolves(undefined)

export const waitForEditorText = async (): Promise<unknown> => {
await Time.delay(500)
const text = window.activeTextEditor?.document.getText()
if (text) {
return
}
return waitForEditorText()
}