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 1 commit
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
20 changes: 20 additions & 0 deletions packages/config/src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,26 @@ export const validateOverridableAtRunTime = (config: any, isSuiteLevelOverride:
return
}

// this is unique validation, not applied to the general cy config.
// it will be removed when we support defining experimental retries
// in test config overrides

// TODO: remove when experimental retry overriding is supported

if (configKey === 'retries') {
const experimentalRetryCfgKeys = [
'experimentalStrategy', 'experimentalOptions',
]

Object.keys(config.retries || {})
.filter((v) => experimentalRetryCfgKeys.includes(v))
.forEach((invalidExperimentalCfgOverride) => {
onErr({
invalidConfigKey: `retries.${invalidExperimentalCfgOverride}`,
supportedOverrideLevel: 'global_only',
})
})
}
// TODO: add a hook to ensure valid testing-type configuration is being set at runtime for all configuration values.
// https://github.com/cypress-io/cypress/issues/24365

Expand Down
16 changes: 0 additions & 16 deletions packages/driver/src/cy/testConfigOverrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,6 @@ function setConfig (testConfig: ResolvedTestConfigOverride, config, localConfigO

try {
testConfig.applied = overrideLevel
// this is unique validation, not applied to the general cy config.
// it will be removed when we support defining experimental retries
// in test config overrides

// TODO: remove when experimental overriding is supported

const experimentalRetryCfgKeys = [
'experimentalStrategy', 'experimentalOptions',
]

const experimentalRetryConfigAttempted = Object.keys(testConfigOverride.retries || {})
.filter((v) => experimentalRetryCfgKeys.includes(v))

if (experimentalRetryConfigAttempted.length) {
throw new Error(`The following config keys cannot be set per-${overrideLevel}; they must be set globally: ${experimentalRetryConfigAttempted.join(', ')}`)
}

config(testConfigOverride)
} catch (e: any) {
Expand Down
4 changes: 4 additions & 0 deletions packages/driver/src/cypress/error_messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ export default {
message: `The \`{{invalidConfigKey}}\` configuration can only be overridden from a suite-level override.`,
docsUrl: 'https://on.cypress.io/config',
},
global_only: {
message: `The \`{{invalidConfigKey}}\` configuration can only be set globally.`,
docsUrl: 'https://on.cypress.io/config',
},
},
invalid_test_override: {
message: `The config passed to your {{overrideLevel}}-level overrides has the following validation error:\n\n{{errMsg}}`,
Expand Down
4 changes: 3 additions & 1 deletion packages/driver/src/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export const validateConfig = (state: State, config: Record<string, any>, skipCo
validateOverridableAtRunTime(config, isSuiteOverride, (validationResult) => {
let errKey = 'config.cypress_config_api.read_only'

if (validationResult.supportedOverrideLevel === 'suite') {
if (validationResult.supportedOverrideLevel === 'global_only') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can def fix this later, but read_only & global_only should be the same thing. can't be updated at test-time so must be set in the configuration file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least that is how I intended it to be if it's not working that way 🙃

errKey = 'config.invalid_mocha_config_override.global_only'
} else if (validationResult.supportedOverrideLevel === 'suite') {
errKey = 'config.invalid_mocha_config_override.suite_only'
} else if (mochaOverrideLevel) {
errKey = 'config.invalid_mocha_config_override.read_only'
Expand Down
25 changes: 18 additions & 7 deletions system-tests/__snapshots__/testConfigOverrides_spec.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1377,20 +1377,31 @@ exports['testConfigOverrides / experimental retries specific behavior / fails wh
overriding legacy retries with experimental retries
at the describe level
1) sets the config
at the test level
2) sets the config


0 passing
1 failing
2 failing

1) overriding legacy retries with experimental retries
at the describe level
sets the config:
CypressError: The config passed to your suite-level overrides has the following validation error:

The following config keys cannot be set per-suite; they must be set globally: experimentalStrategy, experimentalOptions
CypressError: The \`retries.experimentalStrategy\` configuration can only be set globally.

https://on.cypress.io/config
[stack trace lines]

2) overriding legacy retries with experimental retries
at the test level
sets the config:
CypressError: The config passed to your test-level overrides has the following validation error:

CypressError: The \`retries.experimentalStrategy\` configuration can only be set globally.

https://on.cypress.io/config
Error
[stack trace lines]


Expand All @@ -1399,9 +1410,9 @@ https://on.cypress.io/config
(Results)

┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1
│ Tests: 2
│ Passing: 0 │
│ Failing: 1
│ Failing: 2
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
Expand All @@ -1418,10 +1429,10 @@ https://on.cypress.io/config

Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✖ override-with-experimental-retries. XX:XX 1 - 1 - - │
│ ✖ override-with-experimental-retries. XX:XX 2 - 2 - - │
│ cy.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✖ 1 of 1 failed (100%) XX:XX 1 - 1 - -
✖ 1 of 1 failed (100%) XX:XX 2 - 2 - -


`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,26 @@ describe('overriding legacy retries with experimental retries', () => {
expect(retries.openMode).to.eq(openMode)
})
})

describe('at the test level', () => {
it('sets the config', {
retries: {
experimentalStrategy,
openMode,
runMode,
experimentalOptions: {
maxRetries,
passesRequired,
},
},
}, () => {
const retries = Cypress.config('retries')

expect(retries.experimentalStrategy).to.eq(experimentalStrategy)
expect(retries.experimentalOptions?.maxRetries).to.eq(maxRetries)
expect(retries.experimentalOptions?.passesRequired).to.eq(passesRequired)
expect(retries.runMode).to.eq(runMode)
expect(retries.openMode).to.eq(openMode)
})
})
})
2 changes: 1 addition & 1 deletion system-tests/test/testConfigOverrides_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('testConfigOverrides', () => {
spec: 'override-with-experimental-retries.cy.js',
project: 'experimental-retries',
configFile: 'cypress-legacy-retries.config.js',
expectedExitCode: 1,
expectedExitCode: 2,
browser: '!webkit',
snapshot: true,
})
Expand Down