Skip to content

Commit

Permalink
Force new page in Webkit integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish committed Oct 14, 2024
1 parent 87bf880 commit c2bb8af
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions integration/vite-route-config-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ test.describe("route config", () => {
test("supports correcting a missing route config", async ({
page,
viteDev,
browserName,
context,
}) => {
let files: Files = async ({ port }) => ({
"vite.config.js": await viteConfig.basic({ port }),
Expand Down Expand Up @@ -245,8 +247,15 @@ test.describe("route config", () => {
);

await expect(async () => {
// Reload to pick up classic FS routes
await page.reload();
// Force new page instance for webkit.
// Otherwise browser doesn't seem to fetch new manifest probably due to caching.
if (browserName === "webkit") {
page = await context.newPage();
}
// Reload to pick up new route for current path
await page.goto(`http://localhost:${port}/`, {
waitUntil: "networkidle",
});
await expect(page.locator("[data-test-route]")).toHaveText("FS route");
}).toPass();

Expand All @@ -270,8 +279,15 @@ test.describe("route config", () => {
);

await expect(async () => {
// Force new page instance for webkit.
// Otherwise browser doesn't seem to fetch new manifest probably due to caching.
if (browserName === "webkit") {
page = await context.newPage();
}
// Reload to pick up new route for current path
await page.reload();
await page.goto(`http://localhost:${port}/`, {
waitUntil: "networkidle",
});
await expect(page.locator("[data-test-route]")).toHaveText(
"Test route 2"
);
Expand Down

0 comments on commit c2bb8af

Please sign in to comment.