Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cool-keys-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/testing': patch
---

Fix Playwright route URL to use RegExp instead of Glob URL pattern
4 changes: 3 additions & 1 deletion packages/testing/src/playwright/setupClerkTestingToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export const setupClerkTestingToken = async ({ context, options, page }: SetupCl
if (!fapiUrl) {
throw new Error(ERROR_MISSING_FRONTEND_API_URL);
}
const apiUrl = `https://${fapiUrl}/v1/**/*`;

const escapedFapiUrl = fapiUrl.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const apiUrl = new RegExp(`^https://${escapedFapiUrl}/v1/.*?(\\?.*)?$`);

await browserContext.route(apiUrl, async route => {
const originalUrl = new URL(route.request().url());
Expand Down
Loading