Slide 1

Slide 1 text

: The future of E2E testing @elmd_ NG-BE

Slide 2

Slide 2 text

BIG Gleb Bahmutov BIG

Slide 3

Slide 3 text

HOW DO YOU TEST YOUR FRONTEND?

Slide 4

Slide 4 text

Integration Unit E2E

Slide 5

Slide 5 text

ARE YOUR E2E TESTS SLOW?

Slide 6

Slide 6 text

FLAKY or UNRELIABLE?

Slide 7

Slide 7 text

HARD TO MAINTAIN?

Slide 8

Slide 8 text

OR HARD TO WRITE?

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Unit

Slide 11

Slide 11 text

Unit Static Types Linters

Slide 12

Slide 12 text

IGNORE TESTING COMPLETELY?

Slide 13

Slide 13 text

WELCOME TO THE CLUB

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

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

Slide 17

Slide 17 text

https:!//angular-checklist.io/projects Angular Checklist

Slide 18

Slide 18 text

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

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

Inspirations • todomvc, https://github.com/d3lm/todomvc • ngx-drag-to-select, https://github.com/d3lm/ngx-drag-to-select • MachineLabs, https://github.com/machinelabs/machinelabs

Slide 36

Slide 36 text

@elmd_

Slide 37

Slide 37 text

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