diff --git a/src/chromium/features/chromium.spec.js b/test/chromium/chromium.spec.js
similarity index 91%
rename from src/chromium/features/chromium.spec.js
rename to test/chromium/chromium.spec.js
index b9e68fe26b..1a2f66f52e 100644
--- a/src/chromium/features/chromium.spec.js
+++ b/test/chromium/chromium.spec.js
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-const { waitEvent } = require('../../../test/utils');
+const { waitEvent } = require('../utils');
module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
@@ -227,4 +227,28 @@ module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME
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(`
+
+ `));
+ 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');
+ });
+ });
+
};
diff --git a/src/chromium/features/coverage.spec.js b/test/chromium/coverage.spec.js
similarity index 100%
rename from src/chromium/features/coverage.spec.js
rename to test/chromium/coverage.spec.js
diff --git a/src/chromium/features/geolocation.spec.js b/test/chromium/geolocation.spec.js
similarity index 100%
rename from src/chromium/features/geolocation.spec.js
rename to test/chromium/geolocation.spec.js
diff --git a/test/headful.spec.js b/test/chromium/headful.spec.js
similarity index 97%
rename from test/headful.spec.js
rename to test/chromium/headful.spec.js
index 39d30b3948..a76fb97e9f 100644
--- a/test/headful.spec.js
+++ b/test/chromium/headful.spec.js
@@ -18,8 +18,6 @@ const path = require('path');
const os = require('os');
const fs = require('fs');
const util = require('util');
-const utils = require('./utils');
-const {waitEvent} = utils;
const rmAsync = util.promisify(require('rimraf'));
const mkdtempAsync = util.promisify(fs.mkdtemp);
@@ -37,7 +35,7 @@ module.exports.addTests = function({testRunner, expect, playwright, defaultBrows
const headlessOptions = Object.assign({}, defaultBrowserOptions, {
headless: true
});
- const extensionPath = path.join(__dirname, 'assets', 'simple-extension');
+ const extensionPath = path.join(__dirname, '..', 'assets', 'simple-extension');
const extensionOptions = Object.assign({}, defaultBrowserOptions, {
headless: false,
args: [
diff --git a/test/chromiumonly.spec.js b/test/chromium/launcher.spec.js
similarity index 86%
rename from test/chromiumonly.spec.js
rename to test/chromium/launcher.spec.js
index b0adeacc6e..3c3c359bbd 100644
--- a/test/chromiumonly.spec.js
+++ b/test/chromium/launcher.spec.js
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-const {waitEvent} = require('./utils');
+const { waitEvent } = require('../utils');
const util = require('util');
const fs = require('fs');
const path = require('path');
@@ -24,7 +24,7 @@ const mkdtempAsync = util.promisify(fs.mkdtemp);
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 {it, fit, xit} = 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(`
-
- `));
- 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');
- });
- });
-};
-
diff --git a/test/oopif.spec.js b/test/chromium/oopif.spec.js
similarity index 100%
rename from test/oopif.spec.js
rename to test/chromium/oopif.spec.js
diff --git a/src/chromium/features/pdf.spec.js b/test/chromium/pdf.spec.js
similarity index 100%
rename from src/chromium/features/pdf.spec.js
rename to test/chromium/pdf.spec.js
diff --git a/test/CDPSession.spec.js b/test/chromium/session.spec.js
similarity index 98%
rename from test/CDPSession.spec.js
rename to test/chromium/session.spec.js
index 3ad52c9569..9f43e83eaa 100644
--- a/test/CDPSession.spec.js
+++ b/test/chromium/session.spec.js
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-const {waitEvent} = require('./utils');
+const { waitEvent } = require('../utils');
module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
diff --git a/src/chromium/features/tracing.spec.js b/test/chromium/tracing.spec.js
similarity index 100%
rename from src/chromium/features/tracing.spec.js
rename to test/chromium/tracing.spec.js
diff --git a/src/chromium/features/workers.spec.js b/test/chromium/workers.spec.js
similarity index 97%
rename from src/chromium/features/workers.spec.js
rename to test/chromium/workers.spec.js
index fecc25fd23..7f3e746501 100644
--- a/src/chromium/features/workers.spec.js
+++ b/test/chromium/workers.spec.js
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-const utils = require('../../../test/utils');
+const utils = require('../utils');
const { waitEvent } = utils;
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 {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
- describe.skip(FFOX || WEBKIT)('Workers', function() {
+ describe('Workers', function() {
it('Page.workers', async function({page, server}) {
await Promise.all([
new Promise(x => page.workers.once('workercreated', x)),
diff --git a/src/tests/accessibility.spec.js b/test/features/accessibility.spec.js
similarity index 100%
rename from src/tests/accessibility.spec.js
rename to test/features/accessibility.spec.js
diff --git a/src/tests/permissions.spec.js b/test/features/permissions.spec.js
similarity index 100%
rename from src/tests/permissions.spec.js
rename to test/features/permissions.spec.js
diff --git a/test/launcher.spec.js b/test/launcher.spec.js
index bf49a0b531..30ce548f20 100644
--- a/test/launcher.spec.js
+++ b/test/launcher.spec.js
@@ -31,7 +31,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
describe('Playwright', 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 browserFetcher = playwright.createBrowserFetcher({
platform: 'linux',
diff --git a/test/playwright.spec.js b/test/playwright.spec.js
index 4ca4b0e5c2..ee1ff51f78 100644
--- a/test/playwright.spec.js
+++ b/test/playwright.spec.js
@@ -131,9 +131,6 @@ module.exports.addTests = ({testRunner, product, playwrightPath}) => {
// Page-level tests that are given a browser, a context and a page.
// 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('./click.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('./navigation.spec.js').addTests(testOptions);
require('./network.spec.js').addTests(testOptions);
- require('./requestinterception.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('./requestinterception.spec.js').addTests(testOptions);
+ require('./screenshot.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) {
- require('./CDPSession.spec.js').addTests(testOptions);
- require('../src/chromium/features/coverage.spec.js').addTests(testOptions);
- // Add page-level Chromium-specific tests.
- require('./chromiumonly.spec.js').addPageTests(testOptions);
- require('../src/chromium/features/geolocation.spec.js').addTests(testOptions);
- require('../src/chromium/features/pdf.spec.js').addTests(testOptions);
- require('../src/chromium/features/chromium.spec.js').addTests(testOptions);
+ require('./chromium/chromium.spec.js').addTests(testOptions);
+ require('./chromium/coverage.spec.js').addTests(testOptions);
+ require('./chromium/geolocation.spec.js').addTests(testOptions);
+ require('./chromium/pdf.spec.js').addTests(testOptions);
+ require('./chromium/session.spec.js').addTests(testOptions);
+ require('./chromium/workers.spec.js').addTests(testOptions);
}
});
@@ -170,15 +169,14 @@ module.exports.addTests = ({testRunner, product, playwrightPath}) => {
});
// Top-level tests that launch Browser themselves.
- require('./ignorehttpserrors.spec.js').addTests(testOptions);
require('./defaultbrowsercontext.spec.js').addTests(testOptions);
- require('./launcher.spec.js').addTests(testOptions);
require('./fixtures.spec.js').addTests(testOptions);
+ require('./ignorehttpserrors.spec.js').addTests(testOptions);
+ require('./launcher.spec.js').addTests(testOptions);
if (CHROME) {
- require('./oopif.spec.js').addTests(testOptions);
- require('./headful.spec.js').addTests(testOptions);
- require('../src/chromium/features/tracing.spec.js').addTests(testOptions);
- // Add top-level Chromium-specific tests.
- require('./chromiumonly.spec.js').addLauncherTests(testOptions);
+ require('./chromium/headful.spec.js').addTests(testOptions);
+ require('./chromium/launcher.spec.js').addTests(testOptions);
+ require('./chromium/oopif.spec.js').addTests(testOptions);
+ require('./chromium/tracing.spec.js').addTests(testOptions);
}
};