Cypress — A Cool Tool for End-to-End Testing

  1. Cypress is fast to set up. There are not any dependencies and it is not required to setup complex testing environment
  2. It’s written in Javascript, based on Mocha and Chai, and runs in browsers using Node.js. This makes it fast and reliable for testing every website, even the one’s not written in Javascript.
  3. There is no need for extra libraries, test engines, servers, drivers, etc
  4. Write your tests and watch them get executed in real-time.
  5. You can debug your application directly with Chrome DevTools while the tests are being executed within the browser. When a test fails, an error message is thrown. You can also record screenshots.
  6. Cypress automatically waits for DOM to be loaded, you don’t have to implement additional waits or sleep. Cypress executes everything synchronously, it knows when the page is being loaded and when elements send events.
  7. Record CI data, screenshots, and video and view results in a dashboard.
  8. Most of all, it’s free and open source.
  1. Create a new file sample-spec.js under cypress/integration folder
  2. The file automatically gets identified in the Cypress runner.
  3. Write a test to test the navi. Refer sample code below. You can also test the text inside a page, events inside a page, and any content on the page even after a REST API call. Cypress will wait for the response without any sleep or wait, unlike other tools.
  1. You can log in to Cypress dashboard (https://dashboard.cypress.io/) and create an organization and projects to integrate the CI. It gives you access to recorded tests.
  2. Copy the project key in cypress.json generated.
  3. And run npx cypress run — record — key {key value}
  4. You can view the test results in the Cypress dashboard and also view the analytics of run duration, the slowest tests, top failures, flaky tests, etc.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Payoda Technology Inc

Payoda Technology Inc

Your Digital Transformation partner. We are here to share knowledge on varied technologies, updates; and to stay in touch with the tech-space.