diff --git a/docs/src/test-api/class-testproject.md b/docs/src/test-api/class-testproject.md index ed5d14406c..8642b7f435 100644 --- a/docs/src/test-api/class-testproject.md +++ b/docs/src/test-api/class-testproject.md @@ -150,13 +150,6 @@ Filter to only run tests with a title **not** matching one of the patterns. This `grepInvert` option is also useful for [tagging tests](../test-annotations.md#tag-tests). -## property: TestProject.id -* since: v1.27 -- type: ?<[string]> - -Unique project id within this config. - - ## property: TestProject.metadata * since: v1.10 - type: ?<[Metadata]> diff --git a/packages/playwright-test/src/loader.ts b/packages/playwright-test/src/loader.ts index 8b4eaecf2f..b1e6ebbe97 100644 --- a/packages/playwright-test/src/loader.ts +++ b/packages/playwright-test/src/loader.ts @@ -178,7 +178,7 @@ export class Loader { const candidate = name + (i ? i : ''); if (usedNames.has(candidate)) continue; - p.id = candidate; + p._id = candidate; usedNames.add(candidate); break; } @@ -290,7 +290,7 @@ export class Loader { process.env.PWTEST_USE_SCREENSHOTS_DIR = '1'; } return { - id: '', + _id: '', _fullConfig: fullConfig, _fullyParallel: takeFirst(projectConfig.fullyParallel, config.fullyParallel, undefined), _expect: takeFirst(projectConfig.expect, config.expect, {}), @@ -402,20 +402,20 @@ class ProjectSuiteBuilder { test.retries = this._project.retries; const repeatEachIndexSuffix = repeatEachIndex ? ` (repeat:${repeatEachIndex})` : ''; // At the point of the query, suite is not yet attached to the project, so we only get file, describe and test titles. - const testIdExpression = `[project=${this._project.id}]${test.titlePath().join('\x1e')}${repeatEachIndexSuffix}`; + const testIdExpression = `[project=${this._project._id}]${test.titlePath().join('\x1e')}${repeatEachIndexSuffix}`; const testId = to._fileId + '-' + calculateSha1(testIdExpression).slice(0, 20); test.id = testId; test.repeatEachIndex = repeatEachIndex; - test._projectId = this._project.id; + test._projectId = this._project._id; if (!filter(test)) { to._entries.pop(); to.tests.pop(); } else { const pool = this._buildPool(entry); if (this._project._fullConfig._workerIsolation === 'isolate-pools') - test._workerHash = `run${this._project.id}-${pool.digest}-repeat${repeatEachIndex}`; + test._workerHash = `run${this._project._id}-${pool.digest}-repeat${repeatEachIndex}`; else - test._workerHash = `run${this._project.id}-repeat${repeatEachIndex}`; + test._workerHash = `run${this._project._id}-repeat${repeatEachIndex}`; test._pool = pool; } } @@ -447,7 +447,7 @@ class ProjectSuiteBuilder { (originalFixtures as any)[key] = value; } if (Object.entries(optionsFromConfig).length) - result.push({ fixtures: optionsFromConfig, location: { file: `project#${this._project.id}`, line: 1, column: 1 } }); + result.push({ fixtures: optionsFromConfig, location: { file: `project#${this._project._id}`, line: 1, column: 1 } }); if (Object.entries(originalFixtures).length) result.push({ fixtures: originalFixtures, location: f.location }); } diff --git a/packages/playwright-test/src/reporters/json.ts b/packages/playwright-test/src/reporters/json.ts index 02f370dcba..1ad9ac33c1 100644 --- a/packages/playwright-test/src/reporters/json.ts +++ b/packages/playwright-test/src/reporters/json.ts @@ -63,7 +63,7 @@ class JSONReporter implements Reporter { repeatEach: project.repeatEach, retries: project.retries, metadata: project.metadata, - id: project.id, + id: (project as any)._id, name: project.name, testDir: toPosixPath(project.testDir), testIgnore: serializePatterns(project.testIgnore), @@ -80,7 +80,7 @@ class JSONReporter implements Reporter { private _mergeSuites(suites: Suite[]): JSONReportSuite[] { const fileSuites = new MultiMap(); for (const projectSuite of suites) { - const projectId = projectSuite.project()!.id; + const projectId = (projectSuite.project() as any)._id; const projectName = projectSuite.project()!.name; for (const fileSuite of projectSuite.suites) { const file = fileSuite.location!.file; diff --git a/packages/playwright-test/src/testInfo.ts b/packages/playwright-test/src/testInfo.ts index 74cb4dacf5..bcfc86fcb6 100644 --- a/packages/playwright-test/src/testInfo.ts +++ b/packages/playwright-test/src/testInfo.ts @@ -115,8 +115,8 @@ export class TestInfoImpl implements TestInfo { const fullTitleWithoutSpec = test.titlePath().slice(1).join(' '); let testOutputDir = trimLongString(sanitizedRelativePath + '-' + sanitizeForFilePath(fullTitleWithoutSpec)); - if (project.id) - testOutputDir += '-' + sanitizeForFilePath(project.id); + if (project._id) + testOutputDir += '-' + sanitizeForFilePath(project._id); if (this.retry) testOutputDir += '-retry' + this.retry; if (this.repeatEachIndex) diff --git a/packages/playwright-test/src/types.ts b/packages/playwright-test/src/types.ts index 762ec8ee30..5b71f2843e 100644 --- a/packages/playwright-test/src/types.ts +++ b/packages/playwright-test/src/types.ts @@ -70,6 +70,7 @@ export interface FullConfigInternal extends FullConfigPublic { * increasing the surface area of the public API type called FullProject. */ export interface FullProjectInternal extends FullProjectPublic { + _id: string; _fullConfig: FullConfigInternal; _fullyParallel: boolean; _expect: Project['expect']; diff --git a/packages/playwright-test/src/workerRunner.ts b/packages/playwright-test/src/workerRunner.ts index 9255d3bca0..70ca8c82f6 100644 --- a/packages/playwright-test/src/workerRunner.ts +++ b/packages/playwright-test/src/workerRunner.ts @@ -160,7 +160,7 @@ export class WorkerRunner extends EventEmitter { return; this._loader = await Loader.deserialize(this._params.loader); - this._project = this._loader.fullConfig().projects.find(p => p.id === this._params.projectId)!; + this._project = this._loader.fullConfig().projects.find(p => p._id === this._params.projectId)!; } async runTestGroup(runPayload: RunPayload) { diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts index 4b60e6c1b6..69445b3bdd 100644 --- a/packages/playwright-test/types/test.d.ts +++ b/packages/playwright-test/types/test.d.ts @@ -198,10 +198,6 @@ export interface FullProject { * Metadata that will be put directly to the test report serialized as JSON. */ metadata: Metadata; - /** - * Unique project id within this config. - */ - id: string; /** * Project name is visible in the report and during test execution. */ @@ -4434,11 +4430,6 @@ interface TestProject { */ grepInvert?: RegExp|Array; - /** - * Unique project id within this config. - */ - id?: string; - /** * Metadata that will be put directly to the test report serialized as JSON. */ diff --git a/utils/generate_types/overrides-test.d.ts b/utils/generate_types/overrides-test.d.ts index 8d85557b70..3e1f8aae6a 100644 --- a/utils/generate_types/overrides-test.d.ts +++ b/utils/generate_types/overrides-test.d.ts @@ -41,7 +41,6 @@ export interface FullProject { grep: RegExp | RegExp[]; grepInvert: RegExp | RegExp[] | null; metadata: Metadata; - id: string; name: string; snapshotDir: string; outputDir: string;