mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(blob): PLAYWRIGHT_BLOB_FILE_NAME env variable (#30530)
Reference https://github.com/microsoft/playwright/issues/30091
This commit is contained in:
parent
a2eb43b335
commit
b074932a44
@ -111,6 +111,8 @@ export class BlobReporter extends TeleReporterEmitter {
|
||||
private _computeReportName(config: FullConfig) {
|
||||
if (this._options.fileName)
|
||||
return this._options.fileName;
|
||||
if (process.env.PLAYWRIGHT_BLOB_FILE_NAME)
|
||||
return process.env.PLAYWRIGHT_BLOB_FILE_NAME;
|
||||
let reportName = 'report';
|
||||
if (config.shard) {
|
||||
const paddedNumber = `${config.shard.current}`.padStart(`${config.shard.total}`.length, '0');
|
||||
|
||||
@ -1198,6 +1198,33 @@ test('support fileName option', async ({ runInlineTest, mergeReports }) => {
|
||||
expect(reportFiles.sort()).toEqual(['report-one.zip', 'report-two.zip']);
|
||||
});
|
||||
|
||||
test('support PLAYWRIGHT_BLOB_FILE_NAME environment variable', async ({ runInlineTest, mergeReports }) => {
|
||||
const files = {
|
||||
'playwright.config.ts': `
|
||||
module.exports = {
|
||||
reporter: 'blob',
|
||||
projects: [
|
||||
{ name: 'foo' },
|
||||
]
|
||||
};
|
||||
`,
|
||||
'a.test.js': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('math 1 @smoke', async ({}) => {});
|
||||
`,
|
||||
'b.test.js': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('math 1 @smoke', async ({}) => {});
|
||||
`,
|
||||
};
|
||||
|
||||
await runInlineTest(files, { shard: `1/2` }, { PLAYWRIGHT_BLOB_FILE_NAME: 'report-one.zip' });
|
||||
await runInlineTest(files, { shard: `2/2` }, { PLAYWRIGHT_BLOB_FILE_NAME: 'report-two.zip', PWTEST_BLOB_DO_NOT_REMOVE: '1' });
|
||||
const reportDir = test.info().outputPath('blob-report');
|
||||
const reportFiles = await fs.promises.readdir(reportDir);
|
||||
expect(reportFiles.sort()).toEqual(['report-one.zip', 'report-two.zip']);
|
||||
});
|
||||
|
||||
test('keep projects with same name different bot name separate', async ({ runInlineTest, mergeReports, showReport, page }) => {
|
||||
const files = (reportName: string) => ({
|
||||
'playwright.config.ts': `
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user