opengeos--geolibre
7df9ebf22c
Sync labels / sync (push) Failing after 1m9s
Publish Container Image / Build and publish container image (push) Has been cancelled
Deploy Website / Deploy to GitHub Pages (push) Has been cancelled
Deploy Website / Build website and demo (push) Has been cancelled
Deploy viewer / Deploy viewer proxy to Cloudflare Workers (push) Has been cancelled
Deploy tiles / Deploy planetary tile proxy to Cloudflare Workers (push) Has been cancelled
Deploy collab / Deploy collaboration relay to Cloudflare Workers (push) Has been cancelled
CI / Dependency audit (push) Has been cancelled
CI / E2E smoke (Playwright) (push) Has been cancelled
CI / Validate CITATION.cff (push) Has been cancelled
CI / Build and test (push) Has been cancelled
38 行
1.6 KiB
TypeScript
38 行
1.6 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { dropGeoJson, layerRow, readFixture, waitForMap } from "./helpers";
|
|
|
|
const FIXTURE_TEXT = readFixture("smoke.geojson");
|
|
const FIXTURE_FEATURE_COUNT = (
|
|
JSON.parse(FIXTURE_TEXT) as { features: unknown[] }
|
|
).features.length;
|
|
|
|
/**
|
|
* Dark theme is the app's most theme-sensitive surface and ships changes
|
|
* constantly, yet the rest of the E2E suite runs light-only. The documented
|
|
* `?theme=dark` embed parameter sets the initial theme with no click-through
|
|
* (see useThemeMode), so this drives the core flow — map, layer panel, and
|
|
* attribute table — entirely in dark mode as a regression guard against dark
|
|
* theme breaking the app shell or the data path.
|
|
*/
|
|
test("loads a layer and opens the attribute table in dark theme", async ({
|
|
page,
|
|
}) => {
|
|
await waitForMap(page, "/?theme=dark");
|
|
|
|
// The theme applies as `class="dark"` on <html> with a matching color-scheme.
|
|
await expect(page.locator("html")).toHaveClass(/(^|\s)dark(\s|$)/);
|
|
await expect(page.locator("html")).toHaveAttribute("style", /dark/);
|
|
|
|
// Core data path must work unchanged under the dark theme.
|
|
await dropGeoJson(page, "smoke", FIXTURE_TEXT);
|
|
const row = layerRow(page, "smoke");
|
|
await expect(row).toBeVisible();
|
|
|
|
await row.locator('button[aria-label="Layer actions"]').click();
|
|
await page.getByRole("menuitem", { name: "Open attribute table" }).click();
|
|
await expect(page.getByTestId("attribute-table")).toBeVisible();
|
|
await expect(
|
|
page.locator('[data-testid="attribute-table"] tbody tr'),
|
|
).toHaveCount(FIXTURE_FEATURE_COUNT);
|
|
});
|