Introduction To Cypress
Introduction To Cypress
• Slow?
E2E • Unreliable?
• Hard?
Integration
Unit
2
https://www.cypress.io/
"Fast, easy and reliable testing for anything
that runs in a browser."
Cypress doesn't use Selenium.
3
Cypress Test Runner
4
Cypress Test Runner
Test Spec
5
Cypress Test Runner
6
Demo
7
Easy to install, easy to run
# GUI Runner
$ npx cypress open
# Headless Runner
$ npx cypress run
8
Fast
Selenium WebDriver's Architecture
HTTP Control
9
Fast
Cypress runs in the same run-loop as your app.
10
Time Travel
We can check DOM snapshot for each test step.
11
Automatic Waiting & Retry
We can focus on what to test.
it('adds 2 todos', function () {
cy.visit('/')
cy.get('.new-todo')
.type('learn testing{enter}')
.type('be cool{enter}')
cy.get('.todo-list li')
.should('have.length', 2)
})
12
Debuggability
We can debug our application.
13
Cypress Architecture
Browser
NodeJS Process (Using same domain with proxy)
Cypress Start with Proxy
Tests App (iframe)
(iframe)
DOM
Service Worker
Websocket
OS ...
14
Many other good parts!
• Real time reloads
• Spies, stubs, and clocks
• Network traffic control
• Consistent results
• Screenshots and videos (headless runner)
• Dashboard (paid feature)
15
Restrictions
• Only support Chromium currently
• Seem to be working on Firefox, IE, Edge
• Not supported (because of its architecture)
• Multiple tabs/browsers
• Multiple domains in one test case
16
Let's talk about Cypress!
and we want you!
17