Getting started E2E testing with Cypress


Preface


Most E2E tools are not all rainbows and unicorns


My Expectation/Goal



You after presentation

||

Testing Pyramid




"Automation tests must be written for the API, the frontend, the backend, the middle-end, the happy path, the sad path, the upside-down path, etc.(1)"
What is Cypress?


- E2E test runner / testing tool
- Works on any front-end framework or website
- For developers and QA engineers
- Tests are only written in JavaScript
- Does not use Selenium
- Free / Open Source / MIT Licence
Why Cypress?


"Fast, easy and reliable testing for anything that runs in a browser."
Test your code, not your patience.
"Testing has been broken for too long.
We figured it was time to fix it."
A test runner built for humans.
Cypress Pros


Time travel
Real time reloads
Debuggability
Automatic waiting
Network traffic control
Screenshots and videos
How to start


npm install cypress --save-dev
Install Cypress locally as a dev dependency for your project.
$(npm bin)/cypress open
touch {your_project}/cypress/integration/sample_spec.js
Create test
$(npm bin)/cypress run
Open GUI and run tests
Run tests in command line
Test structure


Test can be formulated as user story
E.g. "When a user takes a specific action, then the user should see this."
Examples of steps for E2E tests:
1. Visit the page
2. Query elements(inputs, buttons ect.)
3. Interact with elements
4. Assert that state after interaction is correct
Lets test



"When a user visits the homepage, types in the search box, and press enter, then the user should see a new page populated with the results from their search term."
Story:
Thank you for attention



Resources


Contacts


Skype: yavorco
Email: roman.yavoriv@techmagic.co

Cypress. Getting started
By Roman Yavoriv
Cypress. Getting started
- 380