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: remove usesCustomOutputDir from tests (#21011)
Dmitry Gozman56dbd1fcb004
diff --git a/tests/playwright-test/list-mode.spec.ts b/tests/playwright-test/list-mode.spec.tsindex 4244993b01..fbc90bcecb 100644--- a/tests/playwright-test/list-mode.spec.ts+++ b/tests/playwright-test/list-mode.spec.ts@@ -122,7 +122,7 @@ test('outputDir should not be removed', async ({ runInlineTest }, testInfo) => {require('fs').writeFileSync(testInfo.outputPath('myfile.txt'), 'hello');});`,- }, {}, {}, { usesCustomOutputDir: true });+ });expect(result1.exitCode).toBe(0);expect(fs.existsSync(path.join(outputDir, 'a-my-test', 'myfile.txt'))).toBe(true);@@ -136,7 +136,7 @@ test('outputDir should not be removed', async ({ runInlineTest }, testInfo) => {console.log(testInfo.outputDir);});`,- }, { list: true }, {}, { usesCustomOutputDir: true });+ }, { list: true });expect(result2.exitCode).toBe(0);expect(fs.existsSync(path.join(outputDir, 'a-my-test', 'myfile.txt'))).toBe(true);});diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.tsindex 507e707667..7aab126272 100644--- a/tests/playwright-test/playwright-test-fixtures.ts+++ b/tests/playwright-test/playwright-test-fixtures.ts@@ -89,8 +89,6 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], bconst outputDir = path.join(baseDir, 'test-results');const reportFile = path.join(outputDir, 'report.json');const args = ['test'];- if (!options.usesCustomOutputDir)- args.push('--output=' + outputDir);if (!options.usesCustomReporters)args.push('--reporter=dot,json');args.push(@@ -226,7 +224,6 @@ function cleanEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {type RunOptions = {sendSIGINTAfter?: number;- usesCustomOutputDir?: boolean;usesCustomReporters?: boolean;additionalArgs?: string[];cwd?: string,diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.tsindex 564c28c76e..5335e2588b 100644--- a/tests/playwright-test/reporter-html.spec.ts+++ b/tests/playwright-test/reporter-html.spec.ts@@ -953,7 +953,6 @@ test.describe('report location', () => {`}, { 'reporter': 'html' }, { PW_TEST_HTML_REPORT_OPEN: 'never' }, {cwd: 'foo/bar/baz/tests',- usesCustomOutputDir: true});expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);@@ -978,7 +977,6 @@ test.describe('report location', () => {`}, { 'reporter': 'html' }, { 'PW_TEST_HTML_REPORT_OPEN': 'never', 'PLAYWRIGHT_HTML_REPORT': '../my-report' }, {cwd: 'foo/bar/baz/tests',- usesCustomOutputDir: true});expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);diff --git a/tests/playwright-test/reporter-json.spec.ts b/tests/playwright-test/reporter-json.spec.tsindex 9494017b95..b8775cf669 100644--- a/tests/playwright-test/reporter-json.spec.ts+++ b/tests/playwright-test/reporter-json.spec.ts@@ -287,7 +287,6 @@ test.describe('report location', () => {`}, { 'reporter': 'json' }, { 'PW_TEST_HTML_REPORT_OPEN': 'never', 'PLAYWRIGHT_JSON_OUTPUT_NAME': '../my-report.json' }, {cwd: 'foo/bar/baz/tests',- usesCustomOutputDir: true});expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);diff --git a/tests/playwright-test/reporter-junit.spec.ts b/tests/playwright-test/reporter-junit.spec.tsindex 479a2bfd64..b7e227bf8b 100644--- a/tests/playwright-test/reporter-junit.spec.ts+++ b/tests/playwright-test/reporter-junit.spec.ts@@ -480,7 +480,6 @@ test.describe('report location', () => {`}, { 'reporter': 'junit' }, { 'PLAYWRIGHT_JUNIT_OUTPUT_NAME': '../my-report.xml' }, {cwd: 'foo/bar/baz/tests',- usesCustomOutputDir: true});expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);diff --git a/tests/playwright-test/reporter-raw.spec.ts b/tests/playwright-test/reporter-raw.spec.tsindex 8bd6100d8b..9b38d96db7 100644--- a/tests/playwright-test/reporter-raw.spec.ts+++ b/tests/playwright-test/reporter-raw.spec.ts@@ -26,7 +26,7 @@ test('should generate raw report', async ({ runInlineTest }, testInfo) => {import { test, expect } from '@playwright/test';test('passes', async ({ page }, testInfo) => {});`,- }, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });+ }, { reporter: 'dot,' + kRawReporterPath });const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));expect(json.config).toBeTruthy();expect(json.project).toBeTruthy();@@ -47,7 +47,7 @@ test('should use project name', async ({ runInlineTest }, testInfo) => {import { test, expect } from '@playwright/test';test('passes', async ({ page }, testInfo) => {});`,- }, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });+ }, { reporter: 'dot,' + kRawReporterPath });const json = JSON.parse(fs.readFileSync(testInfo.outputPath('output', 'report', 'project-name.report'), 'utf-8'));expect(json.project.name).toBe('project-name');expect(result.exitCode).toBe(0);@@ -64,7 +64,7 @@ test('should save stdio', async ({ runInlineTest }, testInfo) => {process.stderr.write(Buffer.from([4, 5, 6]));});`,- }, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });+ }, { reporter: 'dot,' + kRawReporterPath });const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));const result = json.suites[0].tests[0].results[0];expect(result.attachments).toEqual([@@ -100,7 +100,7 @@ test('should save attachments', async ({ runInlineTest }, testInfo) => {});});`,- }, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });+ }, { reporter: 'dot,' + kRawReporterPath });const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));const result = json.suites[0].tests[0].results[0];expect(result.attachments[0].name).toBe('binary');@@ -148,7 +148,7 @@ test(`testInfo.attach should save attachments via path`, async ({ runInlineTestawait fs.promises.unlink(tmpPath);});`,- }, { reporter: 'dot,' + kRawReporterPath, workers: 1 }, {}, { usesCustomOutputDir: true });+ }, { reporter: 'dot,' + kRawReporterPath, workers: 1 });const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));{const result = json.suites[0].tests[0].results[0];@@ -210,7 +210,7 @@ test(`testInfo.attach should save attachments via inline attachment`, async ({ rawait testInfo.attach('example.json', { body: Buffer.from('We <3 Playwright!'), contentType: 'x-playwright/custom' });});`,- }, { reporter: 'dot,' + kRawReporterPath, workers: 1 }, {}, { usesCustomOutputDir: true });+ }, { reporter: 'dot,' + kRawReporterPath, workers: 1 });const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));{const result = json.suites[0].tests[0].results[0];@@ -253,7 +253,7 @@ test('dupe project names', async ({ runInlineTest }, testInfo) => {import { test, expect } from '@playwright/test';test('passes', async ({ page }, testInfo) => {});`,- }, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });+ }, { reporter: 'dot,' + kRawReporterPath });const files = fs.readdirSync(testInfo.outputPath('test-results', 'report'));expect(new Set(files)).toEqual(new Set(['project-name.report', 'project-name-1.report', 'project-name-2.report']));});diff --git a/tests/playwright-test/test-output-dir.spec.ts b/tests/playwright-test/test-output-dir.spec.tsindex 8b69dca269..fe59deadc4 100644--- a/tests/playwright-test/test-output-dir.spec.ts+++ b/tests/playwright-test/test-output-dir.spec.ts@@ -99,7 +99,6 @@ test('should default to package.json directory', async ({ runInlineTest }, testI`}, { 'reporter': '' }, {}, {cwd: 'foo/bar/baz/tests',- usesCustomOutputDir: true});expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);@@ -364,7 +363,7 @@ test('should accept a relative path for outputDir', async ({ runInlineTest }, te{ outputDir: './my-output-dir' },] };`,- }, {}, {}, { usesCustomOutputDir: true });+ });expect(result.exitCode).toBe(0);});@@ -383,7 +382,7 @@ test('should have output dir based on rootDir (cwd)', async ({ runInlineTest },fs.writeFileSync(testInfo.outputPath('foo.txt'), 'hello');});`,- }, {}, {}, { usesCustomOutputDir: true });+ });expect(result.exitCode).toBe(0);expect(fs.existsSync(testInfo.outputPath('test-results', 'example-hello-world', 'foo.txt'))).toBe(true);});