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 1a7d45642a..6be9467ed9 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,26 @@ export class Orchestrator { this.page = page; } + // 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 < 10; i++) { + try { + await expect(locator).toBeVisible({ timeout: 5000 }); + return; + } catch { + await this.page.reload({ waitUntil: "domcontentloaded" }); + // 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 }); + } + async openWorkflowAlert() { // This is only valid for MILESTONE 2 const alert = this.page.getByRole("alert"); @@ -24,7 +44,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 +281,12 @@ 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 this.waitForWorkflowToAppear(failSwitchLink); + await failSwitchLink.click(); } async runFailSwitchWorkflow(input = "OK") {