mirror of
https://github.com/maputnik/editor.git
synced 2026-07-09 07:27:35 +00:00
c3dd253737
Replace Cypress with Playwright for the end-to-end suite and drop
@shellygo/cypress-test-utils in favour of a hand-written MaputnikDriver
page object that keeps the fluent then(...).shouldX() assertion style
(now async). The InputAutocomplete component test moves to Vitest browser
mode using the Playwright provider.
- e2e/maputnik-driver.ts: driver + MaputnikAssertable over Playwright
- e2e/{fixtures,coverage,global-setup,global-teardown}.ts: test fixture,
istanbul coverage collection, and nyc report generation
- playwright.config.ts / vitest.config.ts
- Code coverage preserved: dev server is istanbul-instrumented, per-test
window.__coverage__ is merged via nyc into coverage/coverage-final.json
- CI: Cypress jobs replaced with Playwright; docker e2e runs against the
container via E2E_NO_WEBSERVER
- Remove Cypress deps, config and support files; update docs and .nycrc
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
823 B
TypeScript
28 lines
823 B
TypeScript
import { test as base, expect } from "@playwright/test";
|
|
import { MaputnikDriver } from "./maputnik-driver";
|
|
|
|
/**
|
|
* Playwright test with a per-test `driver` (the maputnik page object) that also
|
|
* collects istanbul coverage once the test finishes.
|
|
*/
|
|
export const test = base.extend<{ driver: MaputnikDriver }>({
|
|
driver: async ({ page }, use, testInfo) => {
|
|
const driver = new MaputnikDriver(page);
|
|
await use(driver);
|
|
await driver.flushCoverage(testInfo);
|
|
},
|
|
});
|
|
|
|
export { expect };
|
|
|
|
/**
|
|
* Registers the shared `beforeEach` used by most specs: mock the style responses
|
|
* and load the default (geojson + raster) style.
|
|
*/
|
|
export function setupMaputnik(): void {
|
|
test.beforeEach(async ({ driver }) => {
|
|
await driver.given.setupMockBackedResponses();
|
|
await driver.when.setStyle("both");
|
|
});
|
|
}
|