mirror of
https://github.com/maputnik/editor.git
synced 2026-07-12 00:47:35 +00:00
2e0b7cdb8c
## Launch Checklist This PR replaces cypress with playwright. <img width="1907" height="933" alt="image" src="https://github.com/user-attachments/assets/b52075b3-eb3b-45dc-93dc-8c5e9cfd35dd" /> I hope this will make the end-to-end debugging and fixing easier due to the async await support of playwright which is missing in cypress. This is a pure refactoring change. - [x] Briefly describe the changes in this PR. - [x] Add an entry to `CHANGELOG.md` under the `## main` section. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
67 lines
2.1 KiB
TypeScript
67 lines
2.1 KiB
TypeScript
import { beforeEach, describe, test } from "./utils/fixtures";
|
|
import { MaputnikDriver } from "./maputnik-driver";
|
|
|
|
describe("keyboard", () => {
|
|
const { given, get, when, then } = new MaputnikDriver();
|
|
|
|
beforeEach(async () => {
|
|
await given.setupMockBackedResponses();
|
|
await when.setStyle("both");
|
|
});
|
|
|
|
describe("shortcuts", () => {
|
|
beforeEach(async () => {
|
|
await given.setupMockBackedResponses();
|
|
await when.setStyle("");
|
|
});
|
|
|
|
test("ESC should unfocus", async () => {
|
|
const targetSelector = "maputnik-select";
|
|
await when.focus(targetSelector);
|
|
await then(get.elementByTestId(targetSelector)).shouldBeFocused();
|
|
await when.typeKeys("{esc}");
|
|
await then(get.elementByTestId(targetSelector)).shouldNotBeFocused();
|
|
});
|
|
|
|
test("'?' should show shortcuts modal", async () => {
|
|
await when.typeKeys("?");
|
|
await then(get.elementByTestId("modal:shortcuts")).shouldBeVisible();
|
|
});
|
|
|
|
test("'o' should show open modal", async () => {
|
|
await when.typeKeys("o");
|
|
await then(get.elementByTestId("modal:open")).shouldBeVisible();
|
|
});
|
|
|
|
test("'e' should show export modal", async () => {
|
|
await when.typeKeys("e");
|
|
await then(get.elementByTestId("modal:export")).shouldBeVisible();
|
|
});
|
|
|
|
test("'d' should show sources modal", async () => {
|
|
await when.typeKeys("d");
|
|
await then(get.elementByTestId("modal:sources")).shouldBeVisible();
|
|
});
|
|
|
|
test("'s' should show settings modal", async () => {
|
|
await when.typeKeys("s");
|
|
await then(get.elementByTestId("modal:settings")).shouldBeVisible();
|
|
});
|
|
|
|
test("'i' should change map to inspect mode", async () => {
|
|
await when.typeKeys("i");
|
|
await then(get.inputValue("maputnik-select")).shouldEqual("inspect");
|
|
});
|
|
|
|
test("'m' should focus map", async () => {
|
|
await when.typeKeys("m");
|
|
await then(get.canvas()).shouldBeFocused();
|
|
});
|
|
|
|
test("'!' should show debug modal", async () => {
|
|
await when.typeKeys("!");
|
|
await then(get.elementByTestId("modal:debug")).shouldBeVisible();
|
|
});
|
|
});
|
|
});
|