feat(auth): fix firefox auth flake (#1525)

This commit is contained in:
Pavel Feldman 2020-03-24 23:12:07 -07:00 committed by GitHub
parent 8af21d146c
commit 5bde0b59b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 6 deletions

View file

@ -9,7 +9,7 @@
"main": "index.js",
"playwright": {
"chromium_revision": "751710",
"firefox_revision": "1051",
"firefox_revision": "1054",
"webkit_revision": "1182"
},
"scripts": {

View file

@ -421,8 +421,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
expect(response.status()).toBe(200);
await context.close();
});
// flaky: https://github.com/microsoft/playwright/pull/1301/checks?check_run_id=496478707
it.fail(FFOX && LINUX)('should fail if wrong credentials', async({browser, server}) => {
it('should fail if wrong credentials', async({browser, server}) => {
server.setAuth('/empty.html', 'user', 'pass');
const context = await browser.newContext({
httpCredentials: { username: 'foo', password: 'bar' }
@ -438,8 +437,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
expect(response.status()).toBe(200);
await context.close();
});
// flaky: https://github.com/microsoft/playwright/pull/1320/checks?check_run_id=498666394
it.fail(FFOX && LINUX)('should allow disable authentication', async({browser, server}) => {
it('should allow disable authentication', async({browser, server}) => {
server.setAuth('/empty.html', 'user', 'pass');
const context = await browser.newContext({
httpCredentials: { username: 'user', password: 'pass' }
@ -453,6 +451,18 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
expect(response.status()).toBe(401);
await context.close();
});
it('should return resource body', async({browser, server}) => {
server.setAuth('/playground.html', 'user', 'pass');
const context = await browser.newContext({
httpCredentials: { username: 'user', password: 'pass' }
});
const page = await context.newPage();
let response = await page.goto(server.PREFIX + '/playground.html');
expect(response.status()).toBe(200);
expect(await page.title()).toBe("Playground");
expect((await response.body()).toString()).toContain("Playground");
await context.close();
});
});
describe('BrowserContext.setOffline', function() {

View file

@ -103,7 +103,8 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
it('should work with redirects', async({page, server}) => {
server.setRedirect('/redirect/1.html', '/redirect/2.html');
server.setRedirect('/redirect/2.html', '/empty.html');
await page.goto(server.PREFIX + '/redirect/1.html');
const response = await page.goto(server.PREFIX + '/redirect/1.html');
expect(response.status()).toBe(200);
expect(page.url()).toBe(server.EMPTY_PAGE);
});
it('should navigate to about:blank', async({page, server}) => {