WHAT TO EXPECT
• What is it that makes Cypress so outstanding and reliable?
• Getting started with Cypress
• Write some basic tests and learn how to work with HTTP requests and
the local storage
• Explore debugging capabilities
• ( Configure Cypress for Continuous Integration )
Slide 16
Slide 16 text
Blogging blog.thoughtram.io
Dominic Elm
Trainer @thoughtram
@elmd_
=
ABOUT MYSELF
What is ?
Fast, easy and reliable testing for anything that runs in a browser.
Free. Open Source. MIT Licence.
Slide 19
Slide 19 text
Setting up Cypress
$ npm install cypress !--save-dev
All-in-one solution that uses a good set of testing libraries
Mocha Chai Sinon …
Slide 20
Slide 20 text
Running Cypress
$ $(npm bin)/cypress open
$ $(npm bin)/cypress run !--record
Local
CI
Alternatively you can also use for npm > v5.2
ℹ npx
Slide 21
Slide 21 text
LET’S TRY!
Slide 22
Slide 22 text
HOW IS CYPRESS DIFFERENT
FROM SELENIUM?
Slide 23
Slide 23 text
Selenium vs. Cypress (1)
Selenium Cypress
Configuration
Browser Support
Open Source
Architecture
Remote commands
across the network
Runs inside the browser
and uses Node for anything
outside of the browser
Slide 24
Slide 24 text
No content
Slide 25
Slide 25 text
Selenium vs. Cypress (1)
Selenium Cypress
Configuration
Browser Support
Open Source
Architecture
Remote commands
across the network
Runs inside the browser
and uses Node for anything
outside of the browser
Slide 26
Slide 26 text
Selenium’s Architecture
Ruby C#
Java PHP
JS
Other
Bindings (Client)
Chrome Safari
IE FF
Edge
Other
WebDriver (Server)
BROWSER
JSON «controls»
via HTTP via HTTP
Slide 27
Slide 27 text
Cypress’s Architecture
Browser
Cypress
via Websocket
Node.js Process
OS
Proxy
HTTP Request(s)
WEB
HTTP Response(s)
start with proxy
http://localhost:63115/__/#/tests/__all
iFrame localhost
Cypress (Tests)
iFrame Application localhost
DOM
Service Worker
…
LocalStorage
Window
Slide 28
Slide 28 text
No content
Slide 29
Slide 29 text
Selenium vs. Cypress (1)
Selenium Cypress
Debuggability
Speed
Waiting for Elements
Parallelism
⏳ ⏳
Headless Browser
⏳
Multiple Browsers / Tabs
Soon free for OSS
Slide 30
Slide 30 text
No content
Slide 31
Slide 31 text
Selenium vs. Cypress (1)
Selenium Cypress
Debuggability
Speed
Waiting for Elements
Parallelism
⏳ ⏳
Headless Browser
⏳
Multiple Browsers / Tabs
Soon free for OSS
Slide 32
Slide 32 text
LET’S CODE!
Slide 33
Slide 33 text
What I ❤ about Cypress
• Super intuitive and easy to use
• No flaky tests (waits for XHR requests and DOM elements)
• Rich UI and lots of debugging capabilities (screenshots and videos)
• One step install (all in one solution)
• Open source
• Documentation
References
• Images from https://www.pexels.com/ and https://unsplash.com/
• cypress.io
• Cypress vs. Selenium, is it the end of an era? - Lyudmil Latinov
• Next Generation Web Application End to End Testing - Amir Rustamzadeh
• Painless Testing for React Applications - Gleb Bahmutov
• End-to-end Testing Is Hard - But It Doesn't Have to Be - Gleb Bahmutov