mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore(firefox): mark all Puppeteer tests that are failing on FF (#3924)
This patch: - introduces new testRunner methods `addTestDSL` and `addSuiteDSL` to add annotated test / suite. - introduces new test/suite declaration methods: `it_fails_ffox` and `describe_fails_ffox`. These are equal to `it`/`describe` for chromium tests and to `xit`/`xdescribe` for firefox. - marks all unsupported tests with `it_fails_ffox` - adds a new command-line flag `'--firefox-status'` to `//test/test.js`. This flag dumps current amount of tests that are intentionally skipped for Firefox. End goal: get rid of all `it_fails_ffox` and `describe_fails_ffox` tests. Drive-By: remove cookie tests "afterEach" hook that was removing cookies - it's not needed any more since every test is run in a designated browser context. References #3889
This commit is contained in:
@@ -16,9 +16,9 @@
|
||||
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
module.exports.addTests = function({testRunner, expect, Errors}) {
|
||||
const {describe, xdescribe, fdescribe} = testRunner;
|
||||
const {it, fit, xit} = testRunner;
|
||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||
const {TimeoutError} = Errors;
|
||||
|
||||
@@ -33,11 +33,11 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
await page.goto(server.PREFIX + '/redirect/1.html');
|
||||
expect(page.url()).toBe(server.EMPTY_PAGE);
|
||||
});
|
||||
it('should navigate to about:blank', async({page, server}) => {
|
||||
it_fails_ffox('should navigate to about:blank', async({page, server}) => {
|
||||
const response = await page.goto('about:blank');
|
||||
expect(response).toBe(null);
|
||||
});
|
||||
it('should return response when page changes its URL after load', async({page, server}) => {
|
||||
it_fails_ffox('should return response when page changes its URL after load', async({page, server}) => {
|
||||
const response = await page.goto(server.PREFIX + '/historyapi.html');
|
||||
expect(response.status()).toBe(200);
|
||||
});
|
||||
@@ -48,7 +48,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
});
|
||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||
});
|
||||
it('should fail when server returns 204', async({page, server}) => {
|
||||
it_fails_ffox('should fail when server returns 204', async({page, server}) => {
|
||||
server.setRoute('/empty.html', (req, res) => {
|
||||
res.statusCode = 204;
|
||||
res.end();
|
||||
@@ -58,12 +58,12 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(error).not.toBe(null);
|
||||
expect(error.message).toContain('net::ERR_ABORTED');
|
||||
});
|
||||
it('should navigate to empty page with domcontentloaded', async({page, server}) => {
|
||||
it_fails_ffox('should navigate to empty page with domcontentloaded', async({page, server}) => {
|
||||
const response = await page.goto(server.EMPTY_PAGE, {waitUntil: 'domcontentloaded'});
|
||||
expect(response.status()).toBe(200);
|
||||
expect(response.securityDetails()).toBe(null);
|
||||
});
|
||||
it('should work when page calls history API in beforeunload', async({page, server}) => {
|
||||
it_fails_ffox('should work when page calls history API in beforeunload', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.evaluate(() => {
|
||||
window.addEventListener('beforeunload', () => history.replaceState(null, 'initial', window.location.href), false);
|
||||
@@ -71,20 +71,20 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
const response = await page.goto(server.PREFIX + '/grid.html');
|
||||
expect(response.status()).toBe(200);
|
||||
});
|
||||
(FFOX ? xit : it)('should navigate to empty page with networkidle0', async({page, server}) => {
|
||||
it_fails_ffox('should navigate to empty page with networkidle0', async({page, server}) => {
|
||||
const response = await page.goto(server.EMPTY_PAGE, {waitUntil: 'networkidle0'});
|
||||
expect(response.status()).toBe(200);
|
||||
});
|
||||
(FFOX ? xit : it)('should navigate to empty page with networkidle2', async({page, server}) => {
|
||||
it_fails_ffox('should navigate to empty page with networkidle2', async({page, server}) => {
|
||||
const response = await page.goto(server.EMPTY_PAGE, {waitUntil: 'networkidle2'});
|
||||
expect(response.status()).toBe(200);
|
||||
});
|
||||
it('should fail when navigating to bad url', async({page, server}) => {
|
||||
it_fails_ffox('should fail when navigating to bad url', async({page, server}) => {
|
||||
let error = null;
|
||||
await page.goto('asdfasdf').catch(e => error = e);
|
||||
expect(error.message).toContain('Cannot navigate to invalid URL');
|
||||
});
|
||||
it('should fail when navigating to bad SSL', async({page, httpsServer}) => {
|
||||
it_fails_ffox('should fail when navigating to bad SSL', async({page, httpsServer}) => {
|
||||
// Make sure that network events do not emit 'undefined'.
|
||||
// @see https://crbug.com/750469
|
||||
page.on('request', request => expect(request).toBeTruthy());
|
||||
@@ -94,19 +94,19 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
await page.goto(httpsServer.EMPTY_PAGE).catch(e => error = e);
|
||||
expect(error.message).toContain('net::ERR_CERT_AUTHORITY_INVALID');
|
||||
});
|
||||
it('should fail when navigating to bad SSL after redirects', async({page, server, httpsServer}) => {
|
||||
it_fails_ffox('should fail when navigating to bad SSL after redirects', async({page, server, httpsServer}) => {
|
||||
server.setRedirect('/redirect/1.html', '/redirect/2.html');
|
||||
server.setRedirect('/redirect/2.html', '/empty.html');
|
||||
let error = null;
|
||||
await page.goto(httpsServer.PREFIX + '/redirect/1.html').catch(e => error = e);
|
||||
expect(error.message).toContain('net::ERR_CERT_AUTHORITY_INVALID');
|
||||
});
|
||||
it('should throw if networkidle is passed as an option', async({page, server}) => {
|
||||
it_fails_ffox('should throw if networkidle is passed as an option', async({page, server}) => {
|
||||
let error = null;
|
||||
await page.goto(server.EMPTY_PAGE, {waitUntil: 'networkidle'}).catch(err => error = err);
|
||||
expect(error.message).toContain('"networkidle" option is no longer supported');
|
||||
});
|
||||
it('should fail when main resources failed to load', async({page, server}) => {
|
||||
it_fails_ffox('should fail when main resources failed to load', async({page, server}) => {
|
||||
let error = null;
|
||||
await page.goto('http://localhost:44123/non-existing-url').catch(e => error = e);
|
||||
expect(error.message).toContain('net::ERR_CONNECTION_REFUSED');
|
||||
@@ -119,7 +119,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(error.message).toContain('Navigation Timeout Exceeded: 1ms');
|
||||
expect(error).toBeInstanceOf(TimeoutError);
|
||||
});
|
||||
it('should fail when exceeding default maximum navigation timeout', async({page, server}) => {
|
||||
it_fails_ffox('should fail when exceeding default maximum navigation timeout', async({page, server}) => {
|
||||
// Hang for request to the empty.html
|
||||
server.setRoute('/empty.html', (req, res) => { });
|
||||
let error = null;
|
||||
@@ -128,7 +128,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(error.message).toContain('Navigation Timeout Exceeded: 1ms');
|
||||
expect(error).toBeInstanceOf(TimeoutError);
|
||||
});
|
||||
it('should fail when exceeding default maximum timeout', async({page, server}) => {
|
||||
it_fails_ffox('should fail when exceeding default maximum timeout', async({page, server}) => {
|
||||
// Hang for request to the empty.html
|
||||
server.setRoute('/empty.html', (req, res) => { });
|
||||
let error = null;
|
||||
@@ -137,7 +137,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(error.message).toContain('Navigation Timeout Exceeded: 1ms');
|
||||
expect(error).toBeInstanceOf(TimeoutError);
|
||||
});
|
||||
it('should prioritize default navigation timeout over default timeout', async({page, server}) => {
|
||||
it_fails_ffox('should prioritize default navigation timeout over default timeout', async({page, server}) => {
|
||||
// Hang for request to the empty.html
|
||||
server.setRoute('/empty.html', (req, res) => { });
|
||||
let error = null;
|
||||
@@ -155,20 +155,20 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(error).toBe(null);
|
||||
expect(loaded).toBe(true);
|
||||
});
|
||||
it('should work when navigating to valid url', async({page, server}) => {
|
||||
it_fails_ffox('should work when navigating to valid url', async({page, server}) => {
|
||||
const response = await page.goto(server.EMPTY_PAGE);
|
||||
expect(response.ok()).toBe(true);
|
||||
});
|
||||
it('should work when navigating to data url', async({page, server}) => {
|
||||
it_fails_ffox('should work when navigating to data url', async({page, server}) => {
|
||||
const response = await page.goto('data:text/html,hello');
|
||||
expect(response.ok()).toBe(true);
|
||||
});
|
||||
it('should work when navigating to 404', async({page, server}) => {
|
||||
it_fails_ffox('should work when navigating to 404', async({page, server}) => {
|
||||
const response = await page.goto(server.PREFIX + '/not-found');
|
||||
expect(response.ok()).toBe(false);
|
||||
expect(response.status()).toBe(404);
|
||||
});
|
||||
it('should return last response in redirect chain', async({page, server}) => {
|
||||
it_fails_ffox('should return last response in redirect chain', async({page, server}) => {
|
||||
server.setRedirect('/redirect/1.html', '/redirect/2.html');
|
||||
server.setRedirect('/redirect/2.html', '/redirect/3.html');
|
||||
server.setRedirect('/redirect/3.html', server.EMPTY_PAGE);
|
||||
@@ -176,7 +176,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(response.ok()).toBe(true);
|
||||
expect(response.url()).toBe(server.EMPTY_PAGE);
|
||||
});
|
||||
(FFOX ? xit : it)('should wait for network idle to succeed navigation', async({page, server}) => {
|
||||
it_fails_ffox('should wait for network idle to succeed navigation', async({page, server}) => {
|
||||
let responses = [];
|
||||
// Hold on to a bunch of requests without answering.
|
||||
server.setRoute('/fetch-request-a.js', (req, res) => responses.push(res));
|
||||
@@ -242,7 +242,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
process.removeListener('warning', warningHandler);
|
||||
expect(warning).toBe(null);
|
||||
});
|
||||
it('should not leak listeners during bad navigation', async({page, server}) => {
|
||||
it_fails_ffox('should not leak listeners during bad navigation', async({page, server}) => {
|
||||
let warning = null;
|
||||
const warningHandler = w => warning = w;
|
||||
process.on('warning', warningHandler);
|
||||
@@ -251,7 +251,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
process.removeListener('warning', warningHandler);
|
||||
expect(warning).toBe(null);
|
||||
});
|
||||
it('should not leak listeners during navigation of 11 pages', async({page, context, server}) => {
|
||||
it_fails_ffox('should not leak listeners during navigation of 11 pages', async({page, context, server}) => {
|
||||
let warning = null;
|
||||
const warningHandler = w => warning = w;
|
||||
process.on('warning', warningHandler);
|
||||
@@ -263,7 +263,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
process.removeListener('warning', warningHandler);
|
||||
expect(warning).toBe(null);
|
||||
});
|
||||
it('should navigate to dataURL and fire dataURL requests', async({page, server}) => {
|
||||
it_fails_ffox('should navigate to dataURL and fire dataURL requests', async({page, server}) => {
|
||||
const requests = [];
|
||||
page.on('request', request => requests.push(request));
|
||||
const dataURL = 'data:text/html,<div>yo</div>';
|
||||
@@ -272,7 +272,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(requests.length).toBe(1);
|
||||
expect(requests[0].url()).toBe(dataURL);
|
||||
});
|
||||
it('should navigate to URL with hash and fire requests without hash', async({page, server}) => {
|
||||
it_fails_ffox('should navigate to URL with hash and fire requests without hash', async({page, server}) => {
|
||||
const requests = [];
|
||||
page.on('request', request => requests.push(request));
|
||||
const response = await page.goto(server.EMPTY_PAGE + '#hash');
|
||||
@@ -281,7 +281,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(requests.length).toBe(1);
|
||||
expect(requests[0].url()).toBe(server.EMPTY_PAGE);
|
||||
});
|
||||
it('should work with self requesting page', async({page, server}) => {
|
||||
it_fails_ffox('should work with self requesting page', async({page, server}) => {
|
||||
const response = await page.goto(server.PREFIX + '/self-request.html');
|
||||
expect(response.status()).toBe(200);
|
||||
expect(response.url()).toContain('self-request.html');
|
||||
@@ -296,7 +296,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
}
|
||||
expect(error.message).toContain(url);
|
||||
});
|
||||
it('should send referer', async({page, server}) => {
|
||||
it_fails_ffox('should send referer', async({page, server}) => {
|
||||
const [request1, request2] = await Promise.all([
|
||||
server.waitForRequest('/grid.html'),
|
||||
server.waitForRequest('/digits/1.png'),
|
||||
@@ -311,7 +311,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
});
|
||||
|
||||
describe('Page.waitForNavigation', function() {
|
||||
it('should work', async({page, server}) => {
|
||||
it_fails_ffox('should work', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
const [response] = await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
@@ -340,7 +340,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
await bothFiredPromise;
|
||||
await navigationPromise;
|
||||
});
|
||||
it('should work with clicking on anchor links', async({page, server}) => {
|
||||
it_fails_ffox('should work with clicking on anchor links', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent(`<a href='#foobar'>foobar</a>`);
|
||||
const [response] = await Promise.all([
|
||||
@@ -350,7 +350,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(response).toBe(null);
|
||||
expect(page.url()).toBe(server.EMPTY_PAGE + '#foobar');
|
||||
});
|
||||
it('should work with history.pushState()', async({page, server}) => {
|
||||
it_fails_ffox('should work with history.pushState()', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent(`
|
||||
<a onclick='javascript:pushState()'>SPA</a>
|
||||
@@ -365,7 +365,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(response).toBe(null);
|
||||
expect(page.url()).toBe(server.PREFIX + '/wow.html');
|
||||
});
|
||||
it('should work with history.replaceState()', async({page, server}) => {
|
||||
it_fails_ffox('should work with history.replaceState()', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent(`
|
||||
<a onclick='javascript:replaceState()'>SPA</a>
|
||||
@@ -380,7 +380,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(response).toBe(null);
|
||||
expect(page.url()).toBe(server.PREFIX + '/replaced.html');
|
||||
});
|
||||
it('should work with DOM history.back()/history.forward()', async({page, server}) => {
|
||||
it_fails_ffox('should work with DOM history.back()/history.forward()', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent(`
|
||||
<a id=back onclick='javascript:goBack()'>back</a>
|
||||
@@ -424,7 +424,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
});
|
||||
|
||||
describe('Page.goBack', function() {
|
||||
it('should work', async({page, server}) => {
|
||||
it_fails_ffox('should work', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
|
||||
@@ -457,7 +457,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
});
|
||||
|
||||
describe('Frame.goto', function() {
|
||||
it('should navigate subframes', async({page, server}) => {
|
||||
it_fails_ffox('should navigate subframes', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||
expect(page.frames()[0].url()).toContain('/frames/one-frame.html');
|
||||
expect(page.frames()[1].url()).toContain('/frames/frame.html');
|
||||
@@ -466,7 +466,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(response.ok()).toBe(true);
|
||||
expect(response.frame()).toBe(page.frames()[1]);
|
||||
});
|
||||
it('should reject when frame detaches', async({page, server}) => {
|
||||
it_fails_ffox('should reject when frame detaches', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||
|
||||
server.setRoute('/empty.html', () => {});
|
||||
@@ -477,7 +477,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
const error = await navigationPromise;
|
||||
expect(error.message).toBe('Navigating frame was detached');
|
||||
});
|
||||
it('should return matching responses', async({page, server}) => {
|
||||
it_fails_ffox('should return matching responses', async({page, server}) => {
|
||||
// Disable cache: otherwise, chromium will cache similar requests.
|
||||
await page.setCacheEnabled(false);
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
@@ -507,7 +507,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
});
|
||||
|
||||
describe('Frame.waitForNavigation', function() {
|
||||
it('should work', async({page, server}) => {
|
||||
it_fails_ffox('should work', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||
const frame = page.frames()[1];
|
||||
const [response] = await Promise.all([
|
||||
@@ -519,7 +519,7 @@ module.exports.addTests = function({testRunner, expect, Errors, FFOX}) {
|
||||
expect(response.frame()).toBe(frame);
|
||||
expect(page.url()).toContain('/frames/one-frame.html');
|
||||
});
|
||||
it('should reject when frame detaches', async({page, server}) => {
|
||||
it_fails_ffox('should reject when frame detaches', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||
const frame = page.frames()[1];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user