diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index 4398002bb8..0a91d71dbe 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -56,7 +56,6 @@ export class FullConfigInternal { cliProjectFilter?: string[]; cliListOnly = false; cliPassWithNoTests?: boolean; - cliFailOnFlakyTests?: boolean; cliLastFailed?: boolean; testIdMatcher?: Matcher; lastFailedTestIdMatcher?: Matcher; diff --git a/packages/playwright/src/runner/failureTracker.ts b/packages/playwright/src/runner/failureTracker.ts index 1c274929b1..afc4548a66 100644 --- a/packages/playwright/src/runner/failureTracker.ts +++ b/packages/playwright/src/runner/failureTracker.ts @@ -49,7 +49,7 @@ export class FailureTracker { } result(): 'failed' | 'passed' { - return this._hasWorkerErrors || this.hasReachedMaxFailures() || this.hasFailedTests() || (this.failOnFlakyTests() && this.hasFlakyTests()) ? 'failed' : 'passed'; + return this._hasWorkerErrors || this.hasReachedMaxFailures() || this.hasFailedTests() || (this._config.config.failOnFlakyTests && this.hasFlakyTests()) ? 'failed' : 'passed'; } hasFailedTests() { @@ -64,7 +64,4 @@ export class FailureTracker { return this._config.config.maxFailures; } - failOnFlakyTests() { - return this._config.config.failOnFlakyTests || this._config.cliFailOnFlakyTests; - } } diff --git a/tests/playwright-test/config.spec.ts b/tests/playwright-test/config.spec.ts index a2de239de9..04cafe16ea 100644 --- a/tests/playwright-test/config.spec.ts +++ b/tests/playwright-test/config.spec.ts @@ -72,37 +72,6 @@ test('should prioritize command line timeout over project timeout', async ({ run expect(result.output).toContain('Test timeout of 500ms exceeded.'); }); -test('should default to failOnFlakyTests false', async ({ runInlineTest }) => { - const result = await runInlineTest({ - 'a.test.js': ` - import { test, expect } from '@playwright/test'; - test('flake', async ({}, testInfo) => { - expect(testInfo.retry).toBe(1); - }); - `, - }); - expect(result.exitCode).not.toBe(0); - expect(result.flaky).toBe(0); -}); - -test('should prioritize command line --fail-on-flaky-tests flag over config failOnFlakyTests', async ({ runInlineTest }) => { - const result = await runInlineTest({ - 'playwright.config.ts': ` - module.exports = { - failOnFlakyTests: false - }; - `, - 'a.test.js': ` - import { test, expect } from '@playwright/test'; - test('flake', async ({}, testInfo) => { - expect(testInfo.retry).toBe(1); - }); - `, - }, { 'retries': 1, 'fail-on-flaky-tests': true }); - expect(result.exitCode).not.toBe(0); - expect(result.flaky).toBe(1); -}); - test('should support failOnFlakyTests config option', async ({ runInlineTest }) => { const result = await runInlineTest({ 'playwright.config.ts': ` @@ -122,42 +91,6 @@ test('should support failOnFlakyTests config option', async ({ runInlineTest }) expect(result.flaky).toBe(1); }); -test('should support failOnFlakyTests config option + retries CLI flag', async ({ runInlineTest }) => { - const result = await runInlineTest({ - 'playwright.config.ts': ` - module.exports = { - failOnFlakyTests: true, - }; - `, - 'a.test.js': ` - import { test, expect } from '@playwright/test'; - test('flake', async ({}, testInfo) => { - expect(testInfo.retry).toBe(1); - }); - `, - }, { 'retries': 1 }); - expect(result.exitCode).not.toBe(0); - expect(result.flaky).toBe(1); -}); - -test('should support fail-on-flaky-tests CLI flag + retries config option', async ({ runInlineTest }) => { - const result = await runInlineTest({ - 'playwright.config.ts': ` - module.exports = { - retries: 1, - }; - `, - 'a.test.js': ` - import { test, expect } from '@playwright/test'; - test('flake', async ({}, testInfo) => { - expect(testInfo.retry).toBe(1); - }); - `, - }, { 'fail-on-flaky-tests': true }); - expect(result.exitCode).not.toBe(0); - expect(result.flaky).toBe(1); -}); - test('should read config from --config, resolve relative testDir', async ({ runInlineTest }) => { const result = await runInlineTest({ 'my.config.ts': `