Skip to content

Commit 09a99da

Browse files
committed
fix test
1 parent 87cb1a3 commit 09a99da

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/tests-e2e/tests/appRouter/middleware.rewrite.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@ test("Middleware Rewrite External Image", async ({ page }) => {
3434
});
3535

3636
test("Middleware Rewrite Status Code", async ({ page }) => {
37-
page.on("response", async (response) => {
37+
page.on("response", async (response) => {
38+
// Need to set up the event before navigating to the page to avoid missing it
39+
// We need to check the URL here also cause there will be multiple responses (i.e the fonts, css, js, etc)
40+
if (response.url() === "/rewrite-status-code") {
3841
expect(response.status()).toBe(403);
39-
});
42+
}
43+
});
4044
await page.goto("/rewrite-status-code");
4145
const el = page.getByText("Rewritten Destination", { exact: true });
4246
await expect(el).toBeVisible();

0 commit comments

Comments
 (0)