Skip to content

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

chore: delete --attachments option from merge-reports command (#24350)

Yury Semikhatsky6a3721eb9c51
diff --git a/packages/playwright-test/src/cli.ts b/packages/playwright-test/src/cli.ts
index b03f369d96..6345dd0f5e 100644
--- a/packages/playwright-test/src/cli.ts
+++ b/packages/playwright-test/src/cli.ts
@@ -88,8 +88,6 @@ Examples:
$ npx playwright show-report playwright-report`);
}
-const kAttachmentModes: string[] = ['local', 'missing'];
-
function addMergeReportsCommand(program: Command) {
const command = program.command('merge-reports [dir]', { hidden: true });
command.description('merge multiple blob reports (for sharded tests) into a single report');
@@ -103,7 +101,6 @@ function addMergeReportsCommand(program: Command) {
});
command.option('-c, --config <file>', `Configuration file. Can be used to specify additional configuration for the output report.`);
command.option('--reporter <reporter>', `Reporter to use, comma-separated, can be ${builtInReporters.map(name => `"${name}"`).join(', ')} (default: "${defaultReporter}")`);
- command.option('--attachments <mode>', `Whether the attachments are available locally. Supported values are ${kAttachmentModes.map(name => `"${name}"`).join(', ')} (default: "local")`);
command.addHelpText('afterAll', `
Arguments [dir]:
Directory containing blob reports.
@@ -200,12 +197,7 @@ async function mergeReports(reportDir: string | undefined, opts: { [key: string]
reporterDescriptions = config.config.reporter;
if (!reporterDescriptions)
reporterDescriptions = [[defaultReporter]];
- if (opts.attachments) {
- if (!kAttachmentModes.includes(opts.attachments))
- throw new Error(`Invalid --attachments value "${opts.attachments}", must be one of ${kAttachmentModes.map(name => `"${name}"`).join(', ')}.`);
- }
- const resolveAttachmentPaths = opts.attachments !== 'missing';
- await createMergedReport(config, dir, reporterDescriptions!, resolveAttachmentPaths);
+ await createMergedReport(config, dir, reporterDescriptions!);
}
function overridesFromOptions(options: { [key: string]: any }): ConfigCLIOverrides {
diff --git a/packages/playwright-test/src/reporters/merge.ts b/packages/playwright-test/src/reporters/merge.ts
index 4b28fcc301..900dfc7100 100644
--- a/packages/playwright-test/src/reporters/merge.ts
+++ b/packages/playwright-test/src/reporters/merge.ts
@@ -26,13 +26,12 @@ import { Multiplexer } from './multiplexer';
import { ZipFile } from 'playwright-core/lib/utils';
import type { BlobReportMetadata } from './blob';
-export async function createMergedReport(config: FullConfigInternal, dir: string, reporterDescriptions: ReporterDescription[], resolvePaths: boolean) {
+export async function createMergedReport(config: FullConfigInternal, dir: string, reporterDescriptions: ReporterDescription[]) {
const shardFiles = await sortedShardFiles(dir);
if (shardFiles.length === 0)
throw new Error(`No report files found in ${dir}`);
const events = await mergeEvents(dir, shardFiles);
- if (resolvePaths)
- patchAttachmentPaths(events, dir);
+ patchAttachmentPaths(events, dir);
const reporters = await createReporters(config, 'merge', reporterDescriptions);
const receiver = new TeleReporterReceiver(path.sep, new Multiplexer(reporters), false, config.config);
diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.ts
index 9aefabd6f4..bb2c33cede 100644
--- a/tests/playwright-test/reporter-blob.spec.ts
+++ b/tests/playwright-test/reporter-blob.spec.ts
@@ -495,7 +495,7 @@ test('generate html with attachment urls', async ({ runInlineTest, mergeReports,
const reportFiles = await fs.promises.readdir(reportDir);
reportFiles.sort();
expect(reportFiles).toEqual([expect.stringMatching(/report-.*.zip/), 'resources']);
- const { exitCode } = await mergeReports(reportDir, { 'PW_TEST_HTML_REPORT_OPEN': 'never' }, { additionalArgs: ['--reporter', 'html', '--attachments', 'missing'] });
+ const { exitCode } = await mergeReports(reportDir, { 'PW_TEST_HTML_REPORT_OPEN': 'never' }, { additionalArgs: ['--reporter', 'html'] });
expect(exitCode).toBe(0);
const htmlReportDir = test.info().outputPath('playwright-report');