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 unnecessary args in ttest (#21012)
Dmitry Gozman595502ac4669
diff --git a/tests/playwright-test/command-line-filter.spec.ts b/tests/playwright-test/command-line-filter.spec.tsindex 3d378545a8..8937694b39 100644--- a/tests/playwright-test/command-line-filter.spec.ts+++ b/tests/playwright-test/command-line-filter.spec.ts@@ -168,7 +168,6 @@ test('should focus a single nested test spec', async ({ runInlineTest }) => {expect(result.exitCode).toBe(0);expect(result.passed).toBe(2);expect(result.skipped).toBe(0);- console.log(JSON.stringify(result.report, null, 2));expect(result.report.suites[0].specs[0].title).toEqual('pass3');expect(result.report.suites[1].suites[0].suites[0].specs[0].title).toEqual('pass2');});diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.tsindex 7aab126272..af59afc84b 100644--- a/tests/playwright-test/playwright-test-fixtures.ts+++ b/tests/playwright-test/playwright-test-fixtures.ts@@ -86,11 +86,8 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], bparamList.push(params[key] === true ? `${k}` : `${k}=${value}`);}}- const outputDir = path.join(baseDir, 'test-results');- const reportFile = path.join(outputDir, 'report.json');+ const reportFile = path.join(baseDir, 'report.json');const args = ['test'];- if (!options.usesCustomReporters)- args.push('--reporter=dot,json');args.push('--workers=2',...paramList@@ -101,6 +98,7 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], bconst cwd = options.cwd ? path.resolve(baseDir, options.cwd) : baseDir;// eslint-disable-next-line prefer-constlet { exitCode, output } = await runPlaywrightCommand(childProcess, cwd, args, {+ PW_TEST_REPORTER: path.join(__dirname, '../../packages/playwright-test/lib/reporters/json.js'),PLAYWRIGHT_JSON_OUTPUT_NAME: reportFile,...env,}, options.sendSIGINTAfter);@@ -158,11 +156,7 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], b}function watchPlaywrightTest(childProcess: CommonFixtures['childProcess'], baseDir: string, env: NodeJS.ProcessEnv, options: RunOptions): TestChildProcess {- const paramList: string[] = [];- const outputDir = path.join(baseDir, 'test-results');- const args = ['test'];- args.push('--output=' + outputDir);- args.push('--workers=2', ...paramList);+ const args = ['test', '--workers=2'];if (options.additionalArgs)args.push(...options.additionalArgs);const cwd = options.cwd ? path.resolve(baseDir, options.cwd) : baseDir;@@ -224,7 +218,6 @@ function cleanEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {type RunOptions = {sendSIGINTAfter?: number;- usesCustomReporters?: boolean;additionalArgs?: string[];cwd?: string,};diff --git a/tests/playwright-test/playwright.artifacts.spec.ts b/tests/playwright-test/playwright.artifacts.spec.tsindex e72eb69613..8e42d7bf1b 100644--- a/tests/playwright-test/playwright.artifacts.spec.ts+++ b/tests/playwright-test/playwright.artifacts.spec.ts@@ -158,7 +158,6 @@ test('should work with screenshot: on', async ({ runInlineTest }, testInfo) => {'artifacts-two-contexts-failing',' test-failed-1.png',' test-failed-2.png',- 'report.json',]);});@@ -185,7 +184,6 @@ test('should work with screenshot: only-on-failure', async ({ runInlineTest }, t'artifacts-two-contexts-failing',' test-failed-1.png',' test-failed-2.png',- 'report.json',]);});@@ -210,7 +208,6 @@ test('should work with screenshot: only-on-failure & fullPage', async ({ runInliexpect(listFiles(testInfo.outputPath('test-results'))).toEqual(['artifacts-should-fail-and-take-fullPage-screenshots',' test-failed-1.png',- 'report.json',]);const screenshotFailure = fs.readFileSync(testInfo.outputPath('test-results', 'artifacts-should-fail-and-take-fullPage-screenshots', 'test-failed-1.png')@@ -252,7 +249,6 @@ test('should work with trace: on', async ({ runInlineTest }, testInfo) => {'artifacts-two-contexts-failing',' trace-1.zip',' trace.zip',- 'report.json',]);});@@ -279,7 +275,6 @@ test('should work with trace: retain-on-failure', async ({ runInlineTest }, test'artifacts-two-contexts-failing',' trace-1.zip',' trace.zip',- 'report.json',]);});@@ -306,7 +301,6 @@ test('should work with trace: on-first-retry', async ({ runInlineTest }, testInf'artifacts-two-contexts-failing-retry1',' trace-1.zip',' trace.zip',- 'report.json',]);});diff --git a/tests/playwright-test/playwright.fetch.spec.ts b/tests/playwright-test/playwright.fetch.spec.tsindex 8d26d78400..782ce9a950 100644--- a/tests/playwright-test/playwright.fetch.spec.ts+++ b/tests/playwright-test/playwright.fetch.spec.ts@@ -64,7 +64,7 @@ test('should stop tracing on requestContex.dispose()', async ({ runInlineTest, sconst result = await runInlineTest({'playwright.config.ts': `module.exports = {- reporter: 'html',+ reporter: [['html', { open: 'never' }]],use: {browserName: 'firefox',trace:'retain-on-failure'diff --git a/tests/playwright-test/reporter-dot.spec.ts b/tests/playwright-test/reporter-dot.spec.tsindex 5441400d35..5fd5d20c45 100644--- a/tests/playwright-test/reporter-dot.spec.ts+++ b/tests/playwright-test/reporter-dot.spec.ts@@ -25,7 +25,7 @@ test('render expected', async ({ runInlineTest }) => {expect(1).toBe(1);});`,- });+ }, { reporter: 'dot' });expect(result.rawOutput).toContain(colors.green('·'));expect(result.exitCode).toBe(0);});@@ -38,7 +38,7 @@ test('render unexpected', async ({ runInlineTest }) => {expect(1).toBe(0);});`,- });+ }, { reporter: 'dot' });expect(result.rawOutput).toContain(colors.red('F'));expect(result.exitCode).toBe(1);});@@ -51,7 +51,7 @@ test('render unexpected after retry', async ({ runInlineTest }) => {expect(1).toBe(0);});`,- }, { retries: 3 });+ }, { retries: 3, reporter: 'dot' });const text = result.output;expect(text).toContain('×××F');expect(result.rawOutput).toContain(colors.red('F'));@@ -66,7 +66,7 @@ test('render flaky', async ({ runInlineTest }) => {expect(testInfo.retry).toBe(3);});`,- }, { retries: 3 });+ }, { retries: 3, reporter: 'dot' });const text = result.output;expect(text).toContain('×××±');expect(result.rawOutput).toContain(colors.yellow('±'));@@ -86,7 +86,7 @@ test('should work from config', async ({ runInlineTest }) => {expect(1).toBe(1);});`,- });+ }, { reporter: 'dot' });expect(result.rawOutput).toContain(colors.green('·'));expect(result.exitCode).toBe(0);});@@ -99,7 +99,7 @@ test('render 243 tests in rows by 80', async ({ runInlineTest }) => {test('test' + i, () => {});}`,- });+ }, { reporter: 'dot' });expect(result.exitCode).toBe(0);expect(result.rawOutput).toContain(colors.green('·').repeat(80) + '\n' +diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.tsindex 5335e2588b..abdba6ef8f 100644--- a/tests/playwright-test/reporter-html.spec.ts+++ b/tests/playwright-test/reporter-html.spec.ts@@ -914,7 +914,7 @@ test('should report clashing folders', async ({ runInlineTest }) => {test('passes', async ({}) => {});`,- }, {}, {}, { usesCustomReporters: true });+ });expect(result.exitCode).toBe(0);const output = result.output;expect(output).toContain('Configuration Error');diff --git a/tests/playwright-test/retry.spec.ts b/tests/playwright-test/retry.spec.tsindex 6db15d75da..533720d40c 100644--- a/tests/playwright-test/retry.spec.ts+++ b/tests/playwright-test/retry.spec.ts@@ -123,7 +123,7 @@ test('should retry timeout', async ({ runInlineTest }) => {await new Promise(f => setTimeout(f, 10000));});`- }, { timeout: 1000, retries: 2 });+ }, { timeout: 1000, retries: 2, reporter: 'dot' });expect(exitCode).toBe(1);expect(passed).toBe(0);expect(failed).toBe(1);@@ -154,7 +154,7 @@ test('should retry unexpected pass', async ({ runInlineTest }) => {expect(1 + 1).toBe(2);});`- }, { retries: 2 });+ }, { retries: 2, reporter: 'dot' });expect(exitCode).toBe(1);expect(passed).toBe(0);expect(failed).toBe(1);@@ -174,7 +174,7 @@ test('should not retry expected failure', async ({ runInlineTest }) => {expect(1 + 1).toBe(2);});`- }, { retries: 2 });+ }, { retries: 2, reporter: 'dot' });expect(exitCode).toBe(0);expect(passed).toBe(2);expect(failed).toBe(0);@@ -192,7 +192,7 @@ test('should retry unhandled rejection', async ({ runInlineTest }) => {await new Promise(f => setTimeout(f, 2000));});`- }, { retries: 2 });+ }, { retries: 2, reporter: 'dot' });expect(result.exitCode).toBe(1);expect(result.passed).toBe(0);expect(result.failed).toBe(1);@@ -212,7 +212,7 @@ test('should retry beforeAll failure', async ({ runInlineTest }) => {test('another passing test', async () => {});`- }, { retries: 2 });+ }, { retries: 2, reporter: 'dot' });expect(result.exitCode).toBe(1);expect(result.passed).toBe(0);expect(result.failed).toBe(1);@@ -236,7 +236,7 @@ test('should retry worker fixture setup failure', async ({ runInlineTest }) => {test('passing test', async ({ worker }) => {});`- }, { retries: 2 });+ }, { retries: 2, reporter: 'dot' });expect(result.exitCode).toBe(1);expect(result.passed).toBe(0);expect(result.failed).toBe(1);diff --git a/tests/playwright-test/test-output-dir.spec.ts b/tests/playwright-test/test-output-dir.spec.tsindex fe59deadc4..07a5f5be15 100644--- a/tests/playwright-test/test-output-dir.spec.ts+++ b/tests/playwright-test/test-output-dir.spec.ts@@ -87,7 +87,7 @@ test('should default to package.json directory', async ({ runInlineTest }, testIconst result = await runInlineTest({'foo/package.json': `{ "name": "foo" }`,'foo/bar/playwright.config.js': `- module.exports = { projects: [ {} ] };+ module.exports = { reporters: [], projects: [ {} ] };`,'foo/bar/baz/tests/a.spec.js': `import { test, expect } from '@playwright/test';@@ -97,7 +97,7 @@ test('should default to package.json directory', async ({ runInlineTest }, testIfs.writeFileSync(testInfo.outputPath('foo.ts'), 'foobar');});`- }, { 'reporter': '' }, {}, {+ }, {}, { PW_TEST_REPORTER: '' }, {cwd: 'foo/bar/baz/tests',});expect(result.exitCode).toBe(0);