61 lines
2.8 KiB
TypeScript
61 lines
2.8 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");
|
|
|
|
// Pin some data on the node. The dropped tile is "Webhook" (Trigger) →
|
|
// the dialog exposes "Pinned output".
|
|
await page.locator(".react-flow__node").first().dblclick();
|
|
const pinField = page.getByLabel("Pinned output");
|
|
await pinField.fill(`{"pinned":true}`);
|
|
await page.getByRole("button", { name: /^done$/i }).click();
|
|
await page.getByRole("button", { name: /save/i }).click();
|
|
|
|
// Reload again, open the dialog, confirm the pin persisted AND the pin icon shows.
|
|
await page.reload();
|
|
await expect(page.locator('[data-testid="pin-badge"]')).toBeVisible();
|
|
await page.locator(".react-flow__node").first().dblclick();
|
|
await expect(page.getByLabel("Pinned output")).toHaveValue(/pinned/);
|
|
});
|