From d40c27d04ad7cb25602f471baaaa993e8320936f Mon Sep 17 00:00:00 2001 From: Gustavo Lira Date: Thu, 2 Apr 2026 08:43:38 -0300 Subject: [PATCH 1/4] fix(e2e): add explicit visibility wait before clicking workflow links Race condition in selectFailSwitchWorkflowItem and selectGreetingWorkflowItem: the table becomes visible but the specific workflow link may not yet be rendered, causing the click to fail silently and tests to timeout after 50+ seconds. Add explicit `await expect(link).toBeVisible({ timeout: 30000 })` before clicking, matching the fix applied to main in #4494. Ref: https://issues.redhat.com/browse/RHDHBUGS-2671 Co-Authored-By: Claude Sonnet 4.6 --- e2e-tests/playwright/support/pages/orchestrator.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/e2e-tests/playwright/support/pages/orchestrator.ts b/e2e-tests/playwright/support/pages/orchestrator.ts index 1a7d45642a..63b5d5f49d 100644 --- a/e2e-tests/playwright/support/pages/orchestrator.ts +++ b/e2e-tests/playwright/support/pages/orchestrator.ts @@ -24,7 +24,11 @@ export class Orchestrator { await expect(workflowHeader).toBeVisible(); await expect(workflowHeader).toHaveText("Workflows"); await expect(Workflows.workflowsTable(this.page)).toBeVisible(); - await this.page.getByRole("link", { name: "Greeting workflow" }).click(); + const greetingLink = this.page.getByRole("link", { + name: "Greeting workflow", + }); + await expect(greetingLink).toBeVisible({ timeout: 30000 }); + await greetingLink.click(); } async runGreetingWorkflow(language = "English", status = "Completed") { @@ -257,7 +261,11 @@ export class Orchestrator { await expect(workflowHeader).toBeVisible(); await expect(workflowHeader).toHaveText("Workflows"); await expect(Workflows.workflowsTable(this.page)).toBeVisible(); - await this.page.getByRole("link", { name: "FailSwitch workflow" }).click(); + const failSwitchLink = this.page.getByRole("link", { + name: "FailSwitch workflow", + }); + await expect(failSwitchLink).toBeVisible({ timeout: 30000 }); + await failSwitchLink.click(); } async runFailSwitchWorkflow(input = "OK") { From e4185584fbaee96087489743c7063bd949729982 Mon Sep 17 00:00:00 2001 From: Gustavo Lira Date: Mon, 6 Apr 2026 16:13:31 -0300 Subject: [PATCH 2/4] fix(e2e): handle FailSwitch workflow backend registration delay Add waitForWorkflowToAppear helper that uses short auto-wait checks (3s) before reloading the page, avoiding unnecessary reloads while handling the race condition where the backend hasn't registered the workflow yet. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../playwright/support/pages/orchestrator.ts | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/e2e-tests/playwright/support/pages/orchestrator.ts b/e2e-tests/playwright/support/pages/orchestrator.ts index 63b5d5f49d..43a0ea3040 100644 --- a/e2e-tests/playwright/support/pages/orchestrator.ts +++ b/e2e-tests/playwright/support/pages/orchestrator.ts @@ -1,4 +1,4 @@ -import { expect, type Page } from "@playwright/test"; +import { expect, type Locator, type Page } from "@playwright/test"; import Workflows from "./workflows"; export class Orchestrator { @@ -8,6 +8,21 @@ export class Orchestrator { this.page = page; } + // Waits for a workflow link to appear in the table, reloading + // the page if needed (backend may still be registering it). + private async waitForWorkflowToAppear(locator: Locator) { + for (let i = 0; i < 3; i++) { + try { + await expect(locator).toBeVisible({ timeout: 3000 }); + return; + } catch { + await this.page.reload({ waitUntil: "domcontentloaded" }); + await expect(Workflows.workflowsTable(this.page)).toBeVisible(); + } + } + await expect(locator).toBeVisible({ timeout: 10000 }); + } + async openWorkflowAlert() { // This is only valid for MILESTONE 2 const alert = this.page.getByRole("alert"); @@ -264,7 +279,8 @@ export class Orchestrator { const failSwitchLink = this.page.getByRole("link", { name: "FailSwitch workflow", }); - await expect(failSwitchLink).toBeVisible({ timeout: 30000 }); + + await this.waitForWorkflowToAppear(failSwitchLink); await failSwitchLink.click(); } From 7d785a7750d4ed8ea3c7025a15ff122a4c10a028 Mon Sep 17 00:00:00 2001 From: Gustavo Lira Date: Tue, 7 Apr 2026 09:48:10 -0300 Subject: [PATCH 3/4] fix(e2e): increase workflow registration wait for SonataFlow deploy The SonataFlow operator + Data Index Service can take over a minute to register workflows after a fresh deploy. Increase retry window to 10 attempts with 5s auto-wait each + 30s final assertion, and bump test timeout to 180s to accommodate the longer wait. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../plugins/orchestrator/failswitch-workflow.spec.ts | 4 ++++ e2e-tests/playwright/support/pages/orchestrator.ts | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/e2e-tests/playwright/e2e/plugins/orchestrator/failswitch-workflow.spec.ts b/e2e-tests/playwright/e2e/plugins/orchestrator/failswitch-workflow.spec.ts index 456a878df0..f8e6c34759 100644 --- a/e2e-tests/playwright/e2e/plugins/orchestrator/failswitch-workflow.spec.ts +++ b/e2e-tests/playwright/e2e/plugins/orchestrator/failswitch-workflow.spec.ts @@ -5,6 +5,10 @@ import { Orchestrator } from "../../../support/pages/orchestrator"; import { LogUtils } from "../../audit-log/log-utils"; test.describe("Orchestrator failswitch workflow tests", () => { + // SonataFlow operator + Data Index can take over a minute to + // register workflows after deploy; default 90s is not enough. + test.describe.configure({ timeout: 180_000 }); + let uiHelper: UIhelper; let common: Common; let orchestrator: Orchestrator; diff --git a/e2e-tests/playwright/support/pages/orchestrator.ts b/e2e-tests/playwright/support/pages/orchestrator.ts index 43a0ea3040..8f3433311e 100644 --- a/e2e-tests/playwright/support/pages/orchestrator.ts +++ b/e2e-tests/playwright/support/pages/orchestrator.ts @@ -8,19 +8,20 @@ export class Orchestrator { this.page = page; } - // Waits for a workflow link to appear in the table, reloading - // the page if needed (backend may still be registering it). + // Waits for a workflow to appear in the table, reloading the page + // between attempts. The SonataFlow operator + Data Index Service + // can take over a minute to register a workflow after deploy. private async waitForWorkflowToAppear(locator: Locator) { - for (let i = 0; i < 3; i++) { + for (let i = 0; i < 10; i++) { try { - await expect(locator).toBeVisible({ timeout: 3000 }); + await expect(locator).toBeVisible({ timeout: 5000 }); return; } catch { await this.page.reload({ waitUntil: "domcontentloaded" }); await expect(Workflows.workflowsTable(this.page)).toBeVisible(); } } - await expect(locator).toBeVisible({ timeout: 10000 }); + await expect(locator).toBeVisible({ timeout: 30000 }); } async openWorkflowAlert() { From 00401a965ee22f8531c38db6748f0ebcad3c84e2 Mon Sep 17 00:00:00 2001 From: Gustavo Lira Date: Tue, 7 Apr 2026 14:37:39 -0300 Subject: [PATCH 4/4] fix(e2e): replace fragile nth() table locator with semantic heading The Workflows.workflowsTable locator uses nth(2) on generic divs, which breaks during page loading states after reload. Replace with the stable "Workflows" heading locator inside waitForWorkflowToAppear to prevent the retry loop from failing on transient DOM states. Co-Authored-By: Claude Opus 4.6 (1M context) --- e2e-tests/playwright/support/pages/orchestrator.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/e2e-tests/playwright/support/pages/orchestrator.ts b/e2e-tests/playwright/support/pages/orchestrator.ts index 8f3433311e..6be9467ed9 100644 --- a/e2e-tests/playwright/support/pages/orchestrator.ts +++ b/e2e-tests/playwright/support/pages/orchestrator.ts @@ -18,7 +18,11 @@ export class Orchestrator { return; } catch { await this.page.reload({ waitUntil: "domcontentloaded" }); - await expect(Workflows.workflowsTable(this.page)).toBeVisible(); + // Wait for the table to render after reload; use the heading + // instead of Workflows.workflowsTable (fragile nth() locator). + await expect( + this.page.getByRole("heading", { name: "Workflows" }), + ).toBeVisible({ timeout: 15000 }); } } await expect(locator).toBeVisible({ timeout: 30000 });