mirror of
https://github.com/maputnik/editor.git
synced 2026-08-26 06:57:26 +00:00
test: instantiate MaputnikDriver once per describe block
Make the driver page-lazy (it resolves the running test's page on demand via
an auto fixture) so it can be created a single time at describe scope and
reused across the block's tests, matching the pre-migration ergonomics:
const { given, get, when, then } = new MaputnikDriver();
instead of pulling `driver` out of a fixture and destructuring it in every
test. Coverage collection and dialog handling move into the auto fixture.
Also inject a bare invalid token ("zzz") in the json-editor parse-error test:
CodeMirror auto-closes brackets/quotes, so " {" no longer reliably breaks the
JSON.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+13
-10
@@ -1,15 +1,20 @@
|
||||
import { test, setupMaputnik } from "./fixtures";
|
||||
import { test } from "./fixtures";
|
||||
import { MaputnikDriver } from "./maputnik-driver";
|
||||
|
||||
test.describe("accessibility", () => {
|
||||
setupMaputnik();
|
||||
const { given, get, when, then } = new MaputnikDriver();
|
||||
|
||||
test.beforeEach(async () => {
|
||||
await given.setupMockBackedResponses();
|
||||
await when.setStyle("both");
|
||||
});
|
||||
|
||||
test.describe("skip links", () => {
|
||||
test.beforeEach(async ({ driver }) => {
|
||||
await driver.when.setStyle("layer");
|
||||
test.beforeEach(async () => {
|
||||
await when.setStyle("layer");
|
||||
});
|
||||
|
||||
test("skip link to layer list", async ({ driver }) => {
|
||||
const { get, when, then } = driver;
|
||||
test("skip link to layer list", async () => {
|
||||
const selector = "root:skip:layer-list";
|
||||
await then(get.elementByTestId(selector)).shouldExist();
|
||||
await when.tab();
|
||||
@@ -18,8 +23,7 @@ test.describe("accessibility", () => {
|
||||
await then(get.skipTargetLayerList()).shouldBeFocused();
|
||||
});
|
||||
|
||||
test("skip link to layer editor", async ({ driver }) => {
|
||||
const { get, when, then } = driver;
|
||||
test("skip link to layer editor", async () => {
|
||||
const selector = "root:skip:layer-editor";
|
||||
await then(get.elementByTestId(selector)).shouldExist();
|
||||
await then(get.elementByTestId("skip-target-layer-editor")).shouldExist();
|
||||
@@ -30,8 +34,7 @@ test.describe("accessibility", () => {
|
||||
await then(get.skipTargetLayerEditor()).shouldBeFocused();
|
||||
});
|
||||
|
||||
test("skip link to map view", async ({ driver }) => {
|
||||
const { get, when, then } = driver;
|
||||
test("skip link to map view", async () => {
|
||||
const selector = "root:skip:map-view";
|
||||
await then(get.elementByTestId(selector)).shouldExist();
|
||||
await when.tab();
|
||||
|
||||
Reference in New Issue
Block a user