mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-13 17:14:02 +03:00
chore(test-runner): use test name as trace file name prefix (#9619)
This commit is contained in:
parent
13844a5b0a
commit
3c420a7cf1
@ -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;
|
||||
|
@ -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 }, test
|
||||
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-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 }, testInf
|
||||
expect(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', async
|
||||
expect(result.flaky).toBe(1);
|
||||
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
||||
'a-shared-flaky-retry1',
|
||||
' trace.zip',
|
||||
' trace-flaky.zip',
|
||||
'report.json',
|
||||
]);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user