From c75750a52b8f49aa6a9e6c7c718b6265b28a94c9 Mon Sep 17 00:00:00 2001 From: Tobias Ortmayr Date: Tue, 25 Jul 2023 11:32:37 +0200 Subject: [PATCH] Fix bug in `TheiaDialog` page object Fix bug with the `TheiaDialog.waitUntilMainButtonIsEnabled` method not working as expected (infinite timeout). Call `waitUntilMainButtonIsEnabled` in `TheiaExplorView.renameNode` to ensure that the method is covered by the test case execution. --- examples/playwright/src/theia-dialog.ts | 6 +++--- examples/playwright/src/theia-explorer-view.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/playwright/src/theia-dialog.ts b/examples/playwright/src/theia-dialog.ts index 91ba39196ea5b..1ec75572a7011 100644 --- a/examples/playwright/src/theia-dialog.ts +++ b/examples/playwright/src/theia-dialog.ts @@ -105,10 +105,10 @@ export class TheiaDialog extends TheiaPageObject { } async waitUntilMainButtonIsEnabled(): Promise { - await this.page.waitForFunction(() => { - const button = document.querySelector(`${this.controlSelector} > button.theia-button.main`); + await this.page.waitForFunction(predicate => { + const button = document.querySelector(predicate.buttonSelector); return !!button && !button.disabled; - }); + }, { buttonSelector: `${this.controlSelector} > button.theia-button.main` }); } } diff --git a/examples/playwright/src/theia-explorer-view.ts b/examples/playwright/src/theia-explorer-view.ts index 5bcb3fbebe874..9d70214086628 100644 --- a/examples/playwright/src/theia-explorer-view.ts +++ b/examples/playwright/src/theia-explorer-view.ts @@ -265,6 +265,7 @@ export class TheiaExplorerView extends TheiaView { const renameDialog = new TheiaRenameDialog(this.app); await renameDialog.waitForVisible(); await renameDialog.enterNewName(newName); + await renameDialog.waitUntilMainButtonIsEnabled(); confirm ? await renameDialog.confirm() : await renameDialog.close(); await renameDialog.waitForClosed(); await this.refresh();