Skip to content

Commit 9159d5b

Browse files
CreatmanCEOclaude
andcommitted
test(e2e): add interference + depression-cone specs, update map spec for rename
- map.spec.ts: 'Depression Cones' → 'Depression Cone' (label after layer key rename), and add an explicit Interference toggle visibility check. - interference.spec.ts (new): toggle the layer, capture pageerror + console errors during fetch+render, and verify the checkbox is reversible. Treats network 'Failed to load resource' as non-fatal so a slow backend doesn't fail the spec. - depression-cone.spec.ts (new): toggle the layer, assert the TimeSlider buttons (1/7/30/90d), the Cones mode toggle (Selected/All active), and the DrawdownLegend appear; verify changing the time preset updates the legend label; verify overlays disappear when the layer is turned off. All checks are DOM-based (role/text queries). Per orchestrator halt rule, no canvas inspection or map.getStyle() introspection — Playwright can't see MapLibre WebGL paint, only DOM, and the map ref isn't currently exposed to window for evaluate-based queries either. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent db15cb4 commit 9159d5b

3 files changed

Lines changed: 90 additions & 2 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { test, expect } from "@playwright/test";
2+
3+
test.describe("Depression cone layer", () => {
4+
test.beforeEach(async ({ page }) => {
5+
await page.goto("/");
6+
await page.waitForSelector(".maplibregl-canvas", { timeout: 15000 });
7+
await page.waitForTimeout(3000);
8+
});
9+
10+
test("toggle reveals time slider, mode toggle, and legend", async ({ page }) => {
11+
const errors: string[] = [];
12+
page.on("pageerror", (e) => errors.push(e.message));
13+
14+
const checkbox = page.getByRole("checkbox", { name: /depression cone/i });
15+
await checkbox.check();
16+
await expect(checkbox).toBeChecked();
17+
18+
// TimeSlider buttons (1d/7d/30d/90d)
19+
await expect(page.getByRole("button", { name: "1d" })).toBeVisible();
20+
await expect(page.getByRole("button", { name: "7d" })).toBeVisible();
21+
await expect(page.getByRole("button", { name: "30d" })).toBeVisible();
22+
await expect(page.getByRole("button", { name: "90d" })).toBeVisible();
23+
24+
// Mode toggle
25+
await expect(page.getByRole("button", { name: "Selected" })).toBeVisible();
26+
await expect(page.getByRole("button", { name: "All active" })).toBeVisible();
27+
28+
// Legend (heading text contains the current t_days; default 30)
29+
await expect(page.getByText(/Drawdown after \d+d/i)).toBeVisible();
30+
31+
expect(errors).toEqual([]);
32+
});
33+
34+
test("changing time preset updates the legend label", async ({ page }) => {
35+
const checkbox = page.getByRole("checkbox", { name: /depression cone/i });
36+
await checkbox.check();
37+
await expect(page.getByText(/Drawdown after 30d/i)).toBeVisible();
38+
39+
await page.getByRole("button", { name: "90d" }).click();
40+
await expect(page.getByText(/Drawdown after 90d/i)).toBeVisible();
41+
});
42+
43+
test("overlays disappear when layer is toggled off", async ({ page }) => {
44+
const checkbox = page.getByRole("checkbox", { name: /depression cone/i });
45+
await checkbox.check();
46+
await expect(page.getByRole("button", { name: "30d" })).toBeVisible();
47+
48+
await checkbox.uncheck();
49+
await expect(page.getByRole("button", { name: "30d" })).toBeHidden();
50+
});
51+
});

frontend/e2e/interference.spec.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { test, expect } from "@playwright/test";
2+
3+
test.describe("Interference layer", () => {
4+
test.beforeEach(async ({ page }) => {
5+
await page.goto("/");
6+
await page.waitForSelector(".maplibregl-canvas", { timeout: 15000 });
7+
await page.waitForTimeout(3000);
8+
});
9+
10+
test("interference toggle activates without console errors", async ({ page }) => {
11+
const errors: string[] = [];
12+
page.on("pageerror", (e) => errors.push(e.message));
13+
page.on("console", (msg) => {
14+
if (msg.type() === "error") errors.push(msg.text());
15+
});
16+
17+
const checkbox = page.getByRole("checkbox", { name: /interference/i });
18+
await checkbox.check();
19+
await expect(checkbox).toBeChecked();
20+
21+
// Allow fetch + render to settle
22+
await page.waitForTimeout(2500);
23+
24+
// No top-level page or console errors during the toggle.
25+
const fatal = errors.filter((e) => !/Failed to load resource/i.test(e));
26+
expect(fatal).toEqual([]);
27+
});
28+
29+
test("interference toggle is reversible", async ({ page }) => {
30+
const checkbox = page.getByRole("checkbox", { name: /interference/i });
31+
await checkbox.check();
32+
await expect(checkbox).toBeChecked();
33+
await checkbox.uncheck();
34+
await expect(checkbox).not.toBeChecked();
35+
});
36+
});

frontend/e2e/map.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ test.describe("Map", () => {
2121
test("layer controls panel visible", async ({ page }) => {
2222
await expect(page.getByText("Layers", { exact: false }).first()).toBeVisible();
2323
await expect(page.getByText("Wells").first()).toBeVisible();
24-
await expect(page.getByText("Depression Cones").first()).toBeVisible();
24+
await expect(page.getByText("Depression Cone").first()).toBeVisible();
25+
await expect(page.getByText("Interference").first()).toBeVisible();
2526
});
2627

2728
test("wells checkbox is checked by default", async ({ page }) => {
2829
const wellsCheckbox = page.locator("input[type=checkbox]").first();
2930
await expect(wellsCheckbox).toBeChecked();
3031
});
3132

32-
test("depression cones toggle works", async ({ page }) => {
33+
test("depression cone toggle works", async ({ page }) => {
3334
const conesCheckbox = page.locator("input[type=checkbox]").nth(1);
3435
await conesCheckbox.check();
3536
await expect(conesCheckbox).toBeChecked();

0 commit comments

Comments
 (0)