-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve stability of Modal dialog tests (#826)
Signed-off-by: Dominik Jelinek <[email protected]>
- Loading branch information
Showing
2 changed files
with
22 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,48 @@ | ||
import { expect } from "chai"; | ||
import { EditorView, InputBox, ModalDialog, TextEditor, TitleBar, until, VSBrowser } from 'vscode-extension-tester'; | ||
import { By, EditorView, InputBox, ModalDialog, TextEditor, until, VSBrowser, after, before, Workbench } from 'vscode-extension-tester'; | ||
|
||
(VSBrowser.instance.version >= '1.50.0' && process.platform !== 'darwin' ? describe : describe.skip)('Modal Dialog', () => { | ||
let dialog: ModalDialog; | ||
|
||
before(async function() { | ||
this.timeout(15000); | ||
if (VSBrowser.instance.version >= '1.65.0') { | ||
await new TitleBar().select('File', 'New File...'); | ||
const input = await InputBox.create(); | ||
await input.setText('text'); | ||
await input.confirm(); | ||
} else { | ||
await new TitleBar().select('File', 'New File'); | ||
} | ||
before(async function () { | ||
this.timeout(30000); | ||
await new Workbench().executeCommand('Create: New File...'); | ||
await (await InputBox.create()).selectQuickPick('Text File'); | ||
await new Promise(res => setTimeout(res, 1000)); | ||
const editor = new TextEditor(); | ||
await editor.typeTextAt(1, 1, 'text'); | ||
await new Promise(res => setTimeout(res, 1000)); | ||
await new EditorView().closeEditor(await editor.getTitle()); | ||
await new Promise(res => setTimeout(res, 1000)); | ||
dialog = new ModalDialog(); | ||
await dialog.getDriver().wait(until.elementsLocated(By.className('monaco-dialog-box')), 5000); | ||
}); | ||
|
||
after(async () => { | ||
after(async function () { | ||
await new Promise(res => setTimeout(res, 1000)); | ||
}); | ||
|
||
it('getMessage works', async () => { | ||
it('getMessage works', async function () { | ||
this.timeout(10000); | ||
const message = await dialog.getMessage(); | ||
expect(message).has.string('Do you want to save the changes'); | ||
}); | ||
|
||
it('getDetails works', async () => { | ||
it('getDetails works', async function () { | ||
this.timeout(10000); | ||
const details = await dialog.getDetails(); | ||
expect(details).has.string('Your changes will be lost'); | ||
}); | ||
|
||
it('getButtons works', async () => { | ||
it('getButtons works', async function () { | ||
this.timeout(10000); | ||
const buttons = await dialog.getButtons(); | ||
expect(buttons.length).equals(3); | ||
}); | ||
|
||
it('pushButton works', async () => { | ||
const driver = dialog.getDriver(); | ||
it('pushButton works', async function () { | ||
this.timeout(10000); | ||
await dialog.pushButton(`Don't Save`); | ||
await driver.wait(until.stalenessOf(dialog), 2000); | ||
await dialog.getDriver().wait(until.stalenessOf(dialog), 2000); | ||
}); | ||
}); | ||
}); |