Fix test for regexp

This commit is contained in:
HarelM
2026-07-09 12:35:29 +03:00
parent 603a30cba8
commit a93fe4d78b
2 changed files with 2 additions and 7 deletions
+1 -6
View File
@@ -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();