Skip to content

Commit

Permalink
feat: add visual testing with Percy
Browse files Browse the repository at this point in the history
  • Loading branch information
ixartz committed Dec 3, 2022
1 parent 85b0937 commit b0a39f5
Show file tree
Hide file tree
Showing 6 changed files with 518 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Expand Up @@ -59,4 +59,4 @@ jobs:
run: npm run test

- name: Run e2e tests
run: npm run e2e:headless
run: percy exec -- npm run e2e:headless
22 changes: 22 additions & 0 deletions cypress/e2e/navigation.cy.ts → cypress/e2e/Navigation.cy.ts
Expand Up @@ -21,5 +21,27 @@ describe('Navigation', () => {
2
);
});

it('should take screenshot of the homepage', () => {
cy.visit('/');

// Wait until the page is displayed
cy.findByRole('heading', {
name: 'Boilerplate code for your Nextjs project with Tailwind CSS',
});

cy.percySnapshot('Homepage');
});

it('should take screenshot of the About page', () => {
cy.visit('/about');

// Wait until the page is displayed
cy.findByRole('heading', {
name: 'Boilerplate code for your Nextjs project with Tailwind CSS',
});

cy.percySnapshot('About');
});
});
});
1 change: 1 addition & 0 deletions cypress/support/e2e.ts
Expand Up @@ -16,6 +16,7 @@

// Import commands.js using ES2015 syntax:
import '@testing-library/cypress/add-commands';
import '@percy/cypress';

// Alternatively you can use CommonJS syntax:
// require('./commands')
2 changes: 1 addition & 1 deletion cypress/tsconfig.json
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["node", "cypress", "@testing-library/cypress"],
"types": ["node", "cypress", "@percy/cypress", "@testing-library/cypress"],

"isolatedModules": false
},
Expand Down

0 comments on commit b0a39f5

Please sign in to comment.