All Projects → percy → example-percy-cypress

percy / example-percy-cypress

Licence: other
Example app demonstrating Percy's Cypress integration.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to example-percy-cypress

firebase-spring-boot-rest-api-authentication
Firebase Spring Boot Rest API Authentication
Stars: ✭ 172 (+258.33%)
Mutual labels:  end-to-end-testing, cypress
Cypress Realworld App
A payment application to demonstrate real-world usage of Cypress testing methods, patterns, and workflows.
Stars: ✭ 2,888 (+5916.67%)
Mutual labels:  end-to-end-testing, cypress
Cypress
Fast, easy and reliable testing for anything that runs in a browser.
Stars: ✭ 35,145 (+73118.75%)
Mutual labels:  end-to-end-testing, cypress
cypress-example-docker-circle-workflows
Cypress + Docker + CircleCI Workflows = ❤️
Stars: ✭ 29 (-39.58%)
Mutual labels:  end-to-end-testing, cypress
silverback
DEPRECATED. Use https://packagist.org/packages/amazeelabs/silverback-cli instead.
Stars: ✭ 13 (-72.92%)
Mutual labels:  cypress
percy-webdriverio
Visual testing with WebdriverIO and Percy
Stars: ✭ 25 (-47.92%)
Mutual labels:  visual-testing
cypress-browser-permissions
A Cypress plugin to set launched browser preferences including permissions like Geolocation, Notifications, Microphone, etc.
Stars: ✭ 40 (-16.67%)
Mutual labels:  cypress
snapshot-action
[Deprecated] A GitHub action to visually test static sites with Percy
Stars: ✭ 14 (-70.83%)
Mutual labels:  visual-testing
Gazo-san
Detect difference between two images.
Stars: ✭ 40 (-16.67%)
Mutual labels:  visual-testing
todo-graphql-example
Example Todo app on top of json-graphql-server
Stars: ✭ 20 (-58.33%)
Mutual labels:  cypress
local-cypress
Use Cypress without global objects
Stars: ✭ 19 (-60.42%)
Mutual labels:  cypress
percy-agent
[Deprecated in favor of `@percy/cli`] An agent process for integrating with Percy.
Stars: ✭ 21 (-56.25%)
Mutual labels:  visual-testing
nextjs-starter-kit
NextJS Starter Kit with Testing Frameworks and CI/CD
Stars: ✭ 30 (-37.5%)
Mutual labels:  cypress
cypress-watch-and-reload
Reloads Cypress when one of the watched files changes
Stars: ✭ 46 (-4.17%)
Mutual labels:  cypress
split-tests
Split test files in Jest and Cypress into parallel CI jobs
Stars: ✭ 22 (-54.17%)
Mutual labels:  cypress
angular-workshop
Learning Angular: From component state to NgRx
Stars: ✭ 40 (-16.67%)
Mutual labels:  cypress
life-after-hate
An intuitive resource map to aid nonprofit Life After Hate staff in finding resources for individuals attempting to disengage from hate groups.
Stars: ✭ 12 (-75%)
Mutual labels:  cypress
cypress-dotenv
Cypress plugin that enables compatability with dotenv
Stars: ✭ 47 (-2.08%)
Mutual labels:  cypress
cypress-angularjs-unit-test
Unit test Angularjs code using Cypress.io test runner
Stars: ✭ 23 (-52.08%)
Mutual labels:  cypress
cypress-example-circleci-orb
Demo of using the Cypress CircleCI Orb
Stars: ✭ 26 (-45.83%)
Mutual labels:  cypress

example-percy-cypress

Example app demonstrating Percy's Cypress integration, used in Percy's Cypress tutorial.

Based on the TodoMVC VanillaJS app, forked at commit 4e301c7014093505dcf6678c8f97a5e8dee2d250.

Cypress Tutorial

The tutorial assumes you're already familiar with JavaScript and Cypress and focuses on using it with Percy. You'll still be able to follow along if you're not familiar with Cypress, but we won't spend time introducing Cypress concepts.

The tutorial also assumes you have Node 12+ with npm and git installed.

Step 1

Clone the example application and install dependencies:

$ git clone https://github.com/percy/example-percy-cypress.git
$ cd example-percy-cypress
$ npm install

The example app and its tests will now be ready to go. You can explore the app by opening the index.html file in a browser.

Step 2

Sign in to Percy and create a new project. You can name the project "todo" if you'd like. After you've created the project, you'll be shown a token environment variable.

Step 3

In the shell window you're working in, export the token environment variable:

Unix

$ export PERCY_TOKEN="<your token here>"

Windows

$ set PERCY_TOKEN="<your token here>"

# PowerShell
$ $Env:PERCY_TOKEN="<your token here>"

Note: Usually this would only be set up in your CI environment, but to keep things simple we'll configure it in your shell so that Percy is enabled in your local environment.

Step 4

Check out a new branch for your work in this tutorial (we'll call this branch tutorial-example), then run tests & take snapshots:

$ git checkout -b tutorial-example
$ npm run test

This will run the app's Cypress tests, which contain calls to create Percy snapshots. The snapshots will then be uploaded to Percy for comparison. Percy will use the Percy token you used in Step 2 to know which organization and project to upload the snapshots to.

You can view the screenshots in Percy now if you want, but there will be no visual comparisons yet. You'll see that Percy shows you that these snapshots come from your tutorial-example branch.

Step 5

Use your text editor to edit index.html and introduce some visual changes. For example, you can add inline CSS to bold the "Clear completed" button on line 32. After the change, that line looks like this:

<button class="clear-completed" style="font-weight:bold">Clear completed</button>

Step 6

Commit the change:

$ git commit -am "Emphasize 'Clear completed' button"

Step 7

Run the tests with snapshots again:

$ npm run test

This will run the tests again and take new snapshots of our modified application. The new snapshots will be uploaded to Percy and compared with the previous snapshots, showing any visual diffs.

At the end of the test run output, you will see logs from Percy confirming that the snapshots were successfully uploaded and giving you a direct URL to check out any visual diffs.

Step 8

Visit your project in Percy and you'll see a new build with the visual comparisons between the two runs. Click anywhere on the Build 2 row. You can see the original snapshots on the left, and the new snapshots on the right.

Percy has highlighted what's changed visually in the app! Snapshots with the largest changes are shown first You can click on the highlight to reveal the underlying screenshot.

If you scroll down, you'll see that no other test cases were impacted by our changes to the 'Clear completed' button. The unchanged snapshots appear grouped together at the bottom of the list.

Finished! 😀

From here, you can try making your own changes to the app and tests, if you like. If you do, re-run the tests and you'll see any visual changes reflected in Percy.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].