A story of learning a new testing tool/a new technology is a work of art that anyone would have to go through in making a difference in their career, which we look forward to accomplishing at our best. The personal story of learning cypress started at a crucial stage of my career where I was supposed to work on. I started with Selenium to do the test automation and moved to cypress as I was supposed to sharpen my knowledge through a next-generation rising tool and never missed any chances to impress my own self with the widened area of knowledge that I was able to grasp which also made everything easier to learn and grow in my career ladder.

 

  • Cypress is an end-to-end testing framework for web test automation.
  • It enables front-end developers and test automation engineers to write automated web tests in JavaScript for the modern web.
  • The use of JavaScript makes Cypress automation especially attractive to a developer audience
  • It aims to address the pain points developers or QA engineers face while testing an application.
  • Cypress is a more developer-friendly tool that uses a unique DOM manipulation technique and operates directly in the browser
  • (Document Object Model (DOM) – To manipulate document structure when writing web pages and Apps |
  • a set of APIs for controlling HTML and styling information that makes heavy use of the Document object)

Why Cypress?
Selenium VS Cypress 

Feature Selenium Cypress
1. Architecture Drivers/Server No Server
2. Supported Language Java, JavaScript, C#, Python, Ruby JavaScript
3. Frameworks Support Supports multiple frameworks based on specific programming languages

Ex: JUnit -> Java, Cucumber -> JavaScript

Mocha JS, Cucumber
4. Speed Slow Fast
5. Screenshot Supported Supported
6. Video Records Not supported Supported
7. Mobile App Android, iOS Not Supported
8. Community Support Rapidly growing community Well established documentation and firm community support

 

Pros & Cons

Pros:

  • Cypress Framework captures snapshots at the time of test execution. This allows QAs or developers to hover over a specific command in the Command Log to see exactly what happened at that particular step.
  • One doesn’t need to add explicit or implicit wait commands in test scripts, unlike Selenium. Cypress waits automatically for commands and assertions.
  • Developers or QAs can use Spies, Stubs, and Clocks to verify and control the behavior of server responses, functions, or timers.
  • The automatic scrolling operation ensures that an element is in view before performing any action (for example Clicking on a button)
  • Earlier Cypress supported only Chrome testing. However, with recent updates, Support for Firefox and Microsoft Edge
  • As the programmer writes commands, Cypress executes them in real-time, providing visual feedback as they run.
    Cypress carries excellent documentation.

Cons:

  • One cannot use Cypress to drive two browsers at the same time
  • It doesn’t provide support for multi-tabs
  • Cypress only supports JavaScript for creating test cases
  • Cypress doesn’t provide support for browsers like Safari and IE at the moment.
  • Limited support for iFrames

Cypress structure & It’s usage

Here are the basics of the structure of a Cypress test and how they’re used to bring it all together:

  1. Fixture – Use to place all the test data for data driving testing
  2. Env variable, Username or Password
  3. Integration – All the spec/js files are created
  4. Plugins – Use to listen cypress events and do/ after specific event trigger (Modify/ Extend the behavior)
  5. Support – Use to put all the reusable/utility methods for a project (directly called methods)
  6. Video – Store all the videos for execution, automatically record test execution- Help to debug if your test cases failed
  7. Node_Module – Create once you install cypress (install after install npm can see this -> Use to run the scrips
  8. Cypress.jason – Use to put all the configuration files (Stetting information)
  9. Package.jason – Use to save all the dependancy
  10.   Ex: Cypress – POM.xml file (Page Object Model)

View of the Structure

Test files

Testing cycle

Reporting – Jira & Confluence

Best Practices

  • Watch YouTube videos to get an idea about Cypress
  • Use sample web sites and do sample testing
  • Go through the “Cypress Documentation” once you get error or problem and do research on solving problems with the help of stack overflow/ any other sites
  • Always maintain a documents so that you can use it later and present it to another person how need to know about Cypress

 

As a Quality Assurance Automation Engineer, I always do some research on learning points. Most of time I watched YouTube videos & Udemy courses,

after that I keep practicing some activities on those videos. To cording cypress scripts, I used Visual Studio. On that I separated scripts according to my purpose, run it & see the results and issues in the scripts

Apart from that I maintain a book to note some important points & theory that I can quickly refer to and also maintains documents in confluence, which includes the idea of overall testing and cypress testing tool