Created
March 15, 2025 13:28
-
-
Save ygerasimov/c9802156724a8d4a7f3960745f7a119a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const baseUrl = 'https://www.adaptive.co.uk'; | |
const pages = ['/', '/contact-us']; | |
const breakpoints = [640, 1200]; | |
describe('Sauce Visual Demo', () => { | |
it('should be able to open the pages and take screenshots', () => { | |
pages.forEach((page) => { | |
breakpoints.forEach((breakpoint) => { | |
let fullUrl = baseUrl + page; | |
cy.on('uncaught:exception', (err, runnable) => { | |
// returning false here prevents Cypress from failing the test | |
return false | |
}) | |
cy.visit(fullUrl); | |
cy.viewport(breakpoint, 1000); | |
// Modify the page before taking screenshots. | |
cy.get('body').then(($body) => { | |
if ($body.find('#CybotCookiebotDialogBodyButtonDecline').length) { | |
cy.get('#CybotCookiebotDialogBodyButtonDecline').click(); | |
} | |
}); | |
cy.sauceVisualCheck(fullUrl + ' ' + page, { | |
captureDom: true | |
}) | |
}); | |
}) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment