diff --git a/test/ui/common/ui/webview/newComponentWebViewEditor.ts b/test/ui/common/ui/webview/newComponentWebViewEditor.ts index e2689f7a5..44dfe3ad2 100644 --- a/test/ui/common/ui/webview/newComponentWebViewEditor.ts +++ b/test/ui/common/ui/webview/newComponentWebViewEditor.ts @@ -208,7 +208,7 @@ export class LocalCodeBasePage extends Page { public async clickCreateComponent(): Promise { await this.enterWebView(async (webView) => { - const button = await this.getCreateComponentButton(webView); + const button = await this.createButtonExists(webView); await button.click(); }); } @@ -221,6 +221,19 @@ export class LocalCodeBasePage extends Page { return await webView.findWebElement(By.xpath('//button[contains(text(), "Select Folder")]')); } + private async createButtonExists(webView: WebView, timeout = 60_000): Promise { + return webView.getDriver().wait(async () => { + try { + const button = await this.getCreateComponentButton(webView); + if (button) { + return button; + } + } catch (err) { + return null; + } + }, timeout); + } + private async getCreateComponentButton(webView: WebView): Promise { return await webView.findWebElement(By.xpath('//span[contains(text(), "Create Component")]')); }