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(test-runner): use test name as trace file name prefix (#9619)
Max Schmitt3c420a7cf135
diff --git a/packages/playwright-test/src/index.ts b/packages/playwright-test/src/index.tsindex 5df6b9cb2a..df32bb7d3d 100644--- a/packages/playwright-test/src/index.ts+++ b/packages/playwright-test/src/index.ts@@ -22,6 +22,7 @@ import { rootTestType } from './testType';import { createGuid, removeFolders } from 'playwright-core/lib/utils/utils';import { GridClient } from 'playwright-core/lib/grid/gridClient';import { Browser } from 'playwright-core';+import { sanitizeForFilePath } from './util';export { expect } from './expect';export const _baseTest: TestType<{}, {}> = rootTestType.test;@@ -254,7 +255,7 @@ export const test = _baseTest.extend<TestFixtures, WorkerAndFileFixtures>({const traceAttachments: string[] = [];const addTraceAttachment = () => {- const tracePath = testInfo.outputPath(`trace${traceAttachments.length ? '-' + traceAttachments.length : ''}.zip`);+ const tracePath = testInfo.outputPath(`trace-${sanitizeForFilePath(testInfo.title)}${traceAttachments.length ? '-' + traceAttachments.length : ''}.zip`);traceAttachments.push(tracePath);testInfo.attachments.push({ name: 'trace', path: tracePath, contentType: 'application/zip' });return tracePath;diff --git a/tests/playwright-test/playwright.artifacts.spec.ts b/tests/playwright-test/playwright.artifacts.spec.tsindex ccf39751ff..d2f80dc90e 100644--- a/tests/playwright-test/playwright.artifacts.spec.ts+++ b/tests/playwright-test/playwright.artifacts.spec.ts@@ -199,27 +199,27 @@ test('should work with trace: on', async ({ runInlineTest }, testInfo) => {expect(result.failed).toBe(5);expect(listFiles(testInfo.outputPath('test-results'))).toEqual(['artifacts-failing',- ' trace.zip',+ ' trace-failing.zip','artifacts-own-context-failing',- ' trace.zip',+ ' trace-own-context-failing.zip','artifacts-own-context-passing',- ' trace.zip',+ ' trace-own-context-passing.zip','artifacts-passing',- ' trace.zip',+ ' trace-passing.zip','artifacts-persistent-failing',- ' trace.zip',+ ' trace-persistent-failing.zip','artifacts-persistent-passing',- ' trace.zip',+ ' trace-persistent-passing.zip','artifacts-shared-shared-failing',- ' trace.zip',+ ' trace-shared-failing.zip','artifacts-shared-shared-passing',- ' trace.zip',+ ' trace-shared-passing.zip','artifacts-two-contexts',- ' trace-1.zip',- ' trace.zip',+ ' trace-two-contexts-1.zip',+ ' trace-two-contexts.zip','artifacts-two-contexts-failing',- ' trace-1.zip',- ' trace.zip',+ ' trace-two-contexts-failing-1.zip',+ ' trace-two-contexts-failing.zip','report.json',]);});@@ -237,16 +237,16 @@ test('should work with trace: retain-on-failure', async ({ runInlineTest }, testexpect(result.failed).toBe(5);expect(listFiles(testInfo.outputPath('test-results'))).toEqual(['artifacts-failing',- ' trace.zip',+ ' trace-failing.zip','artifacts-own-context-failing',- ' trace.zip',+ ' trace-own-context-failing.zip','artifacts-persistent-failing',- ' trace.zip',+ ' trace-persistent-failing.zip','artifacts-shared-shared-failing',- ' trace.zip',+ ' trace-shared-failing.zip','artifacts-two-contexts-failing',- ' trace-1.zip',- ' trace.zip',+ ' trace-two-contexts-failing-1.zip',+ ' trace-two-contexts-failing.zip','report.json',]);});@@ -264,16 +264,16 @@ test('should work with trace: on-first-retry', async ({ runInlineTest }, testInfexpect(result.failed).toBe(5);expect(listFiles(testInfo.outputPath('test-results'))).toEqual(['artifacts-failing-retry1',- ' trace.zip',+ ' trace-failing.zip','artifacts-own-context-failing-retry1',- ' trace.zip',+ ' trace-own-context-failing.zip','artifacts-persistent-failing-retry1',- ' trace.zip',+ ' trace-persistent-failing.zip','artifacts-shared-shared-failing-retry1',- ' trace.zip',+ ' trace-shared-failing.zip','artifacts-two-contexts-failing-retry1',- ' trace-1.zip',- ' trace.zip',+ ' trace-two-contexts-failing-1.zip',+ ' trace-two-contexts-failing.zip','report.json',]);});@@ -313,7 +313,7 @@ test('should stop tracing with trace: on-first-retry, when not retrying', asyncexpect(result.flaky).toBe(1);expect(listFiles(testInfo.outputPath('test-results'))).toEqual(['a-shared-flaky-retry1',- ' trace.zip',+ ' trace-flaky.zip','report.json',]);});