Visual component testing for React using Cypress and Applitools
npm install
# starts the web app and Cypress
npm run dev
If you want to run just the component tests, then you do not need to start the web application and you can do
npm install
npx cypress open
And pick the component spec files one by one.
In cypress/plugins/index.js we check if APPLITOOLS_API_KEY
is set. If not we set an environment variable to be read in the cypress/support/index.js file. If the variable is NOT set, we overwrite the cy.eyesCheckWindow
command with an empty log
statement (and skip cy.eyesOpen
and cy.eyesClose
)
If you really want to run Cypress tests locally against Applitools, create a file .as-a.ini
or ~/.as-a/.as-a.ini
and place the Applitools there.
; diff visual tests inside Cypress against Applitools API
[applitools]
APPLITOOLS_API_KEY=...
You can then run Cypress with the environment variables set using as-a
$ as-a applitools npm run dev