-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add sanity system tests to verify console reporter output for …
…experimental retries logic
- Loading branch information
1 parent
264ce82
commit cfd69a0
Showing
6 changed files
with
737 additions
and
0 deletions.
There are no files selected for viewing
511 changes: 511 additions & 0 deletions
511
system-tests/__snapshots__/experimental_retries.spec.ts.js
Large diffs are not rendered by default.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
system-tests/projects/experimental-retries/cypress.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
e2e: { | ||
supportFile: false, | ||
setupNodeEvents (on, config) { | ||
// in the case the tests needed to be debugged: | ||
|
||
// on('before:browser:launch', (browser, launchOptions) => { | ||
// launchOptions.args.push('--auto-open-devtools-for-tabs') | ||
|
||
// return launchOptions | ||
// }) | ||
}, | ||
}, | ||
} |
5 changes: 5 additions & 0 deletions
5
system-tests/projects/experimental-retries/cypress/e2e/tests/always-fails.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe('always fails', () => { | ||
it('always fails', function () { | ||
expect(true).to.be.false | ||
}) | ||
}) |
5 changes: 5 additions & 0 deletions
5
system-tests/projects/experimental-retries/cypress/e2e/tests/always-passes.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe('always passes', () => { | ||
it('always passes', function () { | ||
expect(true).to.be.true | ||
}) | ||
}) |
15 changes: 15 additions & 0 deletions
15
system-tests/projects/experimental-retries/cypress/e2e/tests/deterministic-flaky.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
describe('deterministic flaky test', () => { | ||
it('deterministically runs pass/fail on this test', function () { | ||
// this means the test WILL behave as | ||
// first attempt (FAIL) | ||
// second attempt (PASS) | ||
// third attempt (FAIL) | ||
// fourth attempt (PASS) | ||
// fifth attempt (FAIL)... | ||
if (this.test.currentRetry() % 2) { | ||
expect(true).to.be.true | ||
} else { | ||
expect(true).to.be.false | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
import systemTests from '../lib/system-tests' | ||
|
||
describe('e2e retries.experimentalStrategy', () => { | ||
systemTests.setup() | ||
|
||
describe('experimentalBurnIn=false', () => { | ||
describe('"detect-flake-and-pass-on-threshold"', () => { | ||
describe('passes', () => { | ||
systemTests.it('only runs the first attempt of the test if the test passes', { | ||
project: 'experimental-retries', | ||
browser: '!webkit', | ||
spec: 'tests/always-passes.cy.js', | ||
snapshot: true, | ||
expectedExitCode: 0, | ||
config: { | ||
experimentalBurnIn: false, | ||
retries: { | ||
openMode: false, | ||
runMode: true, | ||
experimentalStrategy: 'detect-flake-and-pass-on-threshold', | ||
experimentalOptions: { | ||
maxRetries: 10, | ||
passesRequired: 3, | ||
}, | ||
}, | ||
screenshotOnRunFailure: false, | ||
}, | ||
}) | ||
|
||
systemTests.it('retries up to the "passesRequired" limit if the config can be satisfied', { | ||
project: 'experimental-retries', | ||
browser: '!webkit', | ||
spec: 'tests/deterministic-flaky.cy.js', | ||
snapshot: true, | ||
expectedExitCode: 0, | ||
config: { | ||
experimentalBurnIn: false, | ||
retries: { | ||
openMode: false, | ||
runMode: true, | ||
experimentalStrategy: 'detect-flake-and-pass-on-threshold', | ||
experimentalOptions: { | ||
maxRetries: 9, | ||
passesRequired: 3, | ||
}, | ||
}, | ||
screenshotOnRunFailure: false, | ||
}, | ||
}) | ||
|
||
systemTests.it('retries up to the "passesRequired" limit if the config can be satisfied (max attempts)', { | ||
project: 'experimental-retries', | ||
browser: '!webkit', | ||
spec: 'tests/deterministic-flaky.cy.js', | ||
snapshot: true, | ||
expectedExitCode: 0, | ||
config: { | ||
experimentalBurnIn: false, | ||
retries: { | ||
openMode: false, | ||
runMode: true, | ||
experimentalStrategy: 'detect-flake-and-pass-on-threshold', | ||
experimentalOptions: { | ||
maxRetries: 9, | ||
passesRequired: 5, | ||
}, | ||
}, | ||
screenshotOnRunFailure: false, | ||
}, | ||
}) | ||
}) | ||
|
||
describe('fails', () => { | ||
systemTests.it('short-circuits if the needed "passesRequired" cannot be satisfied by the remaining attempts available', { | ||
project: 'experimental-retries', | ||
browser: '!webkit', | ||
spec: 'tests/deterministic-flaky.cy.js', | ||
snapshot: true, | ||
expectedExitCode: 1, | ||
config: { | ||
experimentalBurnIn: false, | ||
retries: { | ||
openMode: false, | ||
runMode: true, | ||
experimentalStrategy: 'detect-flake-and-pass-on-threshold', | ||
experimentalOptions: { | ||
maxRetries: 5, | ||
passesRequired: 5, | ||
}, | ||
}, | ||
screenshotOnRunFailure: false, | ||
}, | ||
}) | ||
|
||
systemTests.it('retries up to the "passesRequired" limit if the config can be satisfied (max attempts possible)', { | ||
project: 'experimental-retries', | ||
browser: '!webkit', | ||
spec: 'tests/deterministic-flaky.cy.js', | ||
snapshot: true, | ||
expectedExitCode: 1, | ||
config: { | ||
experimentalBurnIn: false, | ||
retries: { | ||
openMode: false, | ||
runMode: true, | ||
experimentalStrategy: 'detect-flake-and-pass-on-threshold', | ||
experimentalOptions: { | ||
maxRetries: 6, | ||
passesRequired: 4, | ||
}, | ||
}, | ||
screenshotOnRunFailure: false, | ||
}, | ||
}) | ||
}) | ||
}) | ||
|
||
describe('"detect-flake-but-always-fail"', () => { | ||
describe('passes', () => { | ||
systemTests.it('only runs the first attempt of the test if the test passes', { | ||
project: 'experimental-retries', | ||
browser: '!webkit', | ||
spec: 'tests/always-passes.cy.js', | ||
snapshot: true, | ||
expectedExitCode: 0, | ||
config: { | ||
experimentalBurnIn: false, | ||
retries: { | ||
openMode: false, | ||
runMode: true, | ||
experimentalStrategy: 'detect-flake-but-always-fail', | ||
experimentalOptions: { | ||
maxRetries: 9, | ||
stopIfAnyPassed: false, | ||
}, | ||
}, | ||
screenshotOnRunFailure: false, | ||
}, | ||
}) | ||
}) | ||
|
||
describe('fails', () => { | ||
systemTests.it('runs all attempts of the test if the first attempt fails and "stopIfAnyPassed=false"', { | ||
project: 'experimental-retries', | ||
browser: '!webkit', | ||
spec: 'tests/deterministic-flaky.cy.js', | ||
snapshot: true, | ||
expectedExitCode: 1, | ||
config: { | ||
experimentalBurnIn: false, | ||
retries: { | ||
openMode: false, | ||
runMode: true, | ||
experimentalStrategy: 'detect-flake-but-always-fail', | ||
experimentalOptions: { | ||
maxRetries: 9, | ||
stopIfAnyPassed: false, | ||
}, | ||
}, | ||
screenshotOnRunFailure: false, | ||
}, | ||
}) | ||
|
||
systemTests.it('runs attempts of the test if the first attempt fails until the test passes if "stopIfAnyPassed=true"', { | ||
project: 'experimental-retries', | ||
browser: '!webkit', | ||
spec: 'tests/deterministic-flaky.cy.js', | ||
snapshot: true, | ||
expectedExitCode: 1, | ||
config: { | ||
experimentalBurnIn: false, | ||
retries: { | ||
openMode: false, | ||
runMode: true, | ||
experimentalStrategy: 'detect-flake-but-always-fail', | ||
experimentalOptions: { | ||
maxRetries: 9, | ||
stopIfAnyPassed: true, | ||
}, | ||
}, | ||
screenshotOnRunFailure: false, | ||
}, | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |