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: dedupe tags in base reporter title (#33461)
Pavel Feldman9d94ad152e56
diff --git a/packages/playwright/src/reporters/base.ts b/packages/playwright/src/reporters/base.tsindex 3e452d6c44..9317e4e1bc 100644--- a/packages/playwright/src/reporters/base.ts+++ b/packages/playwright/src/reporters/base.ts@@ -383,8 +383,9 @@ export function formatTestTitle(config: FullConfig, test: TestCase, step?: TestSelselocation = `${relativeTestPath(config, test)}:${step?.location?.line ?? test.location.line}:${step?.location?.column ?? test.location.column}`;const projectTitle = projectName ? `[${projectName}] › ` : '';- const tags = test.tags.length > 0 ? ` ${test.tags.join(' ')}` : '';- return `${projectTitle}${location} › ${titles.join(' › ')}${stepSuffix(step)}${tags}`;+ const testTitle = `${projectTitle}${location} › ${titles.join(' › ')}`;+ const extraTags = test.tags.filter(t => !testTitle.includes(t));+ return `${testTitle}${stepSuffix(step)}${extraTags.length ? ' ' + extraTags.join(' ') : ''}`;}export function formatTestHeader(config: FullConfig, test: TestCase, options: { indent?: string, index?: number, mode?: 'default' | 'error' } = {}): string {diff --git a/tests/playwright-test/reporter-base.spec.ts b/tests/playwright-test/reporter-base.spec.tsindex 780739eb83..3e398f9160 100644--- a/tests/playwright-test/reporter-base.spec.ts+++ b/tests/playwright-test/reporter-base.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test, expect } from './playwright-test-fixtures';+import { test, expect, stripAnsi } from './playwright-test-fixtures';import * as path from 'path';for (const useIntermediateMergeReport of [false, true] as const) {@@ -470,14 +470,21 @@ for (const useIntermediateMergeReport of [false, true] as const) {const result = await runInlineTest({'a.test.ts': `const { test, expect } = require('@playwright/test');- test('passes', { tag: ['@foo', '@bar'] }, async ({}) => {+ test('passes', { tag: ['@foo1', '@foo2'] }, async ({}) => {+ expect(0).toBe(0);+ });+ test('passes @bar1 @bar2', async ({}) => {+ expect(0).toBe(0);+ });+ test('passes @baz1', { tag: ['@baz2'] }, async ({}) => {expect(0).toBe(0);});`,});- const text = result.output;-- expect(text).toContain('passes @foo @bar');+ const text = stripAnsi(result.output);+ expect(text).toContain('› passes @foo1 @foo2 (');+ expect(text).toContain('› passes @bar1 @bar2 (');+ expect(text).toContain('› passes @baz1 @baz2 (');});});}