Skip to content

Instantly share code, notes, and snippets.

@MariMax
Last active October 30, 2017 15:09
Show Gist options
  • Select an option

  • Save MariMax/9a75a73073ed02628d72e87de46e0f24 to your computer and use it in GitHub Desktop.

Select an option

Save MariMax/9a75a73073ed02628d72e87de46e0f24 to your computer and use it in GitHub Desktop.
function rightHandler() {
cy.get('.navigate-right')
.then(rightBtn => {
if (rightBtn.attr('disabled')) {
downHandler(true);
} else {
cy.screenshot()
.then(() => {
cy.wrap(rightBtn).click();
downHandler();
})
}
})
}
function downHandler(last = false) {
cy.get('.navigate-down')
.then(downBtn => {
if (downBtn.attr('disabled')) {
if (last) {
cy.screenshot();
return;
}
rightHandler();
} else {
cy.screenshot()
.then(() => {
cy.wrap(downBtn).click();
downHandler();
})
}
})
}
describe('screenshots maker', () => {
it('should make presentation screenshots', () => {
cy.visit('https://marimax.github.io/cypress-presentation/index.html');
downHandler();
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment