Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/tests/e2e/workflow-builder-run.mobile-a11y.spec.ts
T

981 lines
53 KiB
TypeScript

import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { compactMobileViewport, expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
import { escapeRegExp, interceptCurrentRoutePost, postDataIncludesField, singleFetchActionData, singleFetchActionError, skipIfUnavailable } from "./utils/navigation";
import {
skipOrFailWhenE2eFixtureMissing,
skipOrFailWhenE2eInputsMissing,
skipOrFailWhenE2eReadinessOptInMissing,
} from "./utils/readiness";
import { requireWorkflowOutboxDrainReadiness, waitForWorkflowExecutionTerminal } from "./utils/workflow";
const credentials = getTenantCredentials();
const workflowBuilderPath = process.env.E2E_WORKFLOW_BUILDER_PATH;
const workflowRunApiPath = process.env.E2E_WORKFLOW_RUN_API_PATH;
const workflowRunManualPath = process.env.E2E_WORKFLOW_RUN_MANUAL_PATH;
const workflowRunStreamPath = process.env.E2E_WORKFLOW_RUN_STREAM_PATH ?? deriveWorkflowRunStreamPath(workflowRunManualPath ?? workflowRunApiPath);
const workflowWebhookBuilderPath = process.env.E2E_WORKFLOW_WEBHOOK_BUILDER_PATH;
const workflowWebhookRunManualPath = process.env.E2E_WORKFLOW_WEBHOOK_RUN_MANUAL_PATH;
const workflowWebhookTargetUrl = process.env.E2E_WORKFLOW_WEBHOOK_TARGET_URL;
const workflowWaitingExecutionsPath = process.env.E2E_WORKFLOW_WAITING_EXECUTIONS_PATH;
const workflowWaitingExecutionId = process.env.E2E_WORKFLOW_WAITING_EXECUTION_ID;
const workflowWaitingRunManualPath = process.env.E2E_WORKFLOW_WAITING_RUN_MANUAL_PATH;
const workflowWaitingRunApiPath = process.env.E2E_WORKFLOW_WAITING_RUN_API_PATH;
// The seed does not expose a dedicated stream path for the waiting workflow, so
// derive it from its manual/API run path (same shape as the deterministic
// workflow above): `.../wf_waiting_123/run/manual` -> `.../run/stream`.
const workflowWaitingRunStreamPath =
process.env.E2E_WORKFLOW_WAITING_RUN_STREAM_PATH ?? deriveWorkflowRunStreamPath(workflowWaitingRunManualPath ?? workflowWaitingRunApiPath);
const allowWorkflowWebhookRun = process.env.E2E_ALLOW_WORKFLOW_WEBHOOK_RUN === "1";
function deriveWorkflowExecutionsPath(builderPath: string | undefined): string | undefined {
const path = builderPath?.split(/[?#]/u)[0]?.replace(/\/+$/u, "");
const match = path?.match(/^(.*\/workflow-engine\/workflows\/[^/]+)/u);
return match ? `${match[1]}/executions` : undefined;
}
function deriveWorkflowRunStreamPath(runPath: string | undefined): string | undefined {
const path = runPath?.split(/[?#]/u)[0]?.replace(/\/+$/u, "");
if (!path) return undefined;
const streamPath = path.replace(/\/run\/(?:manual|api)$/u, "/run/stream");
return streamPath === path ? undefined : streamPath;
}
function requireWorkflowWebhookRunReadiness(env: NodeJS.ProcessEnv = process.env): void {
if (env.E2E_ALLOW_WORKFLOW_WEBHOOK_RUN !== "1") return;
const required = [
"E2E_TENANT_EMAIL",
"E2E_TENANT_PASSWORD",
"E2E_WORKFLOW_WEBHOOK_BUILDER_PATH",
"E2E_WORKFLOW_WEBHOOK_RUN_MANUAL_PATH",
"E2E_WORKFLOW_WEBHOOK_TARGET_URL",
];
const missing = required.filter((key) => !env[key]);
if (missing.length > 0) {
throw new Error(
`E2E workflow webhook run opt-in missing ${missing.join(", ")}. ` +
"Source .env.e2e-readiness and set E2E_WORKFLOW_WEBHOOK_TARGET_URL before using E2E_ALLOW_WORKFLOW_WEBHOOK_RUN=1."
);
}
}
async function inputEditorFill(page: import("@playwright/test").Page, value: Record<string, unknown>): Promise<void> {
const inputEditor = page.locator('[data-ui-id="ui.workflows.run.manual.inputEditor"]').first();
await inputEditor.click();
await page.keyboard.press("ControlOrMeta+A");
await page.keyboard.press("Backspace");
await page.keyboard.insertText(JSON.stringify(value, null, 2));
}
function waitingExecution() {
return {
id: "e2e_waiting_execution",
createdAt: new Date("2026-05-28T00:00:00.000Z").toISOString(),
status: "waitingBlock",
input: {},
output: null,
duration: null,
endedAt: null,
error: null,
blockRuns: [],
executionAlerts: [],
waitingBlock: {
id: "e2e_waiting_block",
index: 0,
type: "waitForInput",
variableName: "approval",
description: "E2E waiting input",
input: { title: "E2E approval", placeholder: "Type approval" },
isTrigger: false,
isBlock: true,
conditionGroups: [],
toBlocks: [],
},
};
}
async function interceptWorkflowWaitingContinuation(
page: import("@playwright/test").Page
): Promise<{ readonly initialPost: { value: string | null }; readonly continuationPost: { value: string | null } }> {
const initialPost = { value: null as string | null };
const continuationPost = { value: null as string | null };
const currentUrl = new URL(page.url());
await page.route("**/*", async (route) => {
const request = route.request();
const requestUrl = new URL(request.url());
if (request.method() === "POST" && requestUrl.origin === currentUrl.origin && (requestUrl.pathname === currentUrl.pathname || requestUrl.pathname === `${currentUrl.pathname}.data`)) {
const postData = request.postData();
if (postDataIncludesField(postData, "action", /^execute$/u)) {
initialPost.value = postData;
await route.fulfill(await singleFetchActionData({ success: "Workflow queued", execution: waitingExecution() }));
return;
}
if (postDataIncludesField(postData, "action", /^continue-execution$/u)) {
continuationPost.value = postData;
await route.fulfill(
await singleFetchActionData(
{ success: "Workflow queued", execution: { ...waitingExecution(), id: "e2e_continued_execution", status: "success", waitingBlock: null } },
202
)
);
return;
}
}
await route.fallback();
});
return { initialPost, continuationPost };
}
test.describe("workflow builder and manual run mobile a11y", () => {
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
test("builder stays usable on mobile", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_BUILDER_PATH"],
"Workflow builder mobile a11y inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const builderResponse = await page.goto(workflowBuilderPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, builderResponse, workflowBuilderPath!);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowBuilderPath!)}(?:[?#].*)?$`, "u"));
const canvas = page.locator('[data-ui-id="ui.workflows.builder.canvas"]').first();
await expect(canvas).toBeVisible({ timeout: 10_000 });
await expect(canvas).toHaveAccessibleName(/workflow builder canvas|workflow-builder-arbeitsfläche/i);
await canvas.focus();
await expect(canvas).toBeFocused();
const builderNodes = page.locator('[data-ui-id="ui.workflows.builder.node"]');
const renderedNodes = await builderNodes.count();
if (renderedNodes === 0) {
await expect(page.getByText(/add block|add trigger|empty workflow|workflow/i).first()).toBeVisible();
} else {
const firstNode = builderNodes.first();
await expect(firstNode).toBeVisible();
const nodeId = await firstNode.getAttribute("data-workflow-node-id");
const nodeKind = await firstNode.getAttribute("data-workflow-node-kind");
expect(nodeId).toBeTruthy();
if (nodeKind !== "set-trigger") {
await firstNode.click();
await expect(page.locator('[data-ui-id="ui.workflows.builder.nodeSettings"]').first()).toHaveAttribute("data-workflow-node-id", nodeId!);
}
}
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("execution status details stay readable on mobile without mutations", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_BUILDER_PATH"],
"Workflow execution mobile a11y inputs not configured"
);
const workflowExecutionsPath = deriveWorkflowExecutionsPath(workflowBuilderPath);
if (!workflowExecutionsPath) {
skipOrFailWhenE2eFixtureMissing("Workflow builder path could not be mapped to an executions path");
}
await loginAsTenantUser(page, credentials!);
const mutatingRequests: string[] = [];
await page.route("**/*", async (route) => {
const method = route.request().method();
// Observability beacons (Sentry/OTel) are not app mutations; the live
// boiler target has them enabled, so exclude them from the guard.
const isTelemetry = /sentry|otel|otlp/iu.test(route.request().url());
if (!isTelemetry && (method === "POST" || method === "PATCH" || method === "DELETE")) {
mutatingRequests.push(`${method} ${route.request().url()}`);
await route.abort();
return;
}
await route.continue();
});
const executionsResponse = await page.goto(workflowExecutionsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, executionsResponse, workflowExecutionsPath);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowExecutionsPath)}(?:[?#].*)?$`, "u"));
// Several "Executions" labels exist (collapsed nav + sr-only headings); assert
// the visible one rather than .first(), which resolves to a hidden instance.
await expect(page.getByText(/executions|ausführungen/i).filter({ visible: true }).first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const executionRows = page
.getByRole("button")
.filter({ hasText: /node(?:s)? executed|block(?:s)? executed|ausgeführt|success|error|incomplete|erfolg|fehler|unvollständig/i });
if ((await executionRows.count()) === 0) {
skipOrFailWhenE2eFixtureMissing("Workflow execution fixture has no execution rows to inspect");
}
await executionRows.first().click();
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowExecutionsPath)}\\?executionId=.+`, "u"));
await expect(page.getByText(/^status$/i).first()).toBeVisible();
await expect(page.getByText(/duration|dauer/i).first()).toBeVisible();
await expect(page.getByText(/params|parameter|input|eingabe/i).first()).toBeVisible();
await expect(page.getByText(/workflow output|workflow-ausgabe|output|ausgabe/i).first()).toBeVisible();
await expect(mutatingRequests, `Unexpected mutating requests: ${mutatingRequests.join(", ")}`).toEqual([]);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("seeded waiting execution details stay readable on mobile without mutations", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_WAITING_EXECUTIONS_PATH", "E2E_WORKFLOW_WAITING_EXECUTION_ID"],
"Workflow waiting execution mobile a11y inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const mutatingRequests: string[] = [];
await page.route("**/*", async (route) => {
const method = route.request().method();
// Observability beacons (Sentry/OTel) are not app mutations; the live
// boiler target has them enabled, so exclude them from the guard.
const isTelemetry = /sentry|otel|otlp/iu.test(route.request().url());
if (!isTelemetry && (method === "POST" || method === "PATCH" || method === "DELETE")) {
mutatingRequests.push(`${method} ${route.request().url()}`);
await route.abort();
return;
}
await route.continue();
});
const waitingExecutionUrl = `${workflowWaitingExecutionsPath!}?executionId=${encodeURIComponent(workflowWaitingExecutionId!)}`;
const executionsResponse = await page.goto(waitingExecutionUrl, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, executionsResponse, waitingExecutionUrl);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowWaitingExecutionsPath!)}\\?executionId=${escapeRegExp(workflowWaitingExecutionId!)}`, "u"));
await expect(page.getByText(/^status$/i).first()).toBeVisible();
await expect(page.getByText(/waitingBlock|waiting|wartet/i).first()).toBeVisible();
await expect(page.getByText(/duration|dauer/i).first()).toBeVisible();
await expect(page.getByText(/params|parameter|input|eingabe/i).first()).toBeVisible();
await expect(page.getByText(/workflow output|workflow-ausgabe|output|ausgabe/i).first()).toBeVisible();
await expect(mutatingRequests, `Unexpected mutating requests: ${mutatingRequests.join(", ")}`).toEqual([]);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("run dropdown stays keyboard reachable without starting execution", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_BUILDER_PATH", "E2E_WORKFLOW_RUN_MANUAL_PATH"],
"Workflow run dropdown keyboard inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const builderResponse = await page.goto(workflowBuilderPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, builderResponse, workflowBuilderPath!);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowBuilderPath!)}(?:[?#].*)?$`, "u"));
const triggerButton = page.locator('[data-ui-id="ui.workflows.run.dropdown.button"]').first();
if ((await triggerButton.count()) === 0 || !(await triggerButton.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Workflow builder fixture has no run dropdown trigger");
}
await expect(triggerButton).toBeVisible();
await triggerButton.focus();
await expect(triggerButton).toBeFocused();
if (!(await triggerButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow run dropdown is disabled; provide a runnable workflow fixture");
}
await page.keyboard.press("Enter");
const menu = page.locator('[data-ui-id="ui.workflows.run.dropdown.menu"]').first();
await expect(menu).toBeVisible();
const manualOption = page.locator('[data-ui-id="ui.workflows.run.dropdown.manual"]').first();
await expect(manualOption).toBeVisible();
await expect(manualOption).toHaveAttribute("data-workflow-run-mode", "manual");
await expect(manualOption).toHaveAttribute("href", new RegExp(`${escapeRegExp(workflowRunManualPath!)}(?:[?#].*)?$`, "u"));
const apiOption = page.locator('[data-ui-id="ui.workflows.run.dropdown.api"]').first();
await expect(apiOption).toBeVisible();
if (workflowRunApiPath) {
await expect(apiOption).toHaveAttribute("href", new RegExp(`${escapeRegExp(workflowRunApiPath)}(?:[?#].*)?$`, "u"));
}
const streamOption = page.locator('[data-ui-id="ui.workflows.run.dropdown.stream"]').first();
await expect(streamOption).toBeVisible();
if (workflowRunStreamPath) {
await expect(streamOption).toHaveAttribute("href", new RegExp(`${escapeRegExp(workflowRunStreamPath)}(?:[?#].*)?$`, "u"));
}
await page.keyboard.press("Escape");
await expect(menu).toBeHidden();
await expect(triggerButton).toBeFocused();
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowBuilderPath!)}(?:[?#].*)?$`, "u"));
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("status toggle posts live/draft contract without mutating workflow state", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_BUILDER_PATH"],
"Workflow status toggle contract inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const builderResponse = await page.goto(workflowBuilderPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, builderResponse, workflowBuilderPath!);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowBuilderPath!)}(?:[?#].*)?$`, "u"));
const statusToggle = page.locator('[data-ui-id="ui.workflows.builder.statusToggle"]').first();
await expect(statusToggle).toBeVisible();
const switchControl = statusToggle.getByRole("switch").first();
if ((await switchControl.count()) === 0 || !(await switchControl.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Workflow builder fixture has no visible live/draft switch");
}
if (!(await switchControl.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow status switch is disabled; provide a ready draft or live workflow fixture");
}
const checkedBefore = (await switchControl.getAttribute("aria-checked")) === "true";
const expectedEnabled = checkedBefore ? "false" : "true";
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const submittedPostData = await interceptCurrentRoutePost(page, {
status: 200,
body: JSON.stringify({ success: "E2E intercepted workflow status toggle" }),
contentType: "application/json",
});
await switchControl.click();
await expect.poll(() => submittedPostData.value, { message: "workflow status toggle POST payload was captured" }).not.toBeNull();
expect(postDataIncludesField(submittedPostData.value, "action", /^toggle$/u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "enabled", new RegExp(`^${expectedEnabled}$`, "u"))).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "csrf", /.+/u)).toBe(true);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowBuilderPath!)}(?:[?#].*)?$`, "u"));
await expectNoHorizontalOverflow(page);
});
test("manual run contract stays usable on mobile", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_RUN_MANUAL_PATH"],
"Workflow manual run smoke inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunManualPath!);
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.title"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.form"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.inputEditor"]').first()).toBeVisible();
const inputExampleSelect = page.locator('[data-ui-id="ui.workflows.run.manual.inputExampleSelect"]').first();
if ((await inputExampleSelect.count()) > 0) {
await expect(inputExampleSelect).toBeVisible();
}
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const runButton = page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow manual run button is disabled; provide a live deterministic workflow path to execute this smoke");
}
if (process.env.E2E_ALLOW_WORKFLOW_RUN === "1") {
await Promise.all([page.waitForLoadState("domcontentloaded"), runButton.click()]);
const executionResult = page.locator('[data-ui-id="ui.workflows.run.manual.executionResult"]').first();
await expect(executionResult).toBeVisible({ timeout: 15_000 });
await expect(executionResult.locator('[data-ui-id="ui.workflows.run.manual.viewExecutionFlow"]').first()).toBeVisible();
await expect(executionResult.locator('[data-ui-id="ui.workflows.run.manual.runAgain"]').first()).toBeVisible();
await expect(executionResult).toContainText(/block executed|blocks executed|block ausgeführt|blöcke ausgeführt/i);
} else {
const submittedPostData = await interceptCurrentRoutePost(page);
await runButton.click();
await expect.poll(() => submittedPostData.value, { message: "workflow manual run POST payload was captured" }).not.toBeNull();
expect(postDataIncludesField(submittedPostData.value, "action", /^execute$/u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "input", /./u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "csrf", /.+/u)).toBe(true);
const input = new URLSearchParams(submittedPostData.value ?? "").get("input");
expect(input).not.toBeNull();
const parsedInput = JSON.parse(input ?? "");
if (workflowRunManualPath?.includes("/wf_123/")) {
expect(parsedInput).toEqual({ message: "ready" });
}
}
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("manual waiting-block continuation posts raw input on mobile", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_RUN_MANUAL_PATH"],
"Workflow manual continuation smoke inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunManualPath!);
const runButton = page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow manual run button is disabled; provide a runnable workflow fixture");
}
const posts = await interceptWorkflowWaitingContinuation(page);
await runButton.click();
await expect.poll(() => posts.initialPost.value, { message: "workflow manual execute POST payload was captured" }).not.toBeNull();
const executionResult = page.locator('[data-ui-id="ui.workflows.run.manual.executionResult"]').first();
await expect(executionResult).toBeVisible();
const waitingForm = executionResult.locator('[data-ui-id="ui.workflows.run.manual.waitingInput.form"]').first();
await expect(waitingForm).toBeVisible();
const waitingInput = waitingForm.locator('[data-ui-id="ui.workflows.run.manual.waitingInput.input"]').first();
await expect(waitingInput).toHaveAttribute("placeholder", "Type approval");
await waitingInput.fill("approved manually");
await waitingForm.locator('[data-ui-id="ui.workflows.run.manual.waitingInput.submit"]').click();
await expect.poll(() => posts.continuationPost.value, { message: "workflow manual continuation POST payload was captured" }).not.toBeNull();
expect(postDataIncludesField(posts.continuationPost.value, "action", /^continue-execution$/u)).toBe(true);
expect(postDataIncludesField(posts.continuationPost.value, "executionId", /^e2e_waiting_execution$/u)).toBe(true);
expect(postDataIncludesField(posts.continuationPost.value, "input", /^approved manually$/u)).toBe(true);
expect(postDataIncludesField(posts.continuationPost.value, "csrf", /.+/u)).toBe(true);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("API run contract stays reachable on mobile without invoking the backend API", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_RUN_API_PATH"],
"Workflow API run smoke inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunApiPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunApiPath!);
await expect(page.locator('[data-ui-id="ui.workflows.run.api.title"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.api.form"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.api.inputEditor"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.api.field.url"]').first()).toHaveValue(/\/v1\/workflows\/run\//u);
await expect(page.locator('[data-ui-id="ui.workflows.run.api.field.method"]').first()).toHaveValue("POST");
await expect(page.locator('[data-ui-id="ui.workflows.run.api.field.apiKey"]').first()).toHaveValue(/api key|api-schlüssel/i);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const runButton = page.locator('[data-ui-id="ui.workflows.run.api.submit"]').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow API run button is disabled; provide a live deterministic workflow path to verify this contract");
}
const submittedPostData = await interceptCurrentRoutePost(page);
await runButton.click();
await expect.poll(() => submittedPostData.value, { message: "workflow API run POST payload was captured" }).not.toBeNull();
expect(postDataIncludesField(submittedPostData.value, "action", /^execute$/u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "input", /./u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "csrf", /.+/u)).toBe(true);
const input = new URLSearchParams(submittedPostData.value ?? "").get("input");
expect(input).not.toBeNull();
expect(() => JSON.parse(input ?? "")).not.toThrow();
});
test("API waiting-block continuation posts JSON input on mobile", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_RUN_API_PATH"],
"Workflow API continuation smoke inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunApiPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunApiPath!);
const runButton = page.locator('[data-ui-id="ui.workflows.run.api.submit"]').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow API run button is disabled; provide a runnable workflow fixture");
}
const posts = await interceptWorkflowWaitingContinuation(page);
await runButton.click();
await expect.poll(() => posts.initialPost.value, { message: "workflow API execute POST payload was captured" }).not.toBeNull();
const executionResult = page.locator('[data-ui-id="ui.workflows.run.api.executionResult"]').first();
await expect(executionResult).toBeVisible();
const waitingForm = executionResult.locator('[data-ui-id="ui.workflows.run.api.waitingInput.form"]').first();
await expect(waitingForm).toBeVisible();
const waitingInput = waitingForm.locator('[data-ui-id="ui.workflows.run.api.waitingInput.input"]').first();
await expect(waitingInput).toHaveAttribute("placeholder", "Type approval");
await waitingInput.fill("approved by api");
await waitingForm.locator('[data-ui-id="ui.workflows.run.api.waitingInput.submit"]').click();
await expect.poll(() => posts.continuationPost.value, { message: "workflow API continuation POST payload was captured" }).not.toBeNull();
expect(postDataIncludesField(posts.continuationPost.value, "action", /^continue-execution$/u)).toBe(true);
expect(postDataIncludesField(posts.continuationPost.value, "executionId", /^e2e_waiting_execution$/u)).toBe(true);
const input = new URLSearchParams(posts.continuationPost.value ?? "").get("input");
expect(input).toBe(JSON.stringify({ input: "approved by api" }));
expect(postDataIncludesField(posts.continuationPost.value, "csrf", /.+/u)).toBe(true);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("stream run waiting-block continuation stays usable on mobile", async ({ page }) => {
// Playwright's page.route does NOT reliably intercept the native EventSource
// (SSE) the stream view opens, so the previous synthetic flow — fake the
// execute response with a non-existent executionId and try to fulfil its
// EventSource GET — flaked: the GET reached the real server, 404'd on the
// missing execution, and the waiting form never rendered. Instead run the
// seeded waiting workflow (wf_waiting_123: manual trigger -> waitForInput)
// for real. WorkflowsExecutionsService.stream() executes inline and emits
// the waitingBlock DTO over the *real* SSE, so the waiting form renders
// without any interception. This needs a live, mutating run, so gate it on
// E2E_ALLOW_WORKFLOW_RUN like the other real-run smokes.
skipOrFailWhenE2eReadinessOptInMissing("E2E_ALLOW_WORKFLOW_RUN", "skipping mutating workflow stream continuation flow");
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Workflow stream continuation smoke inputs not configured");
if (!workflowWaitingRunStreamPath) {
skipOrFailWhenE2eFixtureMissing(
"Workflow waiting stream run path could not be derived; set E2E_WORKFLOW_WAITING_RUN_STREAM_PATH or E2E_WORKFLOW_WAITING_RUN_MANUAL_PATH"
);
}
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowWaitingRunStreamPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowWaitingRunStreamPath);
await expect(page.locator('[data-ui-id="ui.workflows.run.stream.title"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.stream.form"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.stream.inputEditor"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const runButton = page.locator('[data-ui-id="ui.workflows.run.stream.submit"]').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow stream run button is disabled; provide a runnable waiting workflow fixture");
}
// Run for real (no execute interception). The inline stream execution drives
// the waiting workflow to its waitForInput block and emits the waitingBlock
// execution over the real SSE, which renders the waiting form below.
await runButton.click();
// The inline stream execution must reach the waitForInput block and emit it
// over the real SSE before the progress/form render; under serial load on the
// remote target that can take a while, so allow generous time.
const progress = page.locator('[data-ui-id="ui.workflows.run.stream.progress"]').first();
await expect(progress).toBeVisible({ timeout: 45_000 });
const waitingForm = progress.locator('[data-ui-id="ui.workflows.run.stream.waitingInput.form"]').first();
await expect(waitingForm).toBeVisible({ timeout: 45_000 });
const waitingInput = waitingForm.locator('[data-ui-id="ui.workflows.run.stream.waitingInput.input"]').first();
await expect(waitingInput).toHaveAttribute("placeholder", "Type approval");
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
// Capture the continuation POST contract without touching the SSE GET:
// interceptCurrentRoutePost only intercepts same-route POSTs, and
// `passthrough` lets the real continuation queue so we assert the genuine
// executionId the SSE rendered (a real id, not a synthetic literal).
const continuationPost = await interceptCurrentRoutePost(page, { passthrough: true });
await waitingInput.fill("approved by stream");
await waitingForm.locator('[data-ui-id="ui.workflows.run.stream.waitingInput.submit"]').click();
await expect.poll(() => continuationPost.value, { message: "workflow stream continuation POST payload was captured" }).not.toBeNull();
expect(postDataIncludesField(continuationPost.value, "action", /^continue-execution$/u)).toBe(true);
expect(postDataIncludesField(continuationPost.value, "executionId", /\S/u)).toBe(true);
expect(postDataIncludesField(continuationPost.value, "input", /^approved by stream$/u)).toBe(true);
expect(postDataIncludesField(continuationPost.value, "csrf", /.+/u)).toBe(true);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("manual run result deep-links to execution details on mobile when explicitly enabled", async ({ page, context }) => {
skipOrFailWhenE2eReadinessOptInMissing("E2E_ALLOW_WORKFLOW_RUN", "skipping mutating workflow execution deep-link flow");
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_RUN_MANUAL_PATH"],
"Workflow manual run deep-link smoke inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunManualPath!);
const runButton = page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow manual run button is disabled; provide a live deterministic workflow path to execute this deep-link smoke");
}
await runButton.click();
const executionResult = page.locator('[data-ui-id="ui.workflows.run.manual.executionResult"]').first();
await expect(executionResult).toBeVisible({ timeout: 15_000 });
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const detailLink = executionResult.locator('[data-ui-id="ui.workflows.run.manual.viewExecutionFlow"]').first();
await expect(detailLink).toBeVisible();
await expect(detailLink).toHaveAttribute("target", "_blank");
await expect(detailLink).toHaveAttribute("href", /\/workflow-engine\/workflows\/[^/?#]+\/executions\?executionId=[^&#]+/u);
const [detailPage] = await Promise.all([context.waitForEvent("page"), detailLink.click()]);
await detailPage.waitForLoadState("domcontentloaded");
await expect(detailPage).toHaveURL(/\/workflow-engine\/workflows\/[^/?#]+\/executions\?executionId=[^&#]+(?:[&#].*)?$/u);
await expect(detailPage.locator('[data-ui-id="ui.workflows.builder.canvas"]').first()).toBeVisible({ timeout: 10_000 });
await expect(detailPage.getByText(/^status$/i).first()).toBeVisible();
await expect(detailPage.getByText(/duration|dauer/i).first()).toBeVisible();
await expect(detailPage.getByText(/params|parameter|input|eingabe/i).first()).toBeVisible();
await expect(detailPage.getByText(/workflow output|workflow-ausgabe|output|ausgabe/i).first()).toBeVisible();
await expectNoHorizontalOverflow(detailPage);
await expectNoCriticalA11yViolations(detailPage);
});
test("manual run reaches expected execution status when outbox-drain readiness is required", async ({ page }) => {
requireWorkflowOutboxDrainReadiness();
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunManualPath!);
const runButton = page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow manual run button is disabled; provide a live deterministic workflow path to execute this outbox-drain readiness smoke");
}
await runButton.click();
const executionResult = page.locator('[data-ui-id="ui.workflows.run.manual.executionResult"]').first();
await expect(executionResult).toBeVisible({ timeout: 15_000 });
const detailLink = executionResult.locator('[data-ui-id="ui.workflows.run.manual.viewExecutionFlow"]').first();
await expect(detailLink).toBeVisible();
const executionDetailsHref = await detailLink.getAttribute("href");
expect(executionDetailsHref).toMatch(/\/workflow-engine\/workflows\/[^/?#]+\/executions\?executionId=[^&#]+/u);
const terminalStatus = await waitForWorkflowExecutionTerminal(page, executionDetailsHref!);
await expect(page.getByText(/^status$/i).first()).toBeVisible();
await expect(page.getByText(new RegExp(`^${terminalStatus}$`, "u")).first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("input examples dropdown populates manual run payload without executing", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_RUN_MANUAL_PATH"],
"Workflow manual run input example smoke inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunManualPath!);
const inputExampleSelect = page.locator('[data-ui-id="ui.workflows.run.manual.inputExampleSelect"]').first();
if ((await inputExampleSelect.count()) === 0) {
skipOrFailWhenE2eFixtureMissing("Workflow manual run fixture has no input examples to select");
}
await expect(inputExampleSelect).toBeVisible();
const triggerButton = page.locator('[data-ui-id="ui.workflows.inputExamples.dropdown.button"]').first();
await expect(triggerButton).toBeVisible();
await triggerButton.focus();
await expect(triggerButton).toBeFocused();
await page.keyboard.press("Enter");
const menu = page.locator('[data-ui-id="ui.workflows.inputExamples.dropdown.menu"]').first();
await expect(menu).toBeVisible();
const firstExample = page.locator('[data-ui-id="ui.workflows.inputExamples.dropdown.item"]').first();
await expect(firstExample).toBeVisible();
await page.keyboard.press("Escape");
await expect(menu).toBeHidden();
await expect(triggerButton).toBeFocused();
await page.keyboard.press("Enter");
await expect(menu).toBeVisible();
await firstExample.click();
const runButton = page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow manual run button is disabled; provide a live deterministic workflow path with input examples");
}
const submittedPostData = await interceptCurrentRoutePost(page);
await runButton.click();
await expect.poll(() => submittedPostData.value, { message: "workflow manual run POST payload was captured" }).not.toBeNull();
expect(postDataIncludesField(submittedPostData.value, "action", /^execute$/u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "csrf", /.+/u)).toBe(true);
const input = new URLSearchParams(submittedPostData.value ?? "").get("input");
expect(input).not.toBeNull();
const parsed = JSON.parse(input ?? "");
expect(parsed).not.toBeNull();
expect(typeof parsed).toBe("object");
});
test("manual run remains on-page when execution action returns an error", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_RUN_MANUAL_PATH"],
"Workflow manual run error smoke inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunManualPath!);
const runForm = page.locator('[data-ui-id="ui.workflows.run.manual.form"]').first();
await expect(runForm).toBeVisible();
const runButton = page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow manual run button is disabled; provide a live deterministic workflow path to execute this smoke");
return;
}
const submittedPostData = await interceptCurrentRoutePost(page, singleFetchActionError("E2E synthetic workflow execution failure"));
await runButton.click();
await expect.poll(() => submittedPostData.value, { message: "workflow manual run POST payload was captured" }).not.toBeNull();
expect(postDataIncludesField(submittedPostData.value, "action", /^execute$/u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "input", /./u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "csrf", /.+/u)).toBe(true);
const input = new URLSearchParams(submittedPostData.value ?? "").get("input");
expect(input).not.toBeNull();
expect(() => JSON.parse(input ?? "")).not.toThrow();
const errorAlert = page.locator('[data-ui-id="ui.workflows.run.manual.error"]').first();
await expect(errorAlert).toBeVisible();
await expect(errorAlert).toHaveAttribute("role", "alert");
await expect(errorAlert).toContainText("E2E synthetic workflow execution failure");
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowRunManualPath!)}(?:[?#].*)?$`, "u"));
await expect(runForm).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("manual run rejects invalid JSON through the real action", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_RUN_MANUAL_PATH"],
"Workflow manual run validation smoke inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunManualPath!);
const runForm = page.locator('[data-ui-id="ui.workflows.run.manual.form"]').first();
await expect(runForm).toBeVisible();
const inputEditor = page.locator('[data-ui-id="ui.workflows.run.manual.inputEditor"]').first();
await expect(inputEditor).toBeVisible();
const runButton = page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow manual run button is disabled; provide a live deterministic workflow path to validate this smoke");
return;
}
// Focus Monaco's edit context before typing — a bare wrapper click leaves
// keystrokes unrouted on mobile, so the default "{}" would be submitted. Then
// insertText (paste-like) a non-bracket string: it bypasses bracket
// auto-closing and is genuinely invalid JSON, so the real action takes its
// 400 branch. Assert the model value before submitting to avoid a silent no-op.
await expect(inputEditor.locator(".monaco-editor")).toBeVisible();
const editContext = inputEditor.locator(".native-edit-context, textarea.ime-text-area, .monaco-editor").first();
await editContext.click();
await expect(inputEditor.locator(".monaco-editor.focused")).toBeVisible();
await page.keyboard.press("ControlOrMeta+A");
await page.keyboard.press("Backspace");
await page.keyboard.insertText("not valid json");
await expect
.poll(() => page.evaluate(() => (window as { monaco?: { editor?: { getModels?: () => Array<{ getValue?: () => string }> } } }).monaco?.editor?.getModels?.()?.[0]?.getValue?.() ?? ""))
.toContain("not valid json");
const invalidJsonResponse = page.waitForResponse(
(response) => response.request().method() === "POST" && response.status() === 400 && response.url().includes(workflowRunManualPath!)
);
await runButton.click();
expect((await invalidJsonResponse).status()).toBe(400);
const errorAlert = page.locator('[data-ui-id="ui.workflows.run.manual.error"]').first();
await expect(errorAlert).toBeVisible();
await expect(errorAlert).toHaveAttribute("role", "alert");
await expect(errorAlert).toContainText(/Input data is not valid JSON|Eingabedaten sind kein gültiges JSON/i);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowRunManualPath!)}(?:[?#].*)?$`, "u"));
await expect(runForm).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.executionResult"]')).toHaveCount(0);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("webhook workflow manual run posts a valid execution contract", async ({ page }) => {
if (allowWorkflowWebhookRun) {
requireWorkflowWebhookRunReadiness();
} else {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_WEBHOOK_RUN_MANUAL_PATH"],
"Workflow webhook run smoke inputs not configured"
);
}
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowWebhookRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowWebhookRunManualPath!);
const runForm = page.locator('[data-ui-id="ui.workflows.run.manual.form"]').first();
await expect(runForm).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.inputEditor"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const runButton = page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first();
await expect(runButton).toBeVisible();
if (!(await runButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow webhook run button is disabled; provide a live deterministic webhook workflow path");
}
if (allowWorkflowWebhookRun) {
await inputEditorFill(page, {
webhookUrl: workflowWebhookTargetUrl!,
message: "ready",
});
await Promise.all([page.waitForLoadState("domcontentloaded"), runButton.click()]);
const executionResult = page.locator('[data-ui-id="ui.workflows.run.manual.executionResult"]').first();
await expect(executionResult).toBeVisible({ timeout: 15_000 });
await expect(executionResult.getByRole("link", { name: /view execution flow|ausführungsablauf anzeigen/i })).toBeVisible();
await expect(executionResult).toContainText(/block executed|blocks executed|block ausgeführt|blöcke ausgeführt/i);
} else {
const submittedPostData = await interceptCurrentRoutePost(page);
await runButton.click();
await expect.poll(() => submittedPostData.value, { message: "workflow webhook manual run POST payload was captured" }).not.toBeNull();
expect(postDataIncludesField(submittedPostData.value, "action", /^execute$/u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "input", /webhookUrl/u)).toBe(true);
expect(postDataIncludesField(submittedPostData.value, "csrf", /.+/u)).toBe(true);
const input = new URLSearchParams(submittedPostData.value ?? "").get("input");
expect(input).not.toBeNull();
const parsed = JSON.parse(input ?? "{}") as { webhookUrl?: unknown; message?: unknown };
expect(typeof parsed.webhookUrl).toBe("string");
expect(typeof parsed.message).toBe("string");
}
if (workflowWebhookBuilderPath) {
expect(workflowWebhookRunManualPath).toContain(workflowWebhookBuilderPath);
}
});
});
test.describe("workflow builder and manual run compact mobile", () => {
test.use({ viewport: compactMobileViewport, isMobile: true, hasTouch: true });
test("keeps builder and manual run reachable at 320px", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_BUILDER_PATH", "E2E_WORKFLOW_RUN_MANUAL_PATH"],
"Workflow compact mobile inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const builderResponse = await page.goto(workflowBuilderPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, builderResponse, workflowBuilderPath!);
const canvas = page.locator('[data-ui-id="ui.workflows.builder.canvas"]').first();
await expect(canvas).toBeVisible({ timeout: 10_000 });
const runTrigger = page.locator('[data-ui-id="ui.workflows.run.dropdown.trigger"]').first();
if ((await runTrigger.count()) > 0 && (await runTrigger.isVisible())) {
const triggerButton = runTrigger.locator("xpath=ancestor::button[1]");
if (await triggerButton.isEnabled()) {
await runTrigger.click();
const manualRunOption = page.locator('[data-ui-id="ui.workflows.run.dropdown.manual"]').first();
await expect(manualRunOption).toBeVisible();
if (workflowRunManualPath) {
await Promise.all([page.waitForLoadState("domcontentloaded"), manualRunOption.click()]);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowRunManualPath)}(?:[?#].*)?$`, "u"));
await page.goto(workflowBuilderPath!, { waitUntil: "domcontentloaded" });
await expect(canvas).toBeVisible({ timeout: 10_000 });
}
}
}
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const runResponse = await page.goto(workflowRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunManualPath!);
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.title"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.form"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.inputEditor"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("keeps the manual run input editor keyboard-editable at 320px without submitting", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_WORKFLOW_RUN_MANUAL_PATH"],
"Workflow compact mobile input editor inputs not configured"
);
await loginAsTenantUser(page, credentials!);
const runResponse = await page.goto(workflowRunManualPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, runResponse, workflowRunManualPath!);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowRunManualPath!)}(?:[?#].*)?$`, "u"));
const inputEditor = page.locator('[data-ui-id="ui.workflows.run.manual.inputEditor"]').first();
const runButton = page.locator('[data-ui-id="ui.workflows.run.manual.submit"], button.ui-workflows-run-manual-submit').first();
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.form"]').first()).toBeVisible();
await expect(inputEditor).toBeVisible();
await expect(runButton).toBeVisible();
const mutatingRequests: string[] = [];
await page.route("**/*", async (route) => {
const request = route.request();
const method = request.method();
// Telemetry (Sentry/OTLP) POSTs are not user-initiated mutations — exclude
// them like the sibling no-mutation contracts above, or a background error
// report flakes this assertion.
const isTelemetry = /sentry|otel|otlp/iu.test(request.url());
if (!isTelemetry && (method === "POST" || method === "PATCH" || method === "DELETE")) {
mutatingRequests.push(`${method} ${request.url()}`);
await route.abort();
return;
}
await route.continue();
});
const payload = {
mobileEditorProbe: "keyboard-only",
nested: {
submitted: false,
},
};
// The input editor is Monaco, which mounts asynchronously. At 320px a click
// fired before its edit context is focus-ready leaves keystrokes unrouted, so
// wait for the editor surface and focus its edit context before typing.
await expect(inputEditor.locator(".monaco-editor")).toBeVisible();
const editContext = inputEditor.locator(".native-edit-context, textarea.ime-text-area, .monaco-editor").first();
await editContext.click();
await expect(inputEditor.locator(".monaco-editor.focused")).toBeVisible();
await page.keyboard.press("ControlOrMeta+A");
await page.keyboard.press("Backspace");
await page.keyboard.insertText(JSON.stringify(payload, null, 2));
// Monaco virtualises rendering, so a probe typed onto an off-screen line is
// not in the DOM — assert against the editor model value instead of the
// visible text to confirm the keystrokes landed.
await expect
.poll(() => page.evaluate(() => (window as { monaco?: { editor?: { getModels?: () => Array<{ getValue?: () => string }> } } }).monaco?.editor?.getModels?.()?.[0]?.getValue?.() ?? ""))
.toContain("mobileEditorProbe");
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.executionResult"]')).toHaveCount(0);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(workflowRunManualPath!)}(?:[?#].*)?$`, "u"));
expect(mutatingRequests, `Unexpected mutating requests: ${mutatingRequests.join(", ")}`).toEqual([]);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
});