Skip to content

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

fix(test runner): do not print config.tag at the end of each test (#38339)

Dmitry Gozmana41bab52b30b
diff --git a/packages/playwright/src/reporters/base.ts b/packages/playwright/src/reporters/base.ts
index c734322016..e3fde36e37 100644
--- a/packages/playwright/src/reporters/base.ts
+++ b/packages/playwright/src/reporters/base.ts
@@ -502,7 +502,7 @@ function formatTestTitle(screen: Screen, config: FullConfig, test: TestCase, ste
const projectLabel = options.includeTestId ? `project=` : '';
const projectTitle = projectName ? `[${projectLabel}${projectName}] › ` : '';
const testTitle = `${testId}${projectTitle}${location} › ${titles.join(' › ')}`;
- const extraTags = test.tags.filter(t => !testTitle.includes(t));
+ const extraTags = test.tags.filter(t => !testTitle.includes(t) && !config.tags.includes(t));
return `${testTitle}${stepSuffix(step)}${extraTags.length ? ' ' + extraTags.join(' ') : ''}`;
}
diff --git a/tests/playwright-test/reporter-line.spec.ts b/tests/playwright-test/reporter-line.spec.ts
index 6bb45340fd..cd6fc6a65c 100644
--- a/tests/playwright-test/reporter-line.spec.ts
+++ b/tests/playwright-test/reporter-line.spec.ts
@@ -207,5 +207,21 @@ for (const useIntermediateMergeReport of [false, true] as const) {
expect(text).toContain(`Error Context: ${path.join('test-results', 'a-one', 'error-context.md')}`);
expect(result.exitCode).toBe(1);
});
+
+ test('should not include global tag in the title', async ({ runInlineTest }) => {
+ const result = await runInlineTest({
+ 'playwright.config.ts': `
+ export default { tag: '@global' };
+ `,
+ 'a.test.ts': `
+ import { test, expect } from '@playwright/test';
+ test('passes', async ({}) => {
+ });
+ `,
+ }, { reporter: 'line' });
+ expect(result.output).toContain('[1/1] a.test.ts:3:15 › passes\n');
+ expect(result.output).not.toContain('@global');
+ expect(result.exitCode).toBe(0);
+ });
});
}