diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml index 0ad4b68294..8c491514ae 100644 --- a/.github/workflows/tests_primary.yml +++ b/.github/workflows/tests_primary.yml @@ -55,7 +55,7 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps ${{ matrix.browser }} chromium - - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} + - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* - run: node tests/config/checkCoverage.js ${{ matrix.browser }} - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() @@ -87,7 +87,7 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps chromium-tip-of-tree - - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium + - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium-* env: PWTEST_CHANNEL: chromium-tip-of-tree PWTEST_BOT_NAME: "${{ matrix.os }}-chromium-tip-of-tree" diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml index 816bf5c3f9..7659c338bc 100644 --- a/.github/workflows/tests_secondary.yml +++ b/.github/workflows/tests_secondary.yml @@ -42,7 +42,7 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps ${{ matrix.browser }} chromium - - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} + - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* - run: node tests/config/checkCoverage.js ${{ matrix.browser }} - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() @@ -75,7 +75,7 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps ${{ matrix.browser }} chromium - - run: npm run test -- --project=${{ matrix.browser }} + - run: npm run test -- --project=${{ matrix.browser }}-* - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() shell: bash @@ -106,10 +106,10 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps ${{ matrix.browser }} chromium - - run: npm run test -- --project=${{ matrix.browser }} --workers=1 + - run: npm run test -- --project=${{ matrix.browser }}-* --workers=1 if: matrix.browser == 'firefox' shell: bash - - run: npm run test -- --project=${{ matrix.browser }} + - run: npm run test -- --project=${{ matrix.browser }}-* if: matrix.browser != 'firefox' shell: bash - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json @@ -175,9 +175,9 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps ${{ matrix.browser }} chromium - - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} --headed + - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* --headed if: always() && startsWith(matrix.os, 'ubuntu-') - - run: npm run test -- --project=${{ matrix.browser }} --headed + - run: npm run test -- --project=${{ matrix.browser }}-* --headed if: always() && !startsWith(matrix.os, 'ubuntu-') - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json if: always() @@ -247,7 +247,7 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps ${{ matrix.browser }} chromium ${{ matrix.channel }} - - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} + - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* env: PWTEST_TRACE: 1 PWTEST_CHANNEL: ${{ matrix.channel }} @@ -868,7 +868,7 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps chromium - - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium + - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium-* env: PLAYWRIGHT_CHROMIUM_USE_HEADLESS_NEW: 1 - run: node tests/config/checkCoverage.js chromium diff --git a/.github/workflows/tests_service.yml b/.github/workflows/tests_service.yml index 9c932f38e4..b8c192f988 100644 --- a/.github/workflows/tests_service.yml +++ b/.github/workflows/tests_service.yml @@ -23,7 +23,7 @@ jobs: env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} --workers=10 --retries=0 + - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* --workers=10 --retries=0 env: PWTEST_MODE: service2 PWTEST_TRACE: 1 diff --git a/.github/workflows/tests_video.yml b/.github/workflows/tests_video.yml index f39b544f93..3acda7cec7 100644 --- a/.github/workflows/tests_video.yml +++ b/.github/workflows/tests_video.yml @@ -32,7 +32,7 @@ jobs: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: npm run build - run: npx playwright install --with-deps ${{ matrix.browser }} chromium - - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }} + - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}-* env: PWTEST_VIDEO: 1 - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json diff --git a/package.json b/package.json index fdbafad27c..253206f667 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,9 @@ }, "license": "Apache-2.0", "scripts": { - "ctest": "playwright test --config=tests/library/playwright.config.ts --project=chromium", - "ftest": "playwright test --config=tests/library/playwright.config.ts --project=firefox", - "wtest": "playwright test --config=tests/library/playwright.config.ts --project=webkit", + "ctest": "playwright test --config=tests/library/playwright.config.ts --project=chromium-*", + "ftest": "playwright test --config=tests/library/playwright.config.ts --project=firefox-*", + "wtest": "playwright test --config=tests/library/playwright.config.ts --project=webkit-*", "atest": "playwright test --config=tests/android/playwright.config.ts", "etest": "playwright test --config=tests/electron/playwright.config.ts", "webview2test": "playwright test --config=tests/webview2/playwright.config.ts", diff --git a/packages/html-reporter/src/filter.ts b/packages/html-reporter/src/filter.ts index 6f7ef14525..97cf675936 100644 --- a/packages/html-reporter/src/filter.ts +++ b/packages/html-reporter/src/filter.ts @@ -14,7 +14,6 @@ limitations under the License. */ -import { testCaseLabels } from './labelUtils'; import type { TestCaseSummary } from './types'; export class Filter { @@ -108,13 +107,13 @@ export class Filter { if (test.outcome === 'skipped') status = 'skipped'; const searchValues: SearchValues = { - text: (status + ' ' + test.projectName + ' ' + (test.botName || '') + ' ' + test.location.file + ' ' + test.path.join(' ') + ' ' + test.title).toLowerCase(), + text: (status + ' ' + test.projectName + ' ' + test.tags.join(' ') + ' ' + test.location.file + ' ' + test.path.join(' ') + ' ' + test.title).toLowerCase(), project: test.projectName.toLowerCase(), status: status as any, file: test.location.file, line: String(test.location.line), column: String(test.location.column), - labels: testCaseLabels(test).map(label => label.toLowerCase()), + labels: test.tags.map(tag => tag.toLowerCase()), }; (test as any).searchValues = searchValues; } diff --git a/packages/html-reporter/src/labelUtils.tsx b/packages/html-reporter/src/labelUtils.tsx index 57d9c43c9a..014ec77d59 100644 --- a/packages/html-reporter/src/labelUtils.tsx +++ b/packages/html-reporter/src/labelUtils.tsx @@ -14,22 +14,6 @@ * limitations under the License. */ -import type { TestCaseSummary } from './types'; - -const labelsSymbol = Symbol('labels'); - -// Note: all labels start with "@" -export function testCaseLabels(test: TestCaseSummary): string[] { - if (!(test as any)[labelsSymbol]) { - const labels: string[] = []; - if (test.botName) - labels.push('@' + test.botName); - labels.push(...test.tags); - (test as any)[labelsSymbol] = labels; - } - return (test as any)[labelsSymbol]; -} - // hash string to integer in range [0, 6] for color index, to get same color for same tag export function hashStringToInt(str: string) { let hash = 0; diff --git a/packages/html-reporter/src/testCaseView.tsx b/packages/html-reporter/src/testCaseView.tsx index 4b79908edf..eecbdac9f5 100644 --- a/packages/html-reporter/src/testCaseView.tsx +++ b/packages/html-reporter/src/testCaseView.tsx @@ -23,7 +23,7 @@ import { ProjectLink } from './links'; import { statusIcon } from './statusIcon'; import './testCaseView.css'; import { TestResultView } from './testResultView'; -import { hashStringToInt, testCaseLabels } from './labelUtils'; +import { hashStringToInt } from './labelUtils'; import { msToString } from './uiUtils'; export const TestCaseView: React.FC<{ @@ -37,7 +37,7 @@ export const TestCaseView: React.FC<{ const labels = React.useMemo(() => { if (!test) return undefined; - return testCaseLabels(test); + return test.tags; }, [test]); return
diff --git a/packages/html-reporter/src/testFileView.tsx b/packages/html-reporter/src/testFileView.tsx index 619d6263d2..4f508c42b8 100644 --- a/packages/html-reporter/src/testFileView.tsx +++ b/packages/html-reporter/src/testFileView.tsx @@ -23,7 +23,7 @@ import { generateTraceUrl, Link, navigate, ProjectLink } from './links'; import { statusIcon } from './statusIcon'; import './testFileView.css'; import { video, image, trace } from './icons'; -import { hashStringToInt, testCaseLabels } from './labelUtils'; +import { hashStringToInt } from './labelUtils'; export const TestFileView: React.FC {report.projectNames.length > 1 && !!test.projectName && } - +
{msToString(test.duration)} diff --git a/packages/playwright/src/isomorphic/teleReceiver.ts b/packages/playwright/src/isomorphic/teleReceiver.ts index a7f9f412f1..0ba4f4ebd6 100644 --- a/packages/playwright/src/isomorphic/teleReceiver.ts +++ b/packages/playwright/src/isomorphic/teleReceiver.ts @@ -36,7 +36,6 @@ export type JsonPattern = { }; export type JsonProject = { - id: string; grep: JsonPattern[]; grepInvert: JsonPattern[]; metadata: Metadata; @@ -132,16 +131,18 @@ export class TeleReporterReceiver { private _rootDir!: string; private _listOnly = false; private _clearPreviousResultsWhenTestBegins: boolean = false; - private _reuseTestCases: boolean; + private _mergeTestCases: boolean; + private _mergeProjects: boolean; private _reportConfig: MergeReporterConfig | undefined; private _config!: reporterTypes.FullConfig; private _stringPool = new StringInternPool(); - constructor(pathSeparator: string, reporter: Partial, reuseTestCases: boolean, reportConfig?: MergeReporterConfig) { + constructor(pathSeparator: string, reporter: Partial, mergeProjects: boolean, mergeTestCases: boolean, reportConfig?: MergeReporterConfig) { this._rootSuite = new TeleSuite('', 'root'); this._pathSeparator = pathSeparator; this._reporter = reporter; - this._reuseTestCases = reuseTestCases; + this._mergeProjects = mergeProjects; + this._mergeTestCases = mergeTestCases; this._reportConfig = reportConfig; } @@ -201,7 +202,7 @@ export class TeleReporterReceiver { } private _onProject(project: JsonProject) { - let projectSuite = this._rootSuite.suites.find(suite => suite.project()!.__projectId === project.id); + let projectSuite = this._mergeProjects ? this._rootSuite.suites.find(suite => suite.project()!.name === project.name) : undefined; if (!projectSuite) { projectSuite = new TeleSuite(project.name, 'project'); this._rootSuite.suites.push(projectSuite); @@ -331,7 +332,6 @@ export class TeleReporterReceiver { private _parseProject(project: JsonProject): TeleFullProject { return { - __projectId: project.id, metadata: project.metadata, name: project.name, outputDir: this._absolutePath(project.outputDir), @@ -375,7 +375,7 @@ export class TeleReporterReceiver { private _mergeTestsInto(jsonTests: JsonTestCase[], parent: TeleSuite) { for (const jsonTest of jsonTests) { - let targetTest = this._reuseTestCases ? parent.tests.find(s => s.title === jsonTest.title && s.repeatEachIndex === jsonTest.repeatEachIndex) : undefined; + let targetTest = this._mergeTestCases ? parent.tests.find(s => s.title === jsonTest.title && s.repeatEachIndex === jsonTest.repeatEachIndex) : undefined; if (!targetTest) { targetTest = new TeleTestCase(jsonTest.testId, jsonTest.title, this._absoluteLocation(jsonTest.location), jsonTest.repeatEachIndex); targetTest.parent = parent; @@ -593,7 +593,7 @@ class TeleTestResult implements reporterTypes.TestResult { } } -export type TeleFullProject = FullProject & { __projectId: string }; +export type TeleFullProject = FullProject; export const baseFullConfig: reporterTypes.FullConfig = { forbidOnly: false, diff --git a/packages/playwright/src/reporters/html.ts b/packages/playwright/src/reporters/html.ts index 8c0adcd5c0..1b66da35f7 100644 --- a/packages/playwright/src/reporters/html.ts +++ b/packages/playwright/src/reporters/html.ts @@ -241,7 +241,7 @@ class HtmlBuilder { } const { testFile, testFileSummary } = fileEntry; const testEntries: TestEntry[] = []; - this._processJsonSuite(fileSuite, fileId, projectSuite.project()!.name, projectSuite.project()!.metadata?.reportName, [], testEntries); + this._processJsonSuite(fileSuite, fileId, projectSuite.project()!.name, [], testEntries); for (const test of testEntries) { testFile.tests.push(test.testCase); testFileSummary.tests.push(test.testCaseSummary); @@ -341,13 +341,13 @@ class HtmlBuilder { this._dataZipFile.addBuffer(Buffer.from(JSON.stringify(data)), fileName); } - private _processJsonSuite(suite: Suite, fileId: string, projectName: string, botName: string | undefined, path: string[], outTests: TestEntry[]) { + private _processJsonSuite(suite: Suite, fileId: string, projectName: string, path: string[], outTests: TestEntry[]) { const newPath = [...path, suite.title]; - suite.suites.forEach(s => this._processJsonSuite(s, fileId, projectName, botName, newPath, outTests)); - suite.tests.forEach(t => outTests.push(this._createTestEntry(fileId, t, projectName, botName, newPath))); + suite.suites.forEach(s => this._processJsonSuite(s, fileId, projectName, newPath, outTests)); + suite.tests.forEach(t => outTests.push(this._createTestEntry(fileId, t, projectName, newPath))); } - private _createTestEntry(fileId: string, test: TestCasePublic, projectName: string, botName: string | undefined, path: string[]): TestEntry { + private _createTestEntry(fileId: string, test: TestCasePublic, projectName: string, path: string[]): TestEntry { const duration = test.results.reduce((a, r) => a + r.duration, 0); const location = this._relativeLocation(test.location)!; path = path.slice(1); @@ -363,7 +363,6 @@ class HtmlBuilder { testId, title: test.title, projectName, - botName, location, duration, // Annotations can be pushed directly, with a wrong type. @@ -378,7 +377,6 @@ class HtmlBuilder { testId, title: test.title, projectName, - botName, location, duration, // Annotations can be pushed directly, with a wrong type. diff --git a/packages/playwright/src/reporters/merge.ts b/packages/playwright/src/reporters/merge.ts index 096cc66c50..6a38396cbb 100644 --- a/packages/playwright/src/reporters/merge.ts +++ b/packages/playwright/src/reporters/merge.ts @@ -23,7 +23,7 @@ import { TeleReporterReceiver } from '../isomorphic/teleReceiver'; import { JsonStringInternalizer, StringInternPool } from '../isomorphic/stringInternPool'; import { createReporters } from '../runner/reporters'; import { Multiplexer } from './multiplexer'; -import { ZipFile, calculateSha1 } from 'playwright-core/lib/utils'; +import { ZipFile } from 'playwright-core/lib/utils'; import { currentBlobReportVersion, type BlobReportMetadata } from './blob'; import { relativeFilePath } from '../util'; import type { TestError } from '../../types/testReporter'; @@ -53,7 +53,7 @@ export async function createMergedReport(config: FullConfigInternal, dir: string const eventData = await mergeEvents(dir, shardFiles, stringPool, printStatus, rootDirOverride); // If expicit config is provided, use platform path separator, otherwise use the one from the report (if any). const pathSep = rootDirOverride ? path.sep : (eventData.pathSeparatorFromMetadata ?? path.sep); - const receiver = new TeleReporterReceiver(pathSep, multiplexer, false, config.config); + const receiver = new TeleReporterReceiver(pathSep, multiplexer, false, false, config.config); printStatus(`processing test events`); const dispatchEvents = async (events: JsonEvent[]) => { @@ -183,22 +183,15 @@ async function mergeEvents(dir: string, shardReportFiles: string[], stringPool: return a.file.localeCompare(b.file); }); - const saltSet = new Set(); - printStatus(`merging events`); const reports: ReportData[] = []; - for (const { file, parsedEvents, metadata, localPath } of blobs) { + for (let i = 0; i < blobs.length; ++i) { // Generate unique salt for each blob. - const sha1 = calculateSha1(metadata.name || path.basename(file)).substring(0, 16); - let salt = sha1; - for (let i = 0; saltSet.has(salt); i++) - salt = sha1 + '-' + i; - saltSet.add(salt); - + const { parsedEvents, metadata, localPath } = blobs[i]; const eventPatchers = new JsonEventPatchers(); - eventPatchers.patchers.push(new IdsPatcher(stringPool, metadata.name, salt)); + eventPatchers.patchers.push(new IdsPatcher(stringPool, metadata.name, String(i))); // Only patch path separators if we are merging reports with explicit config. if (rootDirOverride) eventPatchers.patchers.push(new PathSeparatorPatcher(metadata.pathSeparator)); @@ -354,10 +347,14 @@ class UniqueFileNameGenerator { } class IdsPatcher { - constructor( - private _stringPool: StringInternPool, - private _reportName: string | undefined, - private _salt: string) { + private _stringPool: StringInternPool; + private _botName: string | undefined; + private _salt: string; + + constructor(stringPool: StringInternPool, botName: string | undefined, salt: string) { + this._stringPool = stringPool; + this._botName = botName; + this._salt = salt; } patchEvent(event: JsonEvent) { @@ -380,13 +377,18 @@ class IdsPatcher { private _onProject(project: JsonProject) { project.metadata = project.metadata ?? {}; - project.metadata.reportName = this._reportName; - project.id = this._stringPool.internString(project.id + this._salt); + project.metadata.botName = this._botName; project.suites.forEach(suite => this._updateTestIds(suite)); } private _updateTestIds(suite: JsonSuite) { - suite.tests.forEach(test => test.testId = this._mapTestId(test.testId)); + suite.tests.forEach(test => { + test.testId = this._mapTestId(test.testId); + if (this._botName) { + test.tags = test.tags || []; + test.tags.unshift('@' + this._botName); + } + }); suite.suites.forEach(suite => this._updateTestIds(suite)); } diff --git a/packages/playwright/src/reporters/teleEmitter.ts b/packages/playwright/src/reporters/teleEmitter.ts index 44a9908300..96178bedf8 100644 --- a/packages/playwright/src/reporters/teleEmitter.ts +++ b/packages/playwright/src/reporters/teleEmitter.ts @@ -17,7 +17,6 @@ import path from 'path'; import { createGuid } from 'playwright-core/lib/utils'; import type { FullConfig, FullResult, Location, Suite, TestCase, TestError, TestResult, TestStep } from '../../types/testReporter'; -import { getProjectId } from '../common/config'; import type { JsonAttachment, JsonConfig, JsonEvent, JsonFullResult, JsonProject, JsonStdIOType, JsonSuite, JsonTestCase, JsonTestEnd, JsonTestResultEnd, JsonTestResultStart, JsonTestStepEnd, JsonTestStepStart } from '../isomorphic/teleReceiver'; import { serializeRegexPatterns } from '../isomorphic/teleReceiver'; import type { ReporterV2 } from './reporterV2'; @@ -158,7 +157,6 @@ export class TeleReporterEmitter implements ReporterV2 { private _serializeProject(suite: Suite): JsonProject { const project = suite.project()!; const report: JsonProject = { - id: getProjectId(project), metadata: project.metadata, name: project.name, outputDir: this._relativePath(project.outputDir), diff --git a/packages/playwright/src/runner/reporters.ts b/packages/playwright/src/runner/reporters.ts index 033356e1bd..666eb68e40 100644 --- a/packages/playwright/src/runner/reporters.ts +++ b/packages/playwright/src/runner/reporters.ts @@ -63,7 +63,7 @@ export async function createReporters(config: FullConfigInternal, mode: 'list' | } if (process.env.PW_TEST_REPORTER) { const reporterConstructor = await loadReporter(config, process.env.PW_TEST_REPORTER); - reporters.push(wrapReporterAsV2(new reporterConstructor(runOptions))); + reporters.push(wrapReporterAsV2(new reporterConstructor())); } const someReporterPrintsToStdio = reporters.some(r => r.printsToStdio()); diff --git a/packages/trace-viewer/src/ui/uiModeView.tsx b/packages/trace-viewer/src/ui/uiModeView.tsx index 89e05f5b48..acdcb141aa 100644 --- a/packages/trace-viewer/src/ui/uiModeView.tsx +++ b/packages/trace-viewer/src/ui/uiModeView.tsx @@ -654,7 +654,7 @@ const refreshRootSuite = (eraseResults: boolean): Promise => { lastRunTestCount = suite.allTests().length; lastRunReceiver = undefined; } - }, false); + }, true, false); }, onBegin: (suite: Suite) => { @@ -700,7 +700,7 @@ const refreshRootSuite = (eraseResults: boolean): Promise => { onExit: () => {}, onStepBegin: () => {}, onStepEnd: () => {}, - }, true); + }, true, true); receiver._setClearPreviousResultsWhenTestBegins(); return sendMessage('list', {}); }; diff --git a/tests/android/playwright.config.ts b/tests/android/playwright.config.ts index 9b41c9b755..0c0c7fbd3a 100644 --- a/tests/android/playwright.config.ts +++ b/tests/android/playwright.config.ts @@ -50,23 +50,23 @@ const metadata = { }; config.projects!.push({ - name: 'android', + name: 'android-native', use: { loopback: '10.0.2.2', browserName: 'chromium', }, - snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{ext}', + snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-android{ext}', testDir: path.join(testDir, 'android'), metadata, }); config.projects!.push({ - name: 'android', + name: 'android-page', use: { loopback: '10.0.2.2', browserName: 'chromium', }, - snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{ext}', + snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-android{ext}', testDir: path.join(testDir, 'page'), metadata, }); diff --git a/tests/electron/playwright.config.ts b/tests/electron/playwright.config.ts index 59931f33ec..4807a7f919 100644 --- a/tests/electron/playwright.config.ts +++ b/tests/electron/playwright.config.ts @@ -51,7 +51,7 @@ const metadata = { }; config.projects.push({ - name: 'electron', + name: 'electron-api', use: { browserName: 'chromium', coverageName: 'electron', @@ -61,7 +61,7 @@ config.projects.push({ }); config.projects.push({ - name: 'electron', + name: 'electron-page', // Share screenshots with chromium. snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-chromium{ext}', use: { diff --git a/tests/library/playwright.config.ts b/tests/library/playwright.config.ts index 771b8f2499..568bf6f8aa 100644 --- a/tests/library/playwright.config.ts +++ b/tests/library/playwright.config.ts @@ -109,10 +109,10 @@ for (const browserName of browserNames) { const testIgnore: RegExp[] = browserNames.filter(b => b !== browserName).map(b => new RegExp(b)); for (const folder of ['library', 'page']) { config.projects.push({ - name: browserName, + name: `${browserName}-${folder}`, testDir: path.join(testDir, folder), testIgnore, - snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{ext}', + snapshotPathTemplate: `{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-${browserName}{ext}`, use: { mode, browserName, diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.ts index 15c17743e4..6e18651af9 100644 --- a/tests/playwright-test/reporter-blob.spec.ts +++ b/tests/playwright-test/reporter-blob.spec.ts @@ -1205,9 +1205,9 @@ test('preserve reportName on projects', async ({ runInlineTest, mergeReports }) class EchoReporter { onBegin(config, suite) { - const projects = suite.suites.map(s => s.project()).sort((a, b) => a.metadata.reportName.localeCompare(b.metadata.reportName)); + const projects = suite.suites.map(s => s.project()).sort((a, b) => a.metadata.botName.localeCompare(b.metadata.botName)); console.log('projectNames: ' + projects.map(p => p.name)); - console.log('reportNames: ' + projects.map(p => p.metadata.reportName)); + console.log('botNames: ' + projects.map(p => p.metadata.botName)); } } module.exports = EchoReporter; @@ -1233,7 +1233,7 @@ test('preserve reportName on projects', async ({ runInlineTest, mergeReports }) 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(`reportNames: first,second`); + expect(output).toContain(`botNames: first,second`); }); test('no reports error', async ({ runInlineTest, mergeReports }) => {