mirror of
https://github.com/maputnik/editor.git
synced 2026-12-05 16:24:20 +00:00
Remove the animation frame test
1. Remove the paused animation frames test from e2e/map.spec.ts 2. Remove pausedAnimationFrames and resumeAnimationFrames from e2e/playwright-helper.ts 3. Per review: https://github.com/maplibre/maputnik/pull/2217#discussion_r4229909605 4. Playwright's page.clock pauses all timers, so the app never loads and it can't replace the override Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDkBFXcoMv8K4QSHA6P3Fg
This commit is contained in:
2 files changed
-37
No files matched your search
@@ -64,18 +64,4 @@ describe("map", () => {
|
||||
await then(get.elementByTestId("feature-layer-popup")).shouldBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
describe("style loaded while animation frames are paused", () => {
|
||||
beforeEach(async () => {
|
||||
await given.pausedAnimationFrames();
|
||||
await when.setStyle("rectangles", 5);
|
||||
await then(get.elementByTestId("layer-list-item:rectangles")).shouldBeVisible();
|
||||
await when.resumeAnimationFrames();
|
||||
});
|
||||
|
||||
test("should render without moving the map", async () => {
|
||||
await when.clickCenter("maplibre:map");
|
||||
await then(get.elementByTestId("feature-layer-popup")).shouldBeVisible();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -235,26 +235,6 @@ export class PlaywrightHelper {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Holds back requestAnimationFrame callbacks until
|
||||
* when.resumeAnimationFrames(), the way a background tab does. Must be
|
||||
* called before the page under test is loaded.
|
||||
*/
|
||||
pausedAnimationFrames: async () => {
|
||||
await this.page.addInitScript(() => {
|
||||
const requestAnimationFrame = window.requestAnimationFrame.bind(window);
|
||||
const paused: FrameRequestCallback[] = [];
|
||||
window.requestAnimationFrame = (callback) => {
|
||||
paused.push(callback);
|
||||
return 0;
|
||||
};
|
||||
(window as any).resumeAnimationFrames = () => {
|
||||
window.requestAnimationFrame = requestAnimationFrame;
|
||||
paused.forEach((callback) => requestAnimationFrame(callback));
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
intercept: async (pattern: RegExp, alias: string, _method = "GET") => {
|
||||
this.recordedRequests.set(alias, []);
|
||||
await this.page.route(pattern, (route) => {
|
||||
@@ -291,9 +271,6 @@ export class PlaywrightHelper {
|
||||
|
||||
wait: (ms: number) => this.page.waitForTimeout(ms),
|
||||
|
||||
/** Releases the frames held back by given.pausedAnimationFrames(). */
|
||||
resumeAnimationFrames: () => this.page.evaluate(() => (window as any).resumeAnimationFrames()),
|
||||
|
||||
tab: () => this.page.keyboard.press("Tab"),
|
||||
|
||||
typeKeys: (keys: string) => typeSequence(this.page, keys),
|
||||
|
||||
Reference in new issue
Block a user