Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: revert TestProject.botName for this release (#28670)
Yury Semikhatsky9c845365f75e
diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.mdindex 46fb7ac38f..09d0558d33 100644--- a/docs/src/test-api/class-testconfig.md+++ b/docs/src/test-api/class-testconfig.md@@ -17,23 +17,6 @@ export default defineConfig({});```-## property: TestConfig.botName-* since: v1.41-- type: ?<[string]>--Unique name of the environment where the tests run. It may be composed of, e.g., operating system name and-test run parameters. Test reporters can access the name via `TestProject.botName` property.--**Usage**--```js title="playwright.config.ts"-import { defineConfig } from '@playwright/test';--export default defineConfig({- botName: process.env.BOT_NAME,-});-```-## property: TestConfig.build* since: v1.35- type: ?<[Object]>diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.tsindex dda5fb7cbf..b3a124e47c 100644--- a/packages/playwright/src/common/config.ts+++ b/packages/playwright/src/common/config.ts@@ -168,7 +168,6 @@ export class FullProjectInternal {this.snapshotPathTemplate = takeFirst(projectConfig.snapshotPathTemplate, config.snapshotPathTemplate, defaultSnapshotPathTemplate);this.project = {- botName: config.botName,grep: takeFirst(projectConfig.grep, config.grep, defaultGrep),grepInvert: takeFirst(projectConfig.grepInvert, config.grepInvert, null),outputDir: takeFirst(configCLIOverrides.outputDir, pathResolve(configDir, projectConfig.outputDir), pathResolve(configDir, config.outputDir), path.join(throwawayArtifactsPath, 'test-results')),diff --git a/packages/playwright/src/isomorphic/teleReceiver.ts b/packages/playwright/src/isomorphic/teleReceiver.tsindex 1bb0577309..c5d82d810d 100644--- a/packages/playwright/src/isomorphic/teleReceiver.ts+++ b/packages/playwright/src/isomorphic/teleReceiver.ts@@ -41,7 +41,6 @@ export type JsonPattern = {export type JsonProject = {id: string;- botName?: string;grep: JsonPattern[];grepInvert: JsonPattern[];metadata: Metadata;@@ -335,7 +334,6 @@ export class TeleReporterReceiver {private _parseProject(project: JsonProject): TeleFullProject {return {__projectId: project.id,- botName: project.botName,metadata: project.metadata,name: project.name,outputDir: this._absolutePath(project.outputDir),diff --git a/packages/playwright/src/reporters/blob.ts b/packages/playwright/src/reporters/blob.tsindex 192b639a5a..03848a4c76 100644--- a/packages/playwright/src/reporters/blob.ts+++ b/packages/playwright/src/reporters/blob.ts@@ -61,7 +61,7 @@ export class BlobReporter extends TeleReporterEmitter {const metadata: BlobReportMetadata = {version: currentBlobReportVersion,userAgent: getUserAgent(),- name: config.botName,+ name: process.env.PWTEST_BOT_NAME,shard: config.shard ?? undefined,pathSeparator: path.sep,};diff --git a/packages/playwright/src/reporters/html.ts b/packages/playwright/src/reporters/html.tsindex 5c097927cb..dbebacc176 100644--- a/packages/playwright/src/reporters/html.ts+++ b/packages/playwright/src/reporters/html.ts@@ -240,7 +240,7 @@ class HtmlBuilder {}const { testFile, testFileSummary } = fileEntry;const testEntries: TestEntry[] = [];- this._processJsonSuite(fileSuite, fileId, projectSuite.project()!.name, projectSuite.project()!.botName, [], testEntries);+ this._processJsonSuite(fileSuite, fileId, projectSuite.project()!.name, projectSuite.project()!.metadata?.reportName, [], testEntries);for (const test of testEntries) {testFile.tests.push(test.testCase);testFileSummary.tests.push(test.testCaseSummary);diff --git a/packages/playwright/src/reporters/teleEmitter.ts b/packages/playwright/src/reporters/teleEmitter.tsindex 964e96a6a7..113856ce62 100644--- a/packages/playwright/src/reporters/teleEmitter.ts+++ b/packages/playwright/src/reporters/teleEmitter.ts@@ -162,7 +162,6 @@ export class TeleReporterEmitter implements ReporterV2 {const project = suite.project()!;const report: JsonProject = {id: getProjectId(project),- botName: project.botName,metadata: project.metadata,name: project.name,outputDir: this._relativePath(project.outputDir),diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.tsindex ff3679874a..a67ff6e121 100644--- a/packages/playwright/types/test.d.ts+++ b/packages/playwright/types/test.d.ts@@ -161,7 +161,6 @@ export interface Project<TestArgs = {}, WorkerArgs = {}> extends TestProject {**/export interface FullProject<TestArgs = {}, WorkerArgs = {}> {- botName?: string;/*** Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only* run tests with "cart" in the title. Also available globally and in the [command line](https://playwright.dev/docs/test-cli) with the `-g`@@ -571,24 +570,6 @@ interface TestConfig {**/webServer?: TestConfigWebServer | TestConfigWebServer[];- /**- * Unique name of the environment where the tests run. It may be composed of, e.g., operating system name and test run- * parameters. Test reporters can access the name via `TestProject.botName` property.- *- * **Usage**- *- * ```js- * // playwright.config.ts- * import { defineConfig } from '@playwright/test';- *- * export default defineConfig({- * botName: process.env.BOT_NAME,- * });- * ```- *- */- botName?: string;-/*** Playwright transpiler configuration.*@@ -1470,23 +1451,6 @@ export type Metadata = { [key: string]: any };**/export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {- /**- * Unique name of the environment where the tests run. It may be composed of, e.g., operating system name and test run- * parameters. Test reporters can access the name via `TestProject.botName` property.- *- * **Usage**- *- * ```js- * // playwright.config.ts- * import { defineConfig } from '@playwright/test';- *- * export default defineConfig({- * botName: process.env.BOT_NAME,- * });- * ```- *- */- botName?: string;/*** Whether to exit with an error if any tests or groups are marked as* [test.only(title, testFunction)](https://playwright.dev/docs/api/class-test#test-only) ordiff --git a/tests/installation/playwright.config.ts b/tests/installation/playwright.config.tsindex d2de1754fb..25ca82017b 100644--- a/tests/installation/playwright.config.ts+++ b/tests/installation/playwright.config.ts@@ -34,7 +34,6 @@ const reporters = () => {const outputDir = path.join(__dirname, '..', '..', 'test-results');export default defineConfig({- botName: process.env.PWTEST_BOT_NAME,globalSetup: path.join(__dirname, 'globalSetup'),outputDir,testIgnore: '**\/fixture-scripts/**',diff --git a/tests/library/playwright.config.ts b/tests/library/playwright.config.tsindex c9530d156b..771b8f2499 100644--- a/tests/library/playwright.config.ts+++ b/tests/library/playwright.config.ts@@ -80,7 +80,6 @@ if (mode === 'service2') {}const config: Config<CoverageWorkerOptions & PlaywrightWorkerOptions & PlaywrightTestOptions & TestModeWorkerOptions> = {- botName: process.env.PWTEST_BOT_NAME,testDir,outputDir,expect: {diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.tsindex 76ca67537b..ff81c9e6f2 100644--- a/tests/playwright-test/playwright-test-fixtures.ts+++ b/tests/playwright-test/playwright-test-fixtures.ts@@ -217,6 +217,7 @@ export function cleanEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {PW_TEST_REPORTER_WS_ENDPOINT: undefined,PW_TEST_SOURCE_TRANSFORM: undefined,PW_TEST_SOURCE_TRANSFORM_SCOPE: undefined,+ PWTEST_BOT_NAME: undefined,TEST_WORKER_INDEX: undefined,TEST_PARALLEL_INDEX: undefined,NODE_OPTIONS: undefined,diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.tsindex 71db0f2194..e69789fb45 100644--- a/tests/playwright-test/reporter-blob.spec.ts+++ b/tests/playwright-test/reporter-blob.spec.ts@@ -1197,24 +1197,23 @@ test('support fileName option', async ({ runInlineTest, mergeReports }) => {expect(reportFiles.sort()).toEqual(['report-one.zip', 'report-two.zip']);});-test('preserve botName on projects', async ({ runInlineTest, mergeReports }) => {- const files = (botName: string) => ({+test('preserve reportName on projects', async ({ runInlineTest, mergeReports }) => {+ const files = (reportName: string) => ({'echo-reporter.js': `import fs from 'fs';class EchoReporter {onBegin(config, suite) {- const projects = suite.suites.map(s => s.project()).sort((a, b) => a.botName.localeCompare(b.botName));+ const projects = suite.suites.map(s => s.project()).sort((a, b) => a.metadata.reportName.localeCompare(b.metadata.reportName));console.log('projectNames: ' + projects.map(p => p.name));- console.log('botNames: ' + projects.map(p => p.botName));+ console.log('reportNames: ' + projects.map(p => p.metadata.reportName));}}module.exports = EchoReporter;`,'playwright.config.ts': `module.exports = {- reporter: [['blob', { fileName: '${botName}.zip' }]],- botName: '${botName}',+ reporter: [['blob', { fileName: '${reportName}.zip' }]],projects: [{ name: 'foo' },]@@ -1226,14 +1225,14 @@ test('preserve botName on projects', async ({ runInlineTest, mergeReports }) =>`,});- await runInlineTest(files('first'));- await runInlineTest(files('second'), undefined, { PWTEST_BLOB_DO_NOT_REMOVE: '1' });+ await runInlineTest(files('first'), undefined, { PWTEST_BOT_NAME: 'first' });+ await runInlineTest(files('second'), undefined, { PWTEST_BOT_NAME: 'second', PWTEST_BLOB_DO_NOT_REMOVE: '1' });const reportDir = test.info().outputPath('blob-report');const { exitCode, output } = await mergeReports(reportDir, {}, { additionalArgs: ['--reporter', test.info().outputPath('echo-reporter.js')] });expect(exitCode).toBe(0);expect(output).toContain(`projectNames: foo,foo`);- expect(output).toContain(`botNames: first,second`);+ expect(output).toContain(`reportNames: first,second`);});test('no reports error', async ({ runInlineTest, mergeReports }) => {diff --git a/utils/generate_types/overrides-test.d.ts b/utils/generate_types/overrides-test.d.tsindex 382d4dacbe..5f29548676 100644--- a/utils/generate_types/overrides-test.d.ts+++ b/utils/generate_types/overrides-test.d.ts@@ -39,7 +39,6 @@ export interface Project<TestArgs = {}, WorkerArgs = {}> extends TestProject {// [internal] It is part of the public API and is computed from the user's config.// [internal] If you need new fields internally, add them to FullProjectInternal instead.export interface FullProject<TestArgs = {}, WorkerArgs = {}> {- botName?: string;grep: RegExp | RegExp[];grepInvert: RegExp | RegExp[] | null;metadata: Metadata;@@ -76,7 +75,6 @@ export type Metadata = { [key: string]: any };// [internal] It is part of the public API and is computed from the user's config.// [internal] If you need new fields internally, add them to FullConfigInternal instead.export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {- botName?: string;forbidOnly: boolean;fullyParallel: boolean;globalSetup: string | null;