chore: rearrange test spec files
This commit is contained in:
parent
6294f0248a
commit
0884e29695
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { waitEvent } = require('../../../test/utils');
|
const { waitEvent } = require('../utils');
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
|
|
@ -227,4 +227,28 @@ module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME
|
||||||
await context.close();
|
await context.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Chromium-Specific Page Tests', function() {
|
||||||
|
it('Page.setRequestInterception should work with intervention headers', async({server, page}) => {
|
||||||
|
server.setRoute('/intervention', (req, res) => res.end(`
|
||||||
|
<script>
|
||||||
|
document.write('<script src="${server.CROSS_PROCESS_PREFIX}/intervention.js">' + '</scr' + 'ipt>');
|
||||||
|
</script>
|
||||||
|
`));
|
||||||
|
server.setRedirect('/intervention.js', '/redirect.js');
|
||||||
|
let serverRequest = null;
|
||||||
|
server.setRoute('/redirect.js', (req, res) => {
|
||||||
|
serverRequest = req;
|
||||||
|
res.end('console.log(1);');
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.interception.enable();
|
||||||
|
page.on('request', request => page.interception.continue(request));
|
||||||
|
await page.goto(server.PREFIX + '/intervention');
|
||||||
|
// Check for feature URL substring rather than https://www.chromestatus.com to
|
||||||
|
// make it work with Edgium.
|
||||||
|
expect(serverRequest.headers.intervention).toContain('feature/5718547946799104');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -18,8 +18,6 @@ const path = require('path');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const utils = require('./utils');
|
|
||||||
const {waitEvent} = utils;
|
|
||||||
|
|
||||||
const rmAsync = util.promisify(require('rimraf'));
|
const rmAsync = util.promisify(require('rimraf'));
|
||||||
const mkdtempAsync = util.promisify(fs.mkdtemp);
|
const mkdtempAsync = util.promisify(fs.mkdtemp);
|
||||||
|
|
@ -37,7 +35,7 @@ module.exports.addTests = function({testRunner, expect, playwright, defaultBrows
|
||||||
const headlessOptions = Object.assign({}, defaultBrowserOptions, {
|
const headlessOptions = Object.assign({}, defaultBrowserOptions, {
|
||||||
headless: true
|
headless: true
|
||||||
});
|
});
|
||||||
const extensionPath = path.join(__dirname, 'assets', 'simple-extension');
|
const extensionPath = path.join(__dirname, '..', 'assets', 'simple-extension');
|
||||||
const extensionOptions = Object.assign({}, defaultBrowserOptions, {
|
const extensionOptions = Object.assign({}, defaultBrowserOptions, {
|
||||||
headless: false,
|
headless: false,
|
||||||
args: [
|
args: [
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const {waitEvent} = require('./utils');
|
const { waitEvent } = require('../utils');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
@ -24,7 +24,7 @@ const mkdtempAsync = util.promisify(fs.mkdtemp);
|
||||||
|
|
||||||
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
|
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
|
||||||
|
|
||||||
module.exports.addLauncherTests = function({testRunner, expect, defaultBrowserOptions, playwright}) {
|
module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, playwright}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
@ -191,33 +191,3 @@ module.exports.addLauncherTests = function({testRunner, expect, defaultBrowserOp
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.addPageTests = function({testRunner, expect}) {
|
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
|
||||||
const {it, fit, xit} = testRunner;
|
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
|
||||||
|
|
||||||
describe('Chromium-Specific Page Tests', function() {
|
|
||||||
it('Page.setRequestInterception should work with intervention headers', async({server, page}) => {
|
|
||||||
server.setRoute('/intervention', (req, res) => res.end(`
|
|
||||||
<script>
|
|
||||||
document.write('<script src="${server.CROSS_PROCESS_PREFIX}/intervention.js">' + '</scr' + 'ipt>');
|
|
||||||
</script>
|
|
||||||
`));
|
|
||||||
server.setRedirect('/intervention.js', '/redirect.js');
|
|
||||||
let serverRequest = null;
|
|
||||||
server.setRoute('/redirect.js', (req, res) => {
|
|
||||||
serverRequest = req;
|
|
||||||
res.end('console.log(1);');
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.interception.enable();
|
|
||||||
page.on('request', request => page.interception.continue(request));
|
|
||||||
await page.goto(server.PREFIX + '/intervention');
|
|
||||||
// Check for feature URL substring rather than https://www.chromestatus.com to
|
|
||||||
// make it work with Edgium.
|
|
||||||
expect(serverRequest.headers.intervention).toContain('feature/5718547946799104');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const {waitEvent} = require('./utils');
|
const { waitEvent } = require('../utils');
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const utils = require('../../../test/utils');
|
const utils = require('../utils');
|
||||||
const { waitEvent } = utils;
|
const { waitEvent } = utils;
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
|
|
@ -23,7 +23,7 @@ module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe.skip(FFOX || WEBKIT)('Workers', function() {
|
describe('Workers', function() {
|
||||||
it('Page.workers', async function({page, server}) {
|
it('Page.workers', async function({page, server}) {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
new Promise(x => page.workers.once('workercreated', x)),
|
new Promise(x => page.workers.once('workercreated', x)),
|
||||||
|
|
@ -31,7 +31,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
||||||
|
|
||||||
describe('Playwright', function() {
|
describe('Playwright', function() {
|
||||||
describe('BrowserFetcher', function() {
|
describe('BrowserFetcher', function() {
|
||||||
it.skip(WEBKIT)('should download and extract linux binary', async({server}) => {
|
it.skip(WEBKIT || FFOX)('should download and extract linux binary', async({server}) => {
|
||||||
const downloadsFolder = await mkdtempAsync(TMP_FOLDER);
|
const downloadsFolder = await mkdtempAsync(TMP_FOLDER);
|
||||||
const browserFetcher = playwright.createBrowserFetcher({
|
const browserFetcher = playwright.createBrowserFetcher({
|
||||||
platform: 'linux',
|
platform: 'linux',
|
||||||
|
|
|
||||||
|
|
@ -131,9 +131,6 @@ module.exports.addTests = ({testRunner, product, playwrightPath}) => {
|
||||||
|
|
||||||
// Page-level tests that are given a browser, a context and a page.
|
// Page-level tests that are given a browser, a context and a page.
|
||||||
// Each test is launched in a new browser context.
|
// Each test is launched in a new browser context.
|
||||||
require('../src/tests/accessibility.spec.js').addTests(testOptions);
|
|
||||||
require('../src/tests/permissions.spec.js').addTests(testOptions);
|
|
||||||
require('../src/chromium/features/workers.spec.js').addTests(testOptions);
|
|
||||||
require('./browser.spec.js').addTests(testOptions);
|
require('./browser.spec.js').addTests(testOptions);
|
||||||
require('./click.spec.js').addTests(testOptions);
|
require('./click.spec.js').addTests(testOptions);
|
||||||
require('./cookies.spec.js').addTests(testOptions);
|
require('./cookies.spec.js').addTests(testOptions);
|
||||||
|
|
@ -148,20 +145,22 @@ module.exports.addTests = ({testRunner, product, playwrightPath}) => {
|
||||||
require('./mouse.spec.js').addTests(testOptions);
|
require('./mouse.spec.js').addTests(testOptions);
|
||||||
require('./navigation.spec.js').addTests(testOptions);
|
require('./navigation.spec.js').addTests(testOptions);
|
||||||
require('./network.spec.js').addTests(testOptions);
|
require('./network.spec.js').addTests(testOptions);
|
||||||
require('./requestinterception.spec.js').addTests(testOptions);
|
|
||||||
require('./page.spec.js').addTests(testOptions);
|
require('./page.spec.js').addTests(testOptions);
|
||||||
// FIXME: screenshot tests will fail when running in parallel (maybe)
|
|
||||||
require('./screenshot.spec.js').addTests(testOptions);
|
|
||||||
require('./queryselector.spec.js').addTests(testOptions);
|
require('./queryselector.spec.js').addTests(testOptions);
|
||||||
|
require('./requestinterception.spec.js').addTests(testOptions);
|
||||||
|
require('./screenshot.spec.js').addTests(testOptions);
|
||||||
require('./waittask.spec.js').addTests(testOptions);
|
require('./waittask.spec.js').addTests(testOptions);
|
||||||
|
|
||||||
|
require('./features/accessibility.spec.js').addTests(testOptions);
|
||||||
|
require('./features/permissions.spec.js').addTests(testOptions);
|
||||||
|
|
||||||
if (CHROME) {
|
if (CHROME) {
|
||||||
require('./CDPSession.spec.js').addTests(testOptions);
|
require('./chromium/chromium.spec.js').addTests(testOptions);
|
||||||
require('../src/chromium/features/coverage.spec.js').addTests(testOptions);
|
require('./chromium/coverage.spec.js').addTests(testOptions);
|
||||||
// Add page-level Chromium-specific tests.
|
require('./chromium/geolocation.spec.js').addTests(testOptions);
|
||||||
require('./chromiumonly.spec.js').addPageTests(testOptions);
|
require('./chromium/pdf.spec.js').addTests(testOptions);
|
||||||
require('../src/chromium/features/geolocation.spec.js').addTests(testOptions);
|
require('./chromium/session.spec.js').addTests(testOptions);
|
||||||
require('../src/chromium/features/pdf.spec.js').addTests(testOptions);
|
require('./chromium/workers.spec.js').addTests(testOptions);
|
||||||
require('../src/chromium/features/chromium.spec.js').addTests(testOptions);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -170,15 +169,14 @@ module.exports.addTests = ({testRunner, product, playwrightPath}) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Top-level tests that launch Browser themselves.
|
// Top-level tests that launch Browser themselves.
|
||||||
require('./ignorehttpserrors.spec.js').addTests(testOptions);
|
|
||||||
require('./defaultbrowsercontext.spec.js').addTests(testOptions);
|
require('./defaultbrowsercontext.spec.js').addTests(testOptions);
|
||||||
require('./launcher.spec.js').addTests(testOptions);
|
|
||||||
require('./fixtures.spec.js').addTests(testOptions);
|
require('./fixtures.spec.js').addTests(testOptions);
|
||||||
|
require('./ignorehttpserrors.spec.js').addTests(testOptions);
|
||||||
|
require('./launcher.spec.js').addTests(testOptions);
|
||||||
if (CHROME) {
|
if (CHROME) {
|
||||||
require('./oopif.spec.js').addTests(testOptions);
|
require('./chromium/headful.spec.js').addTests(testOptions);
|
||||||
require('./headful.spec.js').addTests(testOptions);
|
require('./chromium/launcher.spec.js').addTests(testOptions);
|
||||||
require('../src/chromium/features/tracing.spec.js').addTests(testOptions);
|
require('./chromium/oopif.spec.js').addTests(testOptions);
|
||||||
// Add top-level Chromium-specific tests.
|
require('./chromium/tracing.spec.js').addTests(testOptions);
|
||||||
require('./chromiumonly.spec.js').addLauncherTests(testOptions);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue