// R-P12b flow editor smoke (DoD 19): login -> /automations -> open the flow // editor -> the fullscreen canvas renders, the picker drawer opens from the // bottom toolbar, and the dry-run dialog opens without side effects. import { expect, test } from "./utils/test"; import { getTenantCredentials, loginAsTenantUser } from "./utils/auth"; import { skipIfUnavailable } from "./utils/navigation"; import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness"; const credentials = getTenantCredentials(); const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard"; const automationsPath = process.env.E2E_TENANT_AUTOMATIONS_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/automations"); test.describe("automation flow editor (R-P12b)", () => { test("opens the editor, the picker drawer, and the dry-run dialog", async ({ page }) => { skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping authenticated automations smoke"); await loginAsTenantUser(page, credentials!); const listResponse = await page.goto(automationsPath, { waitUntil: "domcontentloaded" }); await skipIfUnavailable(page, listResponse, automationsPath); // The list links every rule to its editor route; without a seeded rule the // smoke cannot exercise the editor and is skipped rather than red. const editLink = page.locator(`a[href*="/automations/"][href$="/edit"]`).first(); if ((await editLink.count()) === 0) { test.skip(true, "No automation rule available to open the flow editor"); } await editLink.click(); await page.waitForURL(/\/automations\/[^/]+\/edit/u); await expect(page.locator('[data-ui-id="ui.automation.editor"]')).toBeVisible(); await expect(page.locator('[data-ui-id="ui.automation.editor.canvas"]')).toBeVisible(); await expect(page.locator(".react-flow__node").first()).toBeVisible({ timeout: 10_000 }); // Main action: the picker drawer opens and offers catalog nodes. await page.locator('[data-ui-id="ui.automation.editor.openPicker"]').click(); await expect(page.locator('[data-ui-id="ui.automation.editor.picker"]')).toBeVisible(); await expect(page.locator('[data-ui-id^="ui.automation.editor.picker.category."]').first()).toBeVisible(); await page.keyboard.press("Escape"); // Dry run stays a preview: the dialog opens, nothing is submitted yet. await page.locator('[data-ui-id="ui.automation.editor.dryRunTrigger"]').click(); await expect(page.locator('[data-ui-id="ui.automation.editor.dryRun"]')).toBeVisible(); await page.keyboard.press("Escape"); // No horizontal page overflow on the fullscreen editor. const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth); expect(overflow).toBeLessThanOrEqual(1); }); });