SlideShare a Scribd company logo
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
[Screenshot eines
[Screenshot eines
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
it('should screenshot', () => {
…
// Takes snapshot of page
cy.track('Image name’);
// Snapshot of one element
cy.get('#element')
.track('Image name')
// Spoiler alert: It’s the
// same with Percy
…
});
main 6.4.7.0
main 6.4.7.0
main 6.4.7.0
6.4.7.0
6.4.7.0
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
const now = new Date(2018, 1, 1)
.getTime();
// freezes the system time to Jan 1, 2018
cy.clock(now);
// continue with your normal tests below
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
// Wait for loading times
cy.get('.grid-selection‘)
.should('not.exist');
cy.get('.sw-loader')
.should('not.exist');
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
// An own Command
Cypress.Commands.add('changeElementStyling', (selector, imageStyle) => {
// E.g. replace the image with a fixed one
cy.get(selector)
.invoke('attr', 'style', imageStyle)
.should('have.attr', 'style', imageStyle);
});
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering
Let's get visual. Visual testing in your project - Ramona Schwering

More Related Content

Let's get visual. Visual testing in your project - Ramona Schwering

  • 29. it('should screenshot', () => { … // Takes snapshot of page cy.track('Image name’); // Snapshot of one element cy.get('#element') .track('Image name') // Spoiler alert: It’s the // same with Percy … });
  • 37. const now = new Date(2018, 1, 1) .getTime(); // freezes the system time to Jan 1, 2018 cy.clock(now); // continue with your normal tests below
  • 40. // Wait for loading times cy.get('.grid-selection‘) .should('not.exist'); cy.get('.sw-loader') .should('not.exist');
  • 44. // An own Command Cypress.Commands.add('changeElementStyling', (selector, imageStyle) => { // E.g. replace the image with a fixed one cy.get(selector) .invoke('attr', 'style', imageStyle) .should('have.attr', 'style', imageStyle); });