Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
35 changes: 32 additions & 3 deletions e2e-tests/playwright/support/pages/orchestrator.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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");
Expand All @@ -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") {
Expand Down Expand Up @@ -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") {
Expand Down
Loading