1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Install Cypress in a Production Application

    Brett CassetteBrett Cassette
    cypressCypress
    ^3.1.5

    So you have a production application, and it doesn't use Cypress yet.

    In this course, you'll learn how to add Cypress to your existing npm application, and run it for the first time.

    Recommended Homework:

    • Look through the tests Cypress spins up for you and learn how typical Cypress tests are setup
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    Instructor: In this lesson, we'll learn how to add Cypress to an existing application. First, let's clone the sample repo. Next, cd into the repo and get check out the 01 Cypress install branch.

    Next, run npm install. When it's finished installing, you can start the demo application with npm run start. This command will automatically open the demo application on localhost 5000.

    You can verify that your application is working by running npm run test. Once our application is verified, we're prepared to npm install cypress --save dev.

    Once Cypress is installed, we're prepared to run it with npm bin/cypress open. This will pop open the Cypress interactive GUI which comes pre-seeded with a number of tests.

    If we click on one, we can see an example of Cypress in action. This is Cypress running on the Cypress website. We can see here that Cypress can either run against our local page or against a remote page.

    All of these example files live in the Cypress directory under integration. You'll probably want an easier way to run Cypress, so open package.json and add a Cypress command, which will be cypress open.

    We can use our new command by running npm run cypress. Now you're all set up with Cypress and ready to roll. If you'd like to do an exercise before moving on to the next lesson, take a moment and familiarize yourself with some of the example tests.