Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: use ToT test runner for non-test-runner tests (#8671)

Dmitry Gozman2b4a93972df4
diff --git a/install-from-github.js b/install-from-github.js
index 6698bef74b..32e4bcefc1 100644
--- a/install-from-github.js
+++ b/install-from-github.js
@@ -24,7 +24,7 @@ console.log(`Updating test runner...`);
try {
execSync('npm ci --save=false --fund=false --audit=false', {
stdio: ['inherit', 'inherit', 'inherit'],
- cwd: path.join(__dirname, 'tests', 'config', 'test-runner'),
+ cwd: path.join(__dirname, 'tests', 'playwright-test', 'stable-test-runner'),
});
} catch (e) {
process.exit(1);
diff --git a/package.json b/package.json
index 3d6624d25f..4a43d70a10 100644
--- a/package.json
+++ b/package.json
@@ -9,13 +9,13 @@
"node": ">=12"
},
"scripts": {
- "basetest": "node ./tests/config/test-runner/node_modules/@playwright/test/lib/cli/cli.js test",
+ "basetest": "cross-env PWTEST_CLI_ALLOW_TEST_COMMAND=1 node ./lib/cli/cli test",
"ctest": "npm run basetest -- --config=tests/config/default.config.ts --project=chromium",
"ftest": "npm run basetest -- --config=tests/config/default.config.ts --project=firefox",
"wtest": "npm run basetest -- --config=tests/config/default.config.ts --project=webkit",
"atest": "npm run basetest -- --config=tests/config/android.config.ts",
"etest": "npm run basetest -- --config=tests/config/electron.config.ts",
- "ttest": "npm run basetest -- --config=tests/playwright-test/playwright-test.config.ts",
+ "ttest": "node ./tests/playwright-test/stable-test-runner/node_modules/@playwright/test/lib/cli/cli test --config=tests/playwright-test/playwright-test.config.ts",
"test": "npm run basetest -- --config=tests/config/default.config.ts",
"eslint": "[ \"$CI\" = true ] && eslint --quiet -f codeframe --ext ts,tsx . || eslint --ext ts,tsx .",
"tsc": "tsc -p .",
diff --git a/tests/config/android.config.ts b/tests/config/android.config.ts
index c0f72a3be4..df8a766f39 100644
--- a/tests/config/android.config.ts
+++ b/tests/config/android.config.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import type { Config } from '../config/test-runner';
+import type { Config } from './test-runner';
import * as path from 'path';
import { test as pageTest } from '../page/pageTest';
import { androidFixtures } from '../android/androidTest';
diff --git a/tests/config/test-runner.d.ts b/tests/config/test-runner.d.ts
new file mode 100644
index 0000000000..a71f8c7e54
--- /dev/null
+++ b/tests/config/test-runner.d.ts
@@ -0,0 +1,17 @@
+/**
+ * Copyright (c) Microsoft Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export * from '../../types/test';
diff --git a/tests/config/test-runner.js b/tests/config/test-runner.js
new file mode 100644
index 0000000000..6c0035a8cf
--- /dev/null
+++ b/tests/config/test-runner.js
@@ -0,0 +1,17 @@
+/**
+ * Copyright (c) Microsoft Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module.exports = require('../../lib/test/index');
diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.ts
index 91e78f2aec..7654d2215c 100644
--- a/tests/playwright-test/playwright-test-fixtures.ts
+++ b/tests/playwright-test/playwright-test-fixtures.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { TestInfo, test as base } from '../config/test-runner';
+import { TestInfo, test as base } from './stable-test-runner';
import { spawn } from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
@@ -273,7 +273,7 @@ const TSCONFIG = {
]
};
-export { expect } from '../config/test-runner';
+export { expect } from './stable-test-runner';
const asciiRegex = new RegExp('[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))', 'g');
export function stripAscii(str: string): string {
diff --git a/tests/playwright-test/playwright-test.config.ts b/tests/playwright-test/playwright-test.config.ts
index 91f4f40f0a..d88804257b 100644
--- a/tests/playwright-test/playwright-test.config.ts
+++ b/tests/playwright-test/playwright-test.config.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { Config } from '../config/test-runner';
+import { Config } from './stable-test-runner';
const config: Config = {
testDir: __dirname,
- testIgnore: 'assets/**',
+ testIgnore: ['assets/**', 'stable-test-runner/**'],
timeout: 30000,
forbidOnly: !!process.env.CI,
preserveOutput: process.env.CI ? 'failures-only' : 'always',
diff --git a/tests/config/test-runner/.gitignore b/tests/playwright-test/stable-test-runner/.gitignore
similarity index 100%
rename from tests/config/test-runner/.gitignore
rename to tests/playwright-test/stable-test-runner/.gitignore
diff --git a/tests/config/test-runner/README.md b/tests/playwright-test/stable-test-runner/README.md
similarity index 100%
rename from tests/config/test-runner/README.md
rename to tests/playwright-test/stable-test-runner/README.md
diff --git a/tests/config/test-runner/index.d.ts b/tests/playwright-test/stable-test-runner/index.d.ts
similarity index 100%
rename from tests/config/test-runner/index.d.ts
rename to tests/playwright-test/stable-test-runner/index.d.ts
diff --git a/tests/config/test-runner/index.js b/tests/playwright-test/stable-test-runner/index.js
similarity index 100%
rename from tests/config/test-runner/index.js
rename to tests/playwright-test/stable-test-runner/index.js
diff --git a/tests/config/test-runner/package-lock.json b/tests/playwright-test/stable-test-runner/package-lock.json
similarity index 100%
rename from tests/config/test-runner/package-lock.json
rename to tests/playwright-test/stable-test-runner/package-lock.json
diff --git a/tests/config/test-runner/package.json b/tests/playwright-test/stable-test-runner/package.json
similarity index 100%
rename from tests/config/test-runner/package.json
rename to tests/playwright-test/stable-test-runner/package.json
diff --git a/tests/trace-viewer/trace-viewer.spec.ts b/tests/trace-viewer/trace-viewer.spec.ts
index 8f3e7289bb..7924be5651 100644
--- a/tests/trace-viewer/trace-viewer.spec.ts
+++ b/tests/trace-viewer/trace-viewer.spec.ts
@@ -17,8 +17,7 @@
import path from 'path';
import type { Browser, Locator, Page } from '../../index';
import { showTraceViewer } from '../../lib/server/trace/viewer/traceViewer';
-import { playwrightTest } from '../config/browserTest';
-import { expect } from '../config/test-runner';
+import { playwrightTest, expect } from '../config/browserTest';
class TraceViewerPage {
actionTitles: Locator;