Skip to content

Commit

Permalink
Provide conditional wait awaiting for the modal dialog to appear in UI
Browse files Browse the repository at this point in the history
tests

to avoid this potential error when it is too slow (happens regularly on
CI)
```
  1) Camel properties auto-completion support
       "after all" hook for "code diagnostic is working":
     NoSuchElementError: no such element: Unable to locate element:
{"method":"css selector","selector":".monaco-dialog-box"}
```

Signed-off-by: Aurélien Pupier <apupier@redhat.com>
  • Loading branch information
apupier committed Feb 18, 2025
1 parent 92b40d2 commit d99d7cf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ui-test/utils/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ export async function closeEditor(title: string, save?: boolean) {
const dirty = await new TextEditor().isDirty();
await new EditorView().closeEditor(title);
if (dirty) {
await VSBrowser.instance.driver.wait(() => {
try {
new ModalDialog();
return true;
} catch {
return false;
}
});
const dialog = new ModalDialog();
if (save) {
await dialog.pushButton('Save');
Expand Down

0 comments on commit d99d7cf

Please sign in to comment.