From 8536fa885e5a8799e0f74d2a7cc8c8b977d298c0 Mon Sep 17 00:00:00 2001 From: Joel Einbinder Date: Sun, 12 Apr 2020 18:45:55 -0700 Subject: [PATCH] test(interception): add redirect test, failing in webkit and firefox (#1753) --- test/interception.spec.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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() {