DEV Community

John Peters
John Peters

Posted on • Updated on

Cypress in 20 minutes

Create a new Angular Project, name it Angular9.

Go to a command line and type.

'npm install cypress --save-dev'

After about 10 minutes you should be able to start it. Type in

'npx cypress open'

When Cypress opens it will create a folder in your project named Cypress and inject multiple test files for you to get started.

You should see this:

Alt Text

Clicking on a file will start the test immediately in a new window.

Change the Examples to test your Angular Project

Serve up your Angular site 'ng serve', ours is using port 4200. Just to allow Cypress to request your site.

Then make these changes:

Alt Text

Once you save them, the Cypress Runner window will reload, press Stop. Click on the first test again. Once the new window opens, press F12 to open debug mode in Chrome.

Alt Text

Alt Text

This gives us a start on using Cypress in our Angular project.

Total Time 20 minutes.

In an upcoming article we'll dive in a bit deeper.

JWP2020

Top comments (0)