Know Your Test Automation Tools : Working with Cypress

Know Your Test Automation Tools : Working with Cypress

We are in an era of test automation and it is at its peak. There are various test automation tools available in the market. Existing test automation tools are getting updated while new tools enter to the market to overcome the limitations of current?test tools available. There are tools for Web Services/ Web Applications/ Desktop and mobile automation.

As mentioned in my previous articles, if you want to be an awesome test automation engineer learning the automation tool stack is the utmost important thing that you should do. Do not rely on just one or two tools. Keep moving up the ladder by learning each tool and be a flexible and fully-fledged test automation engineer.?

The tool that I'm going to let my community know in this article is called Cypress.io, which is new to the test automation arena. My sincere thanks should go to Joe Colantonio, who is also a guru in test automation arena. His article on Cypress allowed me to investigate more on this test tool further.

Cypress is an end to end frontend test automation tool which has come up recently and its based on Node.JS. Cypress is based on latest Java Scripting technology, which will handle modern web applications based on Anjular.JS or React.JS.

Going through this new great test automation tool I learned lot of its features. They are simply fantastic.

  • No wait times.... - With Cypress.io there is no need to have hectic wait commands like Selenium. It handles the page loading, object loading automatically. No more fuss on explicit and even implicit waits like Selenium.
  • No more exceptional coding to capture screen shots or videos on error - Cypress.io created screen shots and videos automatically on failure.
  • Interactive script execution - The test runner given by Cypress.io is highly awesome and interactive. Scripts starts executing when we do modifications and save. We do not have to use extra effort to execute scripts seperatly. We can also see interactively the commands gets executed and also time tasken to execute the script.We can also select the browser to execute from the browser dropdown.?
  • Interactive debugging - Cypress takes separate snapshots of each command getting executed. So we can select each executed command and view screen shots of before and after execution of each command.?Debugging is simply awesome.
  • No reliance on Selenium or WebDriver, they have their own execution engine and there is simply awesome speed of execution.

Lets look at how we can get started with Cypress.io. First we have to download and install Node.js as it uses Node.js and run on top of it.

??? npm install cypress        

The cypress installation will be downloaded and installed in your machine.

No alt text provided for this image

After installing open up Cypress.io test runner by typing the following command in your command line.

node_modules\.bin\cypress open        
No alt text provided for this image

It automatically takes the available .js files in your ..\cypress\integration folder. Next create the following code snippet in your favorite js editor or notepad.

///?<reference?types="cypress"?/>
describe('Kushan?First?Test',?function(){
????it('Guru?99?Login',function(){
????????cy.visit('https://demo.guru99.com/v4/')
????????cy.get('body?>?form?>?table?>?tbody?>?tr:nth-child(1)?>?td:nth-child(2)?>?input[type=text]').type('mngr332873')
????????cy.get('body?>?form?>?table?>?tbody?>?tr:nth-child(2)?>?td:nth-child(2)?>?input[type=password]').type('umEtyvy')
????????cy.get('body?>?form?>?table?>?tbody?>?tr:nth-child(3)?>?td:nth-child(2)?>?input[type=submit]:nth-child(1)').click()
????????cy.get('body?>?table?>?tbody?>?tr?>?td?>?table?>?tbody?>?tr.heading3?>?td').should('have.text',?'Manger?Id?:?mngr332873')
????})        
})        

Hope this article gave the heads up on how to jump start test automation with new tool like Cypress.io, and explore the wonderful features it gives. We will explore more functionality of Cypress.io in more upcoming articles. So stay tuned.

Shavantha Weerasinghe

Quality Assurance Lead |Cypress | Appium| Postman| JMeter |ZapProxy |ISEB CFTL |

3 年

Kushan Shalindra Amarasiri how about a Cypress meetup group

回复
Shavantha Weerasinghe

Quality Assurance Lead |Cypress | Appium| Postman| JMeter |ZapProxy |ISEB CFTL |

3 年

Cypress is a nice tool to work with :)

Dhrumil Soni

ISTQB | SFC? | SSYB? | Agile | Manual & Automation Testing | WebDriverIO(TS) | Playwright(TS) | Selenium(Java) | Lead Quality Assurance Analyst

3 年

Well Articulated..!!

要查看或添加评论,请登录

社区洞察