Skip to content

Commit

Permalink
test: failing test for firefox per-context proxy credentials (#4790)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Dec 21, 2020
1 parent 779c5ff commit 3eef254
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion test/browsercontext-proxy.spec.ts
Expand Up @@ -125,7 +125,9 @@ it('should authenticate', async ({contextFactory, contextOptions, server}) => {
await browser.close();
});

it('should authenticate with empty password', async ({contextFactory, contextOptions, server}) => {
it('should authenticate with empty password', (test, { browserName }) => {
test.flaky(browserName === 'firefox', 'Fails when runs afer previous test, see https://github.com/microsoft/playwright/issues/4789');
}, async ({contextFactory, contextOptions, server}) => {
server.setRoute('/target.html', async (req, res) => {
const auth = req.headers['proxy-authorization'];
if (!auth) {
Expand All @@ -147,6 +149,43 @@ it('should authenticate with empty password', async ({contextFactory, contextOpt
await browser.close();
});


it('should isolate proxy credentials between contexts', (test, { browserName }) => {
test.fixme(browserName === 'firefox', 'Credentials from the first context stick around');
}, async ({contextFactory, contextOptions, server}) => {
server.setRoute('/target.html', async (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();
} else {
res.end(`<html><title>${auth}</title></html>`);
}
});
{
const context = await contextFactory({
...contextOptions,
proxy: { server: `localhost:${server.PORT}`, username: 'user1', password: 'secret1' }
});
const page = await context.newPage();
await page.goto('http://non-existent.com/target.html');
expect(await page.title()).toBe('Basic ' + Buffer.from('user1:secret1').toString('base64'));
await context.close();
}
{
const context = await contextFactory({
...contextOptions,
proxy: { server: `localhost:${server.PORT}`, username: 'user2', password: 'secret2' }
});
const page = await context.newPage();
await page.goto('http://non-existent.com/target.html');
expect(await page.title()).toBe('Basic ' + Buffer.from('user2:secret2').toString('base64'));
await context.close();
}
});

it('should exclude patterns', (test, { browserName, headful }) => {
test.fixme(browserName === 'chromium' && headful, 'Chromium headful crashes with CHECK(!in_frame_tree_) in RenderFrameImpl::OnDeleteFrame.');
}, async ({contextFactory, contextOptions, server}) => {
Expand Down

0 comments on commit 3eef254

Please sign in to comment.