Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

test(canvas): scope graph controls per app

Rahman745e138bb036
diff --git a/scripts/e2e/organization.mjs b/scripts/e2e/organization.mjs
index 6f604602..fbaf981e 100644
--- a/scripts/e2e/organization.mjs
+++ b/scripts/e2e/organization.mjs
@@ -35,9 +35,10 @@ export async function organizationJourney(page, fixture) {
expect(response.status).toBe(200);
await page.goto(fixture.base + "/organization");
- await expect(page.getByRole("application", { name: "Organization units canvas" })).toBeVisible();
- for (const name of ["Select mode", "Pan mode", "Zoom in", "Zoom out", "Fit view"]) await expect(page.getByRole("button", { name })).toBeVisible();
- const unitMinimap = page.getByLabel("Organization units canvas minimap");
+ const unitCanvas = page.getByRole("application", { name: "Organization units canvas" });
+ await expect(unitCanvas).toBeVisible();
+ for (const name of ["Select mode", "Pan mode", "Zoom in", "Zoom out", "Fit view"]) await expect(unitCanvas.getByRole("button", { name })).toBeVisible();
+ const unitMinimap = unitCanvas.getByLabel("Organization units canvas minimap");
await expect(unitMinimap).toBeVisible();
await expect(unitMinimap.locator(".react-flow__minimap-node")).toHaveCount(2);
await expect(page.getByText("E2E Holding", { exact: true }).first()).toBeVisible();
@@ -55,7 +56,7 @@ export async function organizationJourney(page, fixture) {
if (viewport.width < 700) {
await expect(page.getByLabel("Organization unit", { exact: true })).toBeVisible();
await expect(page.getByRole("navigation", { name: "Organization units" })).toBeHidden();
- const rootNode = page.locator('.react-flow__node').first();
+ const rootNode = unitCanvas.locator('.react-flow__node').first();
const box = await rootNode.boundingBox();
expect(box?.width ?? 0).toBeGreaterThan(140);
} else {
@@ -66,14 +67,15 @@ export async function organizationJourney(page, fixture) {
await page.goto(fixture.base + "/organization");
await page.getByRole("button", { name: /E2E Product/ }).click();
- await expect(page.getByRole("application", { name: "Organization seats canvas" })).toBeVisible();
- await expect(page.locator(".react-flow__node", { hasText: "Chief Executive Officer" })).toBeVisible();
- const seatMinimap = page.getByLabel("Organization seats canvas minimap");
+ const seatCanvas = page.getByRole("application", { name: "Organization seats canvas" });
+ await expect(seatCanvas).toBeVisible();
+ await expect(seatCanvas.locator(".react-flow__node", { hasText: "Chief Executive Officer" })).toBeVisible();
+ const seatMinimap = seatCanvas.getByLabel("Organization seats canvas minimap");
await expect(seatMinimap.locator(".react-flow__minimap-node")).toHaveCount(2);
- const reportingEdge = page.getByRole("img", { name: "Edge from e2e-ceo to e2e-cto" }).locator(".react-flow__edge-path");
+ const reportingEdge = seatCanvas.getByRole("img", { name: "Edge from e2e-ceo to e2e-cto" }).locator(".react-flow__edge-path");
await expect(reportingEdge).toHaveAttribute("marker-end", /url/);
expect(await reportingEdge.evaluate((el) => getComputedStyle(el).strokeDasharray)).not.toBe("none");
- const cto = page.locator(".react-flow__node", { hasText: "Chief Technology Officer" });
+ const cto = seatCanvas.locator(".react-flow__node", { hasText: "Chief Technology Officer" });
await expect(cto).toBeVisible();
await cto.click();
await expect(page.getByRole("button", { name: "Edit seat" })).toBeVisible();
diff --git a/scripts/e2e/workflow-canvas.mjs b/scripts/e2e/workflow-canvas.mjs
index 0f28b9b2..3601aaef 100644
--- a/scripts/e2e/workflow-canvas.mjs
+++ b/scripts/e2e/workflow-canvas.mjs
@@ -40,13 +40,14 @@ export async function workflowCanvasJourney(page, fixture) {
let graph = response.body.graph;
await page.goto(fixture.base + "/workflows");
- await expect(page.getByRole("application", { name: "Workflow canvas" })).toBeVisible();
- for (const name of ["Select mode", "Pan mode", "Zoom in", "Zoom out", "Fit view"]) await expect(page.getByRole("button", { name })).toBeVisible();
- await expect(page.getByRole("button", { name: "Tidy up" })).toBeVisible();
- const minimap = page.getByLabel("Workflow canvas minimap");
+ const canvas = page.getByRole("application", { name: "Workflow canvas" }).last();
+ await expect(canvas).toBeVisible();
+ for (const name of ["Select mode", "Pan mode", "Zoom in", "Zoom out", "Fit view"]) await expect(canvas.getByRole("button", { name })).toBeVisible();
+ await expect(canvas.getByRole("button", { name: "Tidy up" })).toBeVisible();
+ const minimap = canvas.getByLabel("Workflow canvas minimap");
await expect(minimap).toBeVisible();
await expect(minimap.locator(".react-flow__minimap-node")).toHaveCount(8);
- await expect(page.locator(".react-flow__node", { hasText: "Manual Trigger" })).toBeVisible();
+ await expect(canvas.locator(".react-flow__node", { hasText: "Manual Trigger" })).toBeVisible();
// Responsive contract: on a phone-sized pane the wide graph starts focused on
// the trigger at a readable zoom, side panels become drawers, and the toolbar
@@ -58,7 +59,7 @@ export async function workflowCanvasJourney(page, fixture) {
await expect(feature).toBeVisible();
expect(await feature.evaluate((el) => el.scrollWidth <= el.clientWidth + 1)).toBe(true);
await expect(page.getByLabel("Workflow name")).toBeVisible();
- const trigger = page.locator(".react-flow__node", { hasText: "Manual Trigger" });
+ const trigger = canvas.locator(".react-flow__node", { hasText: "Manual Trigger" });
await expect(trigger).toBeVisible();
const box = await trigger.boundingBox();
expect(box?.width ?? 0).toBeGreaterThan(viewport.width < 700 ? 140 : 95);
@@ -77,13 +78,13 @@ export async function workflowCanvasJourney(page, fixture) {
expect(await normalPath.evaluate((el) => getComputedStyle(el).strokeDasharray)).toBe("none");
expect(await branchPath.evaluate((el) => getComputedStyle(el).strokeDasharray)).not.toBe("none");
- await page.getByRole("button", { name: "Pan mode" }).click();
- await expect(page.getByRole("button", { name: "Pan mode" })).toHaveClass(/is-active/);
- await page.getByRole("button", { name: "Select mode" }).click();
- await expect(page.getByRole("button", { name: "Select mode" })).toHaveClass(/is-active/);
- await page.getByRole("button", { name: "Zoom in" }).click();
- await page.getByRole("button", { name: "Zoom out" }).click();
- await page.getByRole("button", { name: "Fit view" }).click();
+ await canvas.getByRole("button", { name: "Pan mode" }).click();
+ await expect(canvas.getByRole("button", { name: "Pan mode" })).toHaveClass(/is-active/);
+ await canvas.getByRole("button", { name: "Select mode" }).click();
+ await expect(canvas.getByRole("button", { name: "Select mode" })).toHaveClass(/is-active/);
+ await canvas.getByRole("button", { name: "Zoom in" }).click();
+ await canvas.getByRole("button", { name: "Zoom out" }).click();
+ await canvas.getByRole("button", { name: "Fit view" }).click();
await page.getByRole("button", { name: "Directory", exact: true }).click();
await expect(page.getByPlaceholder("Search tools…")).toBeVisible();