-
Notifications
You must be signed in to change notification settings - Fork 48
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
Support retries in snapshot queue #281
Comments
This comment has been minimized.
This comment has been minimized.
Here's how I'm handling it for now, I've made
import type { SnapshotOptions } from '@percy/core';
Cypress.Commands.add('vrt', (name: string, options?: SnapshotOptions) => {
const { titlePath } = Cypress.currentTest;
const attempt = cy.state('runnable')._currentRetry + 1;
const title = attempt > 1 ? `${name} attempt ${attempt}` : name;
// eslint-disable-next-line no-restricted-properties
cy.percySnapshot([...titlePath, title].join(' > '), options);
}); Inside type SnapshotOptions = import('@percy/core').SnapshotOptions;
declare namespace Cypress {
interface Chainable<Subject> {
/** Take Percy Snapshot for Visual Regression Testing */
vrt(name: string, options?: SnapshotOptions): Chainable<Subject>;
}
} Finally, I've added this to my eslint config so that linting will fail if anyone tries to use module.exports = {
rules: {
'no-restricted-properties': [
2,
{
object: 'cy',
property: 'percySnapshot',
message:
'Please use `cy.vrt` instead of `cy.percySnapshot` as it handles Cypress retries better',
},
],
},
}; |
We'll likely be shipping retries support in all SDKs in Q1 2022. Most of the internal work to That would work as a work around, but you will lose consistent comparisons because the snapshot names are changing. |
@EvanLovely Thanks for the example. It surprised me a lot that this wasn't default behaviour from Percy. |
@sigginjals this approach will work but not really. You’ll see which tests are retrying easily in Percy because their name will change and they won’t compare unless your baseline also has |
Any updates on this? |
@Robdel12 Any update on this issue? That's a pain :( |
👋🏼 No updates, more pressing work has taken precedence since then. When there's updates, this issue will be updated and referenced in the relevant PRs |
Thanks for the update :) |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Please stop bumping. When there’s anything new to share we will, the current status is the same: #281 (comment) |
Hey everyone! We have an update that you've been patiently waiting for 🎉 Percy's SDKs as of v1.11.0 (#1077) now support retries. This works by waiting to create the snapshots until the end of the tests. This can be configured in the Percy config file. For example, as a version: 2
percy:
defer-uploads: true This will allow snapshots to be duplicated. Proper documentation will be coming shortly but given the popularity of this issue I figured I'd give a heads up to those who are clamoring for it. 🏎️ 💨 |
Cypress version
5.0
now support test retries, so a test may have multiple attempts meaning cy.percySnapshot may be called multiple times per-test if the test retries after the snapshotThis causes the following error:
(see cypress-io/cypress-react-unit-test#362 an example error'd run)
In order to support Cypress test retries, the plugin will need to hold off on sending the DOM snapshot until after the final attempt has run. Likely:
see the PR to fix cypress-plugin-snapshots as an example of adding tests for multiple Cypress versions meinaart/cypress-plugin-snapshots#141
The text was updated successfully, but these errors were encountered: