diff --git a/tests/proxy.spec.ts b/tests/proxy.spec.ts index ccb8690005..cae931521b 100644 --- a/tests/proxy.spec.ts +++ b/tests/proxy.spec.ts @@ -94,6 +94,39 @@ it('should authenticate', async ({ browserType, server }) => { await browser.close(); }); +it('should work with authenticate followed by redirect', async ({ browserName, browserType, server }) => { + it.fixme(browserName === 'firefox', 'https://github.com/microsoft/playwright/issues/10095'); + function hasAuth(req, res) { + const auth = req.headers['proxy-authorization']; + if (!auth) { + res.writeHead(407, 'Proxy Authentication Required', { + 'Proxy-Authenticate': 'Basic realm="Access to internal site"' + }); + res.end(); + return false; + } + return true; + } + server.setRoute('/page1.html', async (req, res) => { + if (!hasAuth(req, res)) + return; + res.writeHead(302, { location: '/page2.html' }); + res.end(); + }); + server.setRoute('/page2.html', async (req, res) => { + if (!hasAuth(req, res)) + return; + res.end('