-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: support test retries #3968
Conversation
|
||
https://on.cypress.io/test-retries | ||
|
||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls review these error messages
@@ -887,6 +905,9 @@ module.exports = { | |||
else | |||
msg += "all of the remaining tests." | |||
|
|||
if (obj.hookName is 'after all' or obj.hookName is 'before all') and obj.retries > 0 | |||
msg += "\n\nAlthough you have test retries enabled, we do not retry 'before all' or 'after all' hooks" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls review this error message
Will this feature cover this scenario: kuceb/cypress-plugin-retries#10 I can work-around it (I think) by listening to screenshot events, recording the filenames and then if I can detect a retry in the before each (same spec name?) I can delete the files before the test starts.. but I'd like to know if I should implement a work-around or if you plan to ship this working with this initial release, I'll just wait for it. |
@lukeapage yes, thank you for that. I'm adding that task here, Edit: after considering we would have to rename files on retry, I think we will simply increment the filename with |
That’s a shame. Any reason why? I can grep but the logic is a bit more complicated than ignoring files based on a regex (as we can with failed). I might have a go at deleting the files myself then. And will the logic work like this.. Testname-1 |
And if I do delete the files myself, will you still add on (attempt 2) on the second attempt? |
@lukeapage so in plugins you will be able to listen to but will add |
Awesome work on this @bkucera Disappointed this didn't get into the latest release. We often get random failures, that a re-try will fix. It would be really nice if we could auto-retry on failures. |
Will information about retried tests show up in the statistics? This would be really important in order to not hide unstable tests... |
Do we have a time line for this to be released??? |
## disable DOM snapshots during log for this agent | ||
agent.snapshot = (bool = true) -> | ||
agent._noSnapshot = !bool | ||
|
||
return agent | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can already be done by cy.stub(...).log(false)
@@ -7,10 +7,10 @@ describe "lib/util/path_helpers", -> | |||
check = path_helpers.checkIfResolveChangedRootFolder | |||
|
|||
it "ignores non-absolute paths", -> | |||
expect(check('foo/index.js', 'foo')).to.be.false() | |||
expect(check('foo/index.js', 'foo')).to.eq(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(check('foo/index.js', 'foo')).to.be.false
I updated the I also could not get the test retries actually working from this branch. Overall, I don't really see this PR in a state that is ready to document as far as I can tell, but am willing to schedule a meeting to discuss documentation changes as necessary. |
@bkucera happy to see this land. What about the failed screenshot from previous attempts? Is that skipped when there is another try remaining? or if I don't want that output do I have to delete them after the test has completed, if the test is successful? |
@lukeapage The full documentation for test retries can be found here: cypress-io/cypress-documentation#2925 All screenshots for every failed attempt are kept (if you have screenshots on failure on) and named accordingly |
pass
event to prevent reporters from showing extra passed tests on hook failuresUser facing changelog
retries
from your configuration.Additional details
How has the user experience changed?
warning message when incompatible cypress-plugin-retries is installed:
Interactive test with 2 retries (all failed)
Test during second attempt (1 previous failed):
Test after successful retry (1 previous failed):
Test after expanding previous failed attempt:
Terminal reporter (runMode) output:
Set retries on only some tests/suites:
To get the current retry number from inside a running test use
cy.state('test').currentRetry()
You can check if test retries feature exists by looking at
Cypress.getTestRetries
. Here is a trick to skip a suite of tests if it is notPR Tasks
type definitions
?cypress.schema.json
?fix runnable:run:async only fires once for each hook #3744
.snapshot()
function for agents (spies and stubs
) to reduce memoryfix allow disable of DOM snapshots for stubs and spies #3849
prevAttempts
onto the test runnable instances in driver and server-reporterretries
configuration value_currentRetry
and_retries
runnable props in events (to recreate runnables)pass along 'retry' event from mocharetry event is only fired in mocha 6+enableTestRetriesInOpenMode: false (default)
numTestRetries
this.retries
or on hookDashboard API
to be updated to accept new payloadchai
devDep inpackages/server
, fix resulting errors in testsre-run before hooks as well as beforeEach, afterEach, and test bodyDocs / changes
fix duplicate screenshot entries when using cy.screenshot in a test retry
fix
cannot access scrollTop of null
error in test.tsx breaking e2e/navigation_specDocs PR: TBD
fix css for attempt item border-left
hover styles on individual attempt blocks
setup screenshot diffing for retries ui states
fix bug marking last test passed instread of pending
add warning message when project has
cypress-plugin-retries
installedadd more comments
make sure subsequent afterEach hooks do not run after failing one
only run subsequent hooks of the same nesting level on hook failures
incorrect error thrown with inline retry config
closes Try creating a CircleCI job that monitors other jobs #8054 (better Percy finalize job)
write tests for cy.screenshot w/ multiple attempts (think about fixing flake)
TODO:
non-blocking
color dots beside test attempt collapsibles
you can set
retries
incypress.json
to eithernumber
or{ openMode: number, runMode: number }
to set different values in run mode vs open moderunMode
(CI), you'd use:Migrating from retries plugin:
devDependencies
and plugin-retries code in support filesCypress.currentTest
in favor of test config overridesit('test title', { retries: 2 }, () => {...})
this.retries(n)
(not supported)Cypress.config('retries')
instead ofCypress.env('RETRIES')
(or seecypress.json
instructions aboveTR-58