mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-07 11:46:42 +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 { createGuid, removeFolders } from 'playwright-core/lib/utils/utils';
|
||||||
import { GridClient } from 'playwright-core/lib/grid/gridClient';
|
import { GridClient } from 'playwright-core/lib/grid/gridClient';
|
||||||
import { Browser } from 'playwright-core';
|
import { Browser } from 'playwright-core';
|
||||||
|
import { sanitizeForFilePath } from './util';
|
||||||
export { expect } from './expect';
|
export { expect } from './expect';
|
||||||
export const _baseTest: TestType<{}, {}> = rootTestType.test;
|
export const _baseTest: TestType<{}, {}> = rootTestType.test;
|
||||||
|
|
||||||
@ -254,7 +255,7 @@ export const test = _baseTest.extend<TestFixtures, WorkerAndFileFixtures>({
|
|||||||
|
|
||||||
const traceAttachments: string[] = [];
|
const traceAttachments: string[] = [];
|
||||||
const addTraceAttachment = () => {
|
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);
|
traceAttachments.push(tracePath);
|
||||||
testInfo.attachments.push({ name: 'trace', path: tracePath, contentType: 'application/zip' });
|
testInfo.attachments.push({ name: 'trace', path: tracePath, contentType: 'application/zip' });
|
||||||
return tracePath;
|
return tracePath;
|
||||||
|
@ -199,27 +199,27 @@ test('should work with trace: on', async ({ runInlineTest }, testInfo) => {
|
|||||||
expect(result.failed).toBe(5);
|
expect(result.failed).toBe(5);
|
||||||
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
||||||
'artifacts-failing',
|
'artifacts-failing',
|
||||||
' trace.zip',
|
' trace-failing.zip',
|
||||||
'artifacts-own-context-failing',
|
'artifacts-own-context-failing',
|
||||||
' trace.zip',
|
' trace-own-context-failing.zip',
|
||||||
'artifacts-own-context-passing',
|
'artifacts-own-context-passing',
|
||||||
' trace.zip',
|
' trace-own-context-passing.zip',
|
||||||
'artifacts-passing',
|
'artifacts-passing',
|
||||||
' trace.zip',
|
' trace-passing.zip',
|
||||||
'artifacts-persistent-failing',
|
'artifacts-persistent-failing',
|
||||||
' trace.zip',
|
' trace-persistent-failing.zip',
|
||||||
'artifacts-persistent-passing',
|
'artifacts-persistent-passing',
|
||||||
' trace.zip',
|
' trace-persistent-passing.zip',
|
||||||
'artifacts-shared-shared-failing',
|
'artifacts-shared-shared-failing',
|
||||||
' trace.zip',
|
' trace-shared-failing.zip',
|
||||||
'artifacts-shared-shared-passing',
|
'artifacts-shared-shared-passing',
|
||||||
' trace.zip',
|
' trace-shared-passing.zip',
|
||||||
'artifacts-two-contexts',
|
'artifacts-two-contexts',
|
||||||
' trace-1.zip',
|
' trace-two-contexts-1.zip',
|
||||||
' trace.zip',
|
' trace-two-contexts.zip',
|
||||||
'artifacts-two-contexts-failing',
|
'artifacts-two-contexts-failing',
|
||||||
' trace-1.zip',
|
' trace-two-contexts-failing-1.zip',
|
||||||
' trace.zip',
|
' trace-two-contexts-failing.zip',
|
||||||
'report.json',
|
'report.json',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
@ -237,16 +237,16 @@ test('should work with trace: retain-on-failure', async ({ runInlineTest }, test
|
|||||||
expect(result.failed).toBe(5);
|
expect(result.failed).toBe(5);
|
||||||
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
||||||
'artifacts-failing',
|
'artifacts-failing',
|
||||||
' trace.zip',
|
' trace-failing.zip',
|
||||||
'artifacts-own-context-failing',
|
'artifacts-own-context-failing',
|
||||||
' trace.zip',
|
' trace-own-context-failing.zip',
|
||||||
'artifacts-persistent-failing',
|
'artifacts-persistent-failing',
|
||||||
' trace.zip',
|
' trace-persistent-failing.zip',
|
||||||
'artifacts-shared-shared-failing',
|
'artifacts-shared-shared-failing',
|
||||||
' trace.zip',
|
' trace-shared-failing.zip',
|
||||||
'artifacts-two-contexts-failing',
|
'artifacts-two-contexts-failing',
|
||||||
' trace-1.zip',
|
' trace-two-contexts-failing-1.zip',
|
||||||
' trace.zip',
|
' trace-two-contexts-failing.zip',
|
||||||
'report.json',
|
'report.json',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
@ -264,16 +264,16 @@ test('should work with trace: on-first-retry', async ({ runInlineTest }, testInf
|
|||||||
expect(result.failed).toBe(5);
|
expect(result.failed).toBe(5);
|
||||||
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
||||||
'artifacts-failing-retry1',
|
'artifacts-failing-retry1',
|
||||||
' trace.zip',
|
' trace-failing.zip',
|
||||||
'artifacts-own-context-failing-retry1',
|
'artifacts-own-context-failing-retry1',
|
||||||
' trace.zip',
|
' trace-own-context-failing.zip',
|
||||||
'artifacts-persistent-failing-retry1',
|
'artifacts-persistent-failing-retry1',
|
||||||
' trace.zip',
|
' trace-persistent-failing.zip',
|
||||||
'artifacts-shared-shared-failing-retry1',
|
'artifacts-shared-shared-failing-retry1',
|
||||||
' trace.zip',
|
' trace-shared-failing.zip',
|
||||||
'artifacts-two-contexts-failing-retry1',
|
'artifacts-two-contexts-failing-retry1',
|
||||||
' trace-1.zip',
|
' trace-two-contexts-failing-1.zip',
|
||||||
' trace.zip',
|
' trace-two-contexts-failing.zip',
|
||||||
'report.json',
|
'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(result.flaky).toBe(1);
|
||||||
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
expect(listFiles(testInfo.outputPath('test-results'))).toEqual([
|
||||||
'a-shared-flaky-retry1',
|
'a-shared-flaky-retry1',
|
||||||
' trace.zip',
|
' trace-flaky.zip',
|
||||||
'report.json',
|
'report.json',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user