From a93fe4d78b942c4d2e4e0dc9daa32c461da93af3 Mon Sep 17 00:00:00 2001 From: HarelM Date: Thu, 9 Jul 2026 12:35:29 +0300 Subject: [PATCH] Fix test for regexp --- e2e/maputnik-driver.ts | 7 +------ e2e/modals.spec.ts | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/e2e/maputnik-driver.ts b/e2e/maputnik-driver.ts index 0e5f5dc1..4359c53b 100644 --- a/e2e/maputnik-driver.ts +++ b/e2e/maputnik-driver.ts @@ -235,13 +235,8 @@ export class MaputnikDriver { // Fixtures are read directly from disk in Playwright, no registration needed. }, - intercept: async (url: string, alias: string, _method = "GET") => { + intercept: async (pattern: RegExp, alias: string, _method = "GET") => { this.recordedRequests.set(alias, []); - // Convert the Cypress-style glob (which may contain "?" in a query string) - // into a regex so query parameters match reliably. - const pattern = new RegExp( - "^" + url.replace(/[.+^${}()|[\]\\?]/g, "\\$&").replace(/\*/g, ".*") + "$" - ); await this.page.route(pattern, (route) => { this.recordedRequests.get(alias)!.push(route.request()); route.continue(); diff --git a/e2e/modals.spec.ts b/e2e/modals.spec.ts index f03ef678..300f06c1 100644 --- a/e2e/modals.spec.ts +++ b/e2e/modals.spec.ts @@ -284,7 +284,7 @@ test.describe("modals", () => { await then(get.inputValue("modal:settings.maputnik:renderer")).shouldEqual("ol"); await given.intercept( - "https://api\\.maptiler\\.com/tiles/v3-openmaptiles/tiles\\.json\\?key=*", + /https:\/\/api\.maptiler\.com\/tiles\/v3-openmaptiles\/tiles\.json\?key=.*/, "tileRequest", "GET" );