Skip to content

Commit

Permalink
Mock redirects only when testing redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
ledsun committed Nov 27, 2023
1 parent e737f87 commit 3de3b98
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
route.fulfill({
path: path.join("./test-e2e/integrations", relativePath),
});
} else if (relativePath.match("redirect_to_error_on_load_twice.rb")) {
route.fulfill({
status: 302,
headers: {
location: "error_on_load_twice.rb",
},
});
} else if (fs.existsSync(mockedPath)) {
route.fulfill({
path: mockedPath,
Expand Down Expand Up @@ -92,13 +85,23 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
// In the integration test, response#url returns the URL before the redirect.
// I do not know the cause. Under investigation.
test.skip("JS::RequireRemote#load identifies by URL after redirect", async ({
page,
page, context
}) => {
// Stop tests immediately when an error occurs in the page.
page.on("pageerror", (error) => {
throw error;
});

// Use the proxy to redirect the request.
context.route(/redirect/, (route) => {
route.fulfill({
status: 302,
headers: {
location: "error_on_load_twice.rb",
},
});
});

const resolve = await resolveBinding(page, "checkResolved");
await page.goto(
"https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/",
Expand Down

0 comments on commit 3de3b98

Please sign in to comment.