Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test(interception): add redirect test, failing in webkit and firefox (#1753)

Joel Einbinder8536fa885e5a
diff --git a/test/interception.spec.js b/test/interception.spec.js
index 92fd7898b1..676d7962ba 100644
--- a/test/interception.spec.js
+++ b/test/interception.spec.js
@@ -336,6 +336,26 @@ describe('Page.route', function() {
expect(response.ok()).toBe(true);
expect(intercepted).toBe(true);
});
+ // WebKit crashes. Firefox succeeds, but then fails to close.
+ it.fail(FFOX || WEBKIT)('should create a redirect', async({page, server}) => {
+ await page.goto(server.PREFIX + '/empty.html');
+ await page.route('**/*', async(route, request) => {
+ if (request.url() !== server.PREFIX + '/redirect_this')
+ return route.continue();
+ await route.fulfill({
+ status: 301,
+ headers: {
+ 'location': '/empty.html',
+ }
+ });
+ });
+
+ const text = await page.evaluate(async url => {
+ const data = await fetch(url);
+ return data.text();
+ }, server.PREFIX + '/redirect_this');
+ expect(text).toBe('');
+ });
});
describe('Request.continue', function() {