Created
December 16, 2019 14:34
-
-
Save aleccool213/e0445d07bdab874cea06eb96284d2661 to your computer and use it in GitHub Desktop.
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
/** | |
* Takes a snapshot of the application at the moment this method is called. | |
* | |
* When running in headless mode, it takes a snapshot with Percy, which is | |
* useful for testing purposes when integrated with our CI process. | |
* | |
* When running in headed mode, it takes a Cypress screenshot instead, | |
* which is more useful for allowing a developer to see a preview. | |
* | |
* @param description A string that describes the snapshot. | |
*/ | |
export const takeSnapshot = (description?: string) => { | |
if (Cypress.browser.isHeaded) { | |
return cy.screenshot(); | |
} | |
return cy.percySnapshot(description); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment