Skip to content

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

test: switch from PWTEST_BOT_NAME to config.tag (#38337)

Dmitry Gozman8e3ea5094c3f
diff --git a/.github/actions/run-test/action.yml b/.github/actions/run-test/action.yml
index 3f458b8b62..549ae33dbb 100644
--- a/.github/actions/run-test/action.yml
+++ b/.github/actions/run-test/action.yml
@@ -61,13 +61,13 @@ runs:
fi
shell: bash
env:
- PWTEST_BOT_NAME: ${{ inputs.bot-name }}
+ PW_TAG: "@${{ inputs.bot-name }}"
- name: Run tests
if: inputs.shell != 'bash'
run: ${{ inputs.command }}
shell: ${{ inputs.shell }}
env:
- PWTEST_BOT_NAME: ${{ inputs.bot-name }}
+ PW_TAG: "@${{ inputs.bot-name }}"
- name: Azure Login
uses: azure/login@v2
if: ${{ !cancelled() && github.event_name == 'push' && github.repository == 'microsoft/playwright' }}
diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml
index f55bc25572..a104607b3c 100644
--- a/.github/workflows/tests_primary.yml
+++ b/.github/workflows/tests_primary.yml
@@ -141,8 +141,6 @@ jobs:
test_vscode_extension:
name: VSCode Extension
runs-on: ubuntu-latest
- env:
- PWTEST_BOT_NAME: "vscode-extension"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
@@ -167,12 +165,14 @@ jobs:
- name: Run extension tests
run: npm run test -- --workers=1
working-directory: ./playwright-vscode
+ env:
+ PW_TAG: "@vscode-extension"
- name: Upload blob report
if: ${{ !cancelled() }}
uses: ./.github/actions/upload-blob-report
with:
report_dir: playwright-vscode/blob-report
- job_name: ${{ env.PWTEST_BOT_NAME }}
+ job_name: vscode-extension
test_package_installations:
name: "Installation Test ${{ matrix.os }}"
diff --git a/packages/playwright/src/reporters/blob.ts b/packages/playwright/src/reporters/blob.ts
index 4d01cc97db..cc0312546a 100644
--- a/packages/playwright/src/reporters/blob.ts
+++ b/packages/playwright/src/reporters/blob.ts
@@ -52,6 +52,7 @@ export class BlobReporter extends TeleReporterEmitter {
const metadata: BlobReportMetadata = {
version: currentBlobReportVersion,
userAgent: getUserAgent(),
+ // TODO: remove after some time, recommend config.tag instead.
name: process.env.PWTEST_BOT_NAME,
shard: config.shard ?? undefined,
pathSeparator: path.sep,
diff --git a/packages/web/playwright.config.ts b/packages/web/playwright.config.ts
deleted file mode 100644
index 7b32fcf6b2..0000000000
--- a/packages/web/playwright.config.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.
- */
-
-import { devices, defineConfig } from '@playwright/experimental-ct-react';
-
-import type { ReporterDescription } from '@playwright/test';
-
-const reporters = () => {
- const result: ReporterDescription[] = process.env.CI ? [
- ['blob', { fileName: `${process.env.PWTEST_BOT_NAME}.zip` }],
- ] : [
- ['html']
- ];
- return result;
-};
-
-export default defineConfig({
- testDir: 'src',
- forbidOnly: !!process.env.CI,
- retries: process.env.CI ? 2 : 0,
- reporter: reporters(),
- use: {
- ctPort: 3102,
- trace: 'on-first-retry',
- },
- projects: [
- {
- name: 'chromium',
- use: { ...devices['Desktop Chrome'] },
- },
- ],
-});
diff --git a/tests/bidi/playwright.config.ts b/tests/bidi/playwright.config.ts
index c2f414dfc0..946b715041 100644
--- a/tests/bidi/playwright.config.ts
+++ b/tests/bidi/playwright.config.ts
@@ -44,7 +44,7 @@ const reporters = () => {
const result: ReporterDescription[] = process.env.CI ? [
hasDebugOutput ? ['list'] : ['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }],
- ['blob', { fileName: `${process.env.PWTEST_BOT_NAME}.zip` }],
+ ['blob'],
['./csvReporter', { outputFile: path.join(outputDir, 'report.csv') }],
] : [
['html', { open: 'on-failure' }],
@@ -60,6 +60,7 @@ const config: Config<PlaywrightWorkerOptions & PlaywrightTestOptions & TestModeW
expect: {
timeout: 10000,
},
+ tag: process.env.PW_TAG,
maxFailures: 0,
timeout: 15 * 1000,
globalTimeout: 90 * 60 * 1000,
diff --git a/tests/electron/playwright.config.ts b/tests/electron/playwright.config.ts
index 841e04f1ef..3306bc713d 100644
--- a/tests/electron/playwright.config.ts
+++ b/tests/electron/playwright.config.ts
@@ -40,8 +40,9 @@ const config: Config<PlaywrightWorkerOptions & PlaywrightTestOptions> = {
['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }],
// Needed since tests/electron/package.json exists which would otherwise be picked up as tests/electron/ (outputDir)
- ['blob', { fileName: path.join(__dirname, '../../blob-report/', `${process.env.PWTEST_BOT_NAME}.zip`) }],
+ ['blob', { outputDir: path.resolve(__dirname, '../../blob-report') }],
] : 'line',
+ tag: process.env.PW_TAG,
projects: [],
globalSetup: './globalSetup.ts'
};
diff --git a/tests/installation/playwright.config.ts b/tests/installation/playwright.config.ts
index f61efa87ff..dc94618aea 100644
--- a/tests/installation/playwright.config.ts
+++ b/tests/installation/playwright.config.ts
@@ -24,7 +24,7 @@ const reporters = () => {
const result: ReporterDescription[] = process.env.CI ? [
['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }],
- ['blob', { fileName: `${process.env.PWTEST_BOT_NAME}.zip` }],
+ ['blob'],
] : [
['list'],
['html', { open: 'on-failure' }]
@@ -40,6 +40,7 @@ export default defineConfig({
timeout: 5 * 60 * 1000,
retries: process.env.CI ? 3 : 0,
reporter: reporters(),
+ tag: process.env.PW_TAG,
forbidOnly: !!process.env.CI,
workers: 1,
projects: [
diff --git a/tests/library/playwright.config.ts b/tests/library/playwright.config.ts
index cb946173db..fdfbfb66b3 100644
--- a/tests/library/playwright.config.ts
+++ b/tests/library/playwright.config.ts
@@ -46,7 +46,7 @@ const reporters = () => {
const result: ReporterDescription[] = process.env.CI ? [
['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }],
- ['blob', { fileName: `${process.env.PWTEST_BOT_NAME}.zip` }],
+ ['blob'],
] : [
['html', { open: 'on-failure', title: 'Playwright Library Tests' }]
];
@@ -100,6 +100,7 @@ const config: Config<PlaywrightWorkerOptions & PlaywrightTestOptions & TestModeW
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 3 : 0,
reporter: reporters(),
+ tag: process.env.PW_TAG,
projects: [],
use: {
connectOptions,
diff --git a/tests/mcp/playwright.config.ts b/tests/mcp/playwright.config.ts
index 965b9bb67f..65971ac5da 100644
--- a/tests/mcp/playwright.config.ts
+++ b/tests/mcp/playwright.config.ts
@@ -31,7 +31,7 @@ const reporters = () => {
const result: ReporterDescription[] = process.env.CI ? [
['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }],
- ['blob', { outputDir: path.join(__dirname, '..', '..', 'blob-report'), fileName: `${process.env.PWTEST_BOT_NAME}.zip` }],
+ ['blob', { outputDir: path.join(__dirname, '..', '..', 'blob-report') }],
] : [
['list']
];
@@ -51,6 +51,7 @@ export default defineConfig<TestOptions>({
forbidOnly: !!process.env.CI,
workers: process.env.CI ? 2 : undefined,
reporter: reporters(),
+ tag: process.env.PW_TAG,
projects: [
{ name: 'chrome', metadata: { ...metadata, browserName: 'chromium', channel: 'chrome' }, testDir },
{ name: 'chromium', use: { mcpBrowser: 'chromium' }, metadata: { ...metadata, browserName: 'chromium' }, testDir },
diff --git a/tests/playwright-test/playwright.config.ts b/tests/playwright-test/playwright.config.ts
index 61ea0bfd67..0f01dc3cde 100644
--- a/tests/playwright-test/playwright.config.ts
+++ b/tests/playwright-test/playwright.config.ts
@@ -25,7 +25,7 @@ const reporters = () => {
const result: ReporterDescription[] = process.env.CI ? [
['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }],
- ['blob', { outputDir: path.join(__dirname, '..', '..', 'blob-report'), fileName: `${process.env.PWTEST_BOT_NAME}.zip` }],
+ ['blob', { outputDir: path.join(__dirname, '..', '..', 'blob-report') }],
] : [
['list']
];
@@ -49,6 +49,7 @@ export default defineConfig({
}
],
reporter: reporters(),
+ tag: process.env.PW_TAG,
metadata: {
clock: process.env.PW_CLOCK ? 'clock-' + process.env.PW_CLOCK : undefined,
},
diff --git a/tests/webview2/playwright.config.ts b/tests/webview2/playwright.config.ts
index e33981d732..57e9b3fc4b 100644
--- a/tests/webview2/playwright.config.ts
+++ b/tests/webview2/playwright.config.ts
@@ -39,8 +39,9 @@ const config: Config<PlaywrightWorkerOptions & PlaywrightTestOptions> = {
reporter: process.env.CI ? [
['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }],
- ['blob', { fileName: `${process.env.PWTEST_BOT_NAME}.zip` }],
+ ['blob'],
] : 'line',
+ tag: process.env.PW_TAG,
projects: [],
globalSetup: './globalSetup.ts',
};