Files
VolcanicCore/frontend/e2e/smoke.spec.ts

47 lines
2.1 KiB
TypeScript

import { test, expect } from "@playwright/test";
test("login → create workflow → drop node → edit in dialog → save → reload persists label", async ({ page }) => {
await page.goto("/login");
await page.getByLabel(/password/i).fill("hunter2");
await page.getByRole("button", { name: /sign in/i }).click();
await expect(page).toHaveURL(/\/workflows$/);
await page.getByRole("button", { name: /new workflow/i }).click();
await page.getByPlaceholder(/name/i).fill("Smoke Test");
await page.getByRole("button", { name: /^create$/i }).click();
await expect(page.getByText("Smoke Test")).toBeVisible();
await page.getByText("Smoke Test").click();
// On editor. Drag the Webhook tile onto the canvas.
const tile = page.locator("aside").filter({ hasText: /Nodes/i }).getByText("Webhook");
const canvas = page.locator(".react-flow__pane");
await tile.dragTo(canvas);
await expect(page.locator(".react-flow__node")).toHaveCount(1);
// Double-click the just-dropped node to open the editor dialog.
const nodeEl = page.locator(".react-flow__node").first();
await nodeEl.dblclick();
// Dialog appears with the three column headings.
await expect(page.getByRole("heading", { name: /^input$/i })).toBeVisible();
await expect(page.getByRole("heading", { name: /^parameters$/i })).toBeVisible();
await expect(page.getByRole("heading", { name: /^output$/i })).toBeVisible();
// Edit the label to something distinctive.
const label = page.getByLabel(/node label/i);
await label.fill("Custom smoke node");
// Close the dialog with the Done button.
await page.getByRole("button", { name: /^done$/i }).click();
await expect(page.getByRole("heading", { name: /^parameters$/i })).not.toBeVisible();
await page.getByRole("button", { name: /save/i }).click();
// No visible confirmation — reload and assert the node persisted.
await page.reload();
await expect(page.locator(".react-flow__node")).toHaveCount(1);
// The canvas should show the custom label on the node.
await expect(page.locator(".react-flow__node")).toContainText("Custom smoke node");
});