Fireship · @fireship
Cypress End-to-End Testing
Uploaded June 22, 2018 · Length 9:34
Summary
Learn how to use Cypress for end-to-end testing of web applications, including setting up Cypress, writing tests, and debugging with time travel capabilities.
- cypress end-to-end testing
- web application testing
- testing with cypress
- time travel debugging
- cypress tutorial
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
[Music]
- 0:06
Cyprus is an end end testing library
- 0:09
that will change your life as a
- 0:10
developer I say that because it allows
- 0:11
you to speed up the testing process of
- 0:14
the user experience and it will help you
- 0:15
catch bugs that you didn't even know
- 0:17
existed it's super easy to set up and
- 0:19
the learning curve is very minimal so if
- 0:21
you have an existing app I recommend
- 0:22
that you follow along with this episode
- 0:23
in your own project to see what I mean
- 0:25
first hand if you're new to the channel
- 0:27
make sure to LIKE and subscribe and you
- 0:29
can find the source code at angular
- 0:30
firebase com in case you're not familiar
- 0:33
and testing is the process of loading up
- 0:35
your web application in the browser and
- 0:37
testing things as if it was a real user
- 0:40
performing these actions such as
- 0:41
clicking buttons filling out forms and
- 0:43
things like that
- 0:44
so if you're an angular developer you
- 0:45
might already know that angular ships
- 0:47
with its own and and testing library
- 0:49
called protractor so why do we need
- 0:51
Cypress the short answer is that Cypress
- 0:53
just provides a better developer
- 0:54
experience but the longer answer is that
- 0:57
protractor was originally developed for
- 0:58
angularjs and it just hasn't evolved the
- 1:01
way Cypress has first of all Cypress
- 1:03
provides a really nice DSL for writing
- 1:05
expressive and and tests which we'll see
- 1:07
in the code here coming up then it
- 1:09
provides this really nice test Runner
- 1:10
which is an electron app that will run
- 1:12
your app in the browser
- 1:13
and then give you time travel debugging
- 1:15
capabilities for each spec so for every
- 1:17
action that takes place in the app it
- 1:19
will save a snapshot of the state as
- 1:21
well as an image of the UI so you know
- 1:22
how things change before and after some
- 1:24
action took place and in my experience
- 1:26
writing a really good test suite is much
- 1:28
more effective at preventing bugs than
- 1:30
using a state management library like
- 1:31
redux or something along those lines for
- 1:33
this project I'm going to be starting
- 1:35
from the firestarter demo app which
- 1:37
already has user authentication and a
- 1:39
buyer store database feature implemented
- 1:40
in it over the next few minutes we'll
- 1:42
test that the user can sign up log out
- 1:45
log back in create some items in the
- 1:47
database and do a few other things in
- 1:49
between the first thing we need to do is
- 1:51
install it with NPM install Cypress save
- 1:53
dev then I'm also installing a library
- 1:55
called chance which we'll use to
- 1:56
generate random fixtures for our specs I
- 1:59
have completely removed protractor from


