Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: experimental retries #27930

Merged
merged 58 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
f6821e0
chore: set up feature/test-burn-in feature branch
AtofStryker Jul 24, 2023
02ef3a3
Merge branch 'develop' of github.com:cypress-io/cypress into feature/…
AtofStryker Jul 26, 2023
ba1a119
Merge pull request #27400 from cypress-io/chore/merge-develop-into-te…
AtofStryker Jul 26, 2023
c428443
feat: add burnIn Configuration option (currently a no-op) (#27377)
AtofStryker Jul 26, 2023
ef84f03
feat: add new experimental retries configuration (#27412)
AtofStryker Aug 1, 2023
334a955
Merge branch 'develop' into feature/test-burn-in
AtofStryker Aug 11, 2023
209b719
fix cache invalidation [run ci]
astone123 Aug 14, 2023
a802904
Merge branch 'develop' of https://github.com/cypress-io/cypress into …
AtofStryker Aug 16, 2023
f919931
Merge pull request #27538 from cypress-io/chore/merge-develop-test-bu…
AtofStryker Aug 17, 2023
cc0dd8a
Merge branch 'develop' of https://github.com/cypress-io/cypress into …
AtofStryker Sep 5, 2023
bb5046c
fix snapshot added in v13 for module api to include test burn in expe…
AtofStryker Sep 6, 2023
d08a7fa
chore: fix merge conflict
AtofStryker Sep 6, 2023
62e6e11
Merge pull request #27751 from cypress-io/chore/merge-develop
AtofStryker Sep 6, 2023
f4804dd
Merge branch 'develop' of https://github.com/cypress-io/cypress into …
AtofStryker Sep 8, 2023
0fbfc28
Merge pull request #27777 from cypress-io/chore/merge-develop-burnin
AtofStryker Sep 8, 2023
ae3df1a
chore: add burnInTestAction capability (#27768)
mabela416 Sep 12, 2023
a1ad9ca
feat: implement experimental retries (#27826)
AtofStryker Sep 27, 2023
5e8deb7
Revert "feat: add burnIn Configuration option (currently a no-op) (#2…
AtofStryker Sep 28, 2023
cde15d0
Revert "chore: add burnInTestAction capability (#27768)"
AtofStryker Sep 28, 2023
c5abc90
chore: run snapshot and binary jobs against experimental retries feat…
AtofStryker Sep 28, 2023
376c00f
Merge branch 'develop' of https://github.com/cypress-io/cypress into …
AtofStryker Sep 28, 2023
f866c5c
chore: add changelog entry (wip)
AtofStryker Sep 28, 2023
83842a6
Revert "fix snapshot added in v13 for module api to include test burn…
AtofStryker Sep 28, 2023
9799c53
Fix system tests
MuazOthman Oct 4, 2023
eb794a3
Merge branch 'develop' into feature/experimental-retries
MuazOthman Oct 4, 2023
fe367d6
Clear CircleCI cache
MuazOthman Oct 4, 2023
0fecba0
Normalize retries config for test execution
MuazOthman Oct 5, 2023
1b15b2a
Fixed some unit tests
MuazOthman Oct 11, 2023
cd738a3
update snapshots for newer test metadata
cacieprins Oct 12, 2023
d38d1f1
Fix cy-in-cy snapshots
MuazOthman Oct 12, 2023
13691b5
update snapshots
cacieprins Oct 13, 2023
b1c6147
bump cache version
cacieprins Oct 13, 2023
57057fd
Merge branch 'develop' into feature/experimental-retries
cacieprins Oct 16, 2023
8533173
Merge branch 'develop' into feature/experimental-retries
cacieprins Oct 17, 2023
2d1df6c
chore: ensure legacy retry overrides work; reject exp. retries overri…
cacieprins Oct 18, 2023
769a10e
Merge branch 'develop' into feature/experimental-retries
cacieprins Oct 18, 2023
6fb19bf
Merge branch 'develop' into feature/experimental-retries
cacieprins Oct 19, 2023
665db2e
update changelog
cacieprins Oct 19, 2023
a488c27
flip if statement in experimental retries option validation
cacieprins Oct 20, 2023
31e8ba7
refactor invalid experimental retry override for more useful error msg
cacieprins Oct 20, 2023
d71a46c
revert testConfigOverrides snapshot
cacieprins Oct 20, 2023
6e589f8
update snapshots for test override sys test
cacieprins Oct 20, 2023
48c6734
Update packages/config/src/validation.ts
cacieprins Oct 20, 2023
e89d821
succinct changelog entry; links to docs for details
cacieprins Oct 23, 2023
067c265
testConfigOverride system test snapshots
cacieprins Oct 23, 2023
4b0f9a2
Update .github/workflows/update_v8_snapshot_cache.yml
cacieprins Oct 23, 2023
386af08
Update cli/CHANGELOG.md
cacieprins Oct 23, 2023
0800b5f
Update packages/driver/src/cypress.ts
cacieprins Oct 23, 2023
711b548
updating cache-version
mschile Oct 23, 2023
b459aba
improve typescript usage when appending experimental retry options to…
cacieprins Oct 23, 2023
9c54013
Revert "improve typescript usage when appending experimental retry op…
cacieprins Oct 23, 2023
577ae49
refactor test config override validation for experimental retry subkeys
cacieprins Oct 24, 2023
1a17cad
account for error throw differences in browsers in system tests
cacieprins Oct 24, 2023
0ca0b19
Merge branch 'develop' into feature/experimental-retries
cacieprins Oct 24, 2023
8d44661
Merge branch 'develop' into feature/experimental-retries
cacieprins Oct 25, 2023
69e0761
bump circle cache
cacieprins Oct 25, 2023
5e85168
bump circle cache again
cacieprins Oct 25, 2023
d66f980
Merge branch 'develop' into feature/experimental-retries
cacieprins Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/cache-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Bump this version to force CI to re-create the cache from scratch.

10-18-23
10-23-23
13 changes: 12 additions & 1 deletion .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ mainBuildFilters: &mainBuildFilters
- develop
- /^release\/\d+\.\d+\.\d+$/
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- 'feature/experimental-retries'
- 'publish-binary'
- 'ryanm/fix/better-sqlite3'

Expand All @@ -41,6 +42,9 @@ macWorkflowFilters: &darwin-workflow-filters
- equal: [ develop, << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'feature/experimental-retries', << pipeline.git.branch >> ]
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
- equal: [ 'ryanm/fix/better-sqlite3', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
Expand All @@ -52,6 +56,10 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
- equal: [ develop, << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'feature/experimental-retries', << pipeline.git.branch >> ]
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
- equal: [ 'chore/bump_loaders_and_optimize_webpack', << pipeline.git.branch >> ]
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
- equal: [ 'ryanm/fix/better-sqlite3', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
Expand All @@ -75,6 +83,9 @@ windowsWorkflowFilters: &windows-workflow-filters
- equal: [ develop, << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'feature/experimental-retries', << pipeline.git.branch >> ]
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
- equal: [ 'ryanm/fix/better-sqlite3', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
Expand Down Expand Up @@ -145,7 +156,7 @@ commands:
name: Set environment variable to determine whether or not to persist artifacts
command: |
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "update-v8-snapshot-cache-on-develop" && "$CIRCLE_BRANCH" != "ryanm/fix/better-sqlite3" ]]; then
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "lerna-optimize-tasks" && "$CIRCLE_BRANCH" != "feature/experimental-retries" ]]; then
export SHOULD_PERSIST_ARTIFACTS=true
fi' >> "$BASH_ENV"
# You must run `setup_should_persist_artifacts` command and be using bash before running this command
Expand Down
8 changes: 8 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 13.4.0

_Released 10/24/2023 (PENDING)_

**Features:**

- Introduced experimental configuration options for advanced retry logic: adds `experimentalStrategy` and `experimentalOptions` keys to the `retry` configuration key. See [Experimental Flake Detection Features](https://docs.cypress.io/guides/references/experiments/#Experimental-Flake-Detection-Features) in the documentation. Addressed in [#27930](https://github.com/cypress-io/cypress/pull/27930).

## 13.3.2

_Released 10/18/2023_
Expand Down
26 changes: 25 additions & 1 deletion cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2851,6 +2851,30 @@ declare namespace Cypress {
certs: PEMCert[] | PFXCert[]
}

type RetryStrategyWithModeSpecs = RetryStrategy & {
openMode: boolean; // defaults to false
runMode: boolean; // defaults to true
}

type RetryStrategy =
| RetryStrategyDetectFlakeAndPassOnThresholdType
| RetryStrategyDetectFlakeButAlwaysFailType

interface RetryStrategyDetectFlakeAndPassOnThresholdType {
experimentalStrategy: "detect-flake-and-pass-on-threshold"
experimentalOptions?: {
maxRetries: number; // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0
passesRequired: number; // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0 and <= maxRetries
}
}

interface RetryStrategyDetectFlakeButAlwaysFailType {
experimentalStrategy: "detect-flake-but-always-fail"
experimentalOptions?: {
maxRetries: number; // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0
stopIfAnyPassed: boolean; // defaults to false if experimentalOptions is not provided
}
}
interface ResolvedConfigOptions<ComponentDevServerOpts = any> {
/**
* Url used as prefix for [cy.visit()](https://on.cypress.io/visit) or [cy.request()](https://on.cypress.io/request) command's url
Expand Down Expand Up @@ -3122,7 +3146,7 @@ declare namespace Cypress {
* To enable test retries only in runMode, set e.g. `{ openMode: null, runMode: 2 }`
* @default null
*/
retries: Nullable<number | { runMode?: Nullable<number>, openMode?: Nullable<number> }>
retries: Nullable<number | ({ runMode?: Nullable<number>, openMode?: Nullable<number> }) | RetryStrategyWithModeSpecs>
/**
* Enables including elements within the shadow DOM when using querying
* commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.config.{js,ts,mjs,cjs},
Expand Down
33 changes: 33 additions & 0 deletions cli/types/tests/cypress-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,39 @@ namespace CypressLocalStorageTests {
cy.clearAllSessionStorage({ log: 'true' }) // $ExpectError
}

namespace CypressRetriesSpec {
Cypress.config('retries', {
openMode: 0,
runMode: 1
})

Cypress.config('retries', {
openMode: false,
runMode: false,
experimentalStrategy: "detect-flake-and-pass-on-threshold",
experimentalOptions: {
maxRetries: 2,
passesRequired: 2
}
})

Cypress.config('retries', {
openMode: false,
runMode: false,
experimentalStrategy: "detect-flake-but-always-fail",
experimentalOptions: {
maxRetries: 2,
stopIfAnyPassed: true
}
})

Cypress.config('retries', { openMode: false, runMode: true, experimentalStrategy: "detect-flake-and-pass-on-threshold", experimentalOptions: { maxRetries: 2} }) // $ExpectError
Cypress.config('retries', { openMode: false, runMode: true, experimentalStrategy: "detect-flake-but-always-fail", experimentalOptions: { maxRetries: 2} }) // $ExpectError

Cypress.config('retries', { openMode: false, runMode: true, experimentalStrategy: "detect-flake-and-pass-on-threshold", experimentalOptions: { passesRequired: 2} }) // $ExpectError
Cypress.config('retries', { openMode: false, runMode: true, experimentalStrategy: "detect-flake-but-always-fail", experimentalOptions: { stopIfAnyPassed: true} }) // $ExpectError
}

namespace CypressTraversalTests {
cy.wrap({}).prevUntil('a') // $ExpectType Chainable<JQuery<HTMLAnchorElement>>
cy.wrap({}).prevUntil('#myItem') // $ExpectType Chainable<JQuery<HTMLElement>>
Expand Down
Loading