All about Cypress!!

What is Cypress.io

Cypress is an open source front end automation tools for web applications. This is a non-selenium based tool, when i say non-selenium it does not use selenium libraries neither it is build on top of selenium. Its build all from scratch and offers the following interesting cool out of the box features.
  1. Time Travel :You can travel back and see what happened when you ran the test. Before and after. How cool is that!!
  2. Debugging : You can use chrome devtools to inspect the DOM
  3. Automatic waiting : No more adding waiting through code. All batteries included !!
  4. Screenshots and videos : For failed tests the screenshots and videos are taken automatically, no more adding code explicitly.
  5. Stubs and clocks : Can be used for unit tests by the devs.
For more you can visit the cypress site

Setting up cypress

  1. Install nodejs
    1. On Mac http://blog.teamtreehouse.com/install-node-js-npm-mac 
    2. On a windows machine http://blog.teamtreehouse.com/install-node-js-npm-windows 

Creating a cypress project

Once you set up the node.js on your machine follow the below steps to get started with cypress.io
  • create a folder/directory for your project.
  • change the working directory to the newly created directory
  • run the command without quotes "npm init"
  • go on pressing enter to go with what cypress defaults to, unless you want to explicitly label
  • once the setup is over run the command without double quotes "npm install cypress"
Cypress comes up with some sample tests to run. Here is how you can run cypress.

Make sure you are in the directory where your package,json file is located (ie your project directory) and run the command without quotes "./node_modules/.bin/cypress open"

You would see a window opening and with the list of integration tests. click on any one of them to run the tests.

You can watch it here

In the next post we will explore the APIs of cypress.




Comments

Popular posts from this blog

Cross Browser testing for React Apps

Fixing the appium installation with NPM

Challenges in testing ChatBots