SlideShare uma empresa Scribd logo
1 de 18
Cypress.io
JavaScript End To End Testing
Framework
Pooja Singh
1-Jul-2020
Topic Outline
● Introduction
● Selenium Vs Cypress Architectural Difference
● Cypress Ecosystem
● How Cypress is different than other tools
● Features of Cypress
● Limitations
● Installation Steps
● Running Cypress Test from CLI
● Cypress Project Structure
● Writing Tests
Introduction
● Cypress is a next generation front end testing tool built for the modern web application.
● Cypress is an Open Source, Free, Fast, Reliable and Easy to use library that allows
end to end automation testing.
● Cypress uses JavaScript to write automated tests.
● Cypress addresses the key pain points from other automation tools.
● Cypress built on Node.js, it uses JavaScript for writing tests. But 90% coding can be
done using cypress inbuilt commands which are easy to understand.
● Cypress makes our tests very simple when we compared with other tools.
● Cypress is having different Architecture when we compare with selenium.
Selenium vs Cypress Architectures
● Most Test tools like selenium, operate by running outside of browser and executing
remote commands across the network
● But Cypress engine directly operates inside the browser. In other words it is the
browser that is executing your test code.
● This enables Cypress to listen and modify the browser behaviour at run time by
manipulating DOM and altering Network requests and responses on the fly.
Cypress Ecosystem
Cypress is open source tool and consist of
1. Test Runner (Open Source Component. Locally installed) helps you set up and start writing
tests.
2. Dashboard (Recording Tests). The Dashboard provides you insight into what happened when
your test ran.
7 ways Cypress is different
● Cypress does not use selenium.
● Cypress focuses on using end to end testing well.
● Cypress works on any front-end framework or website.
● Cypress tests are only written in javascript.
● Cypress is all in one.
● Cypress is for developers and QA Engineers.
● Cypress run much, much faster.
Features
Limitations
● Support Limited set of browser - Chrome, Electron.
● Tough to read data from files.
● Third Party Reporting tool integration is limited.
Installation Steps
Steps
Step 1 Step 2 Step 3 Step 4 Step 5
Install Node.js Update NPM
Install Visual
Studio Code
Generate
package.json file
npm Install
Cypress
Description
Node.js is
JavaScript runtime
environment.
NPM is a
package
manager and it
makes installing
a tool easy
IDE that comes
with inbuilt
support for
JavaScript.
package.json file
holds various
metadata and
libraries relevant
to the project.
Cypress is node
based tool
Link/
Command
https://nodejs.org/e
n/
npm install npm
https://code.visu
alstudio.com/do
wnload
npm init
npm install
cypress --save-
dev
Running Cypress Tests From CLI
Details Cypress CLI
To open cypress test runner node_modules/.bin/cypress open
To run all the test cases node_modules/.bin/cypress run
To run specific test case node_modules/.bin/run -- --record —spec
"cypress/integration/examples/test1.js
To run tests in a headed mode node_modules/.bin/cypress run --headed
To run tests in a specific browser node_modules/.bin/cypress run --browser chrome
Cypress Project Structure
● Fixtures: it is where we keep the test data.
● Integration: it is where we write the test cases.
● Plugins: it is where we can alter the default cypress
configuration
● Support: it is where we keep reusable methods of
customized commands
● Videos: it is where the recording of the tests run is
saved.
● NPM Modules: it is where npm installs all the project
dependencies.
● Cypress.json: it is used to store different configurations.
E.g., timeout, base URL…
● package.json: it holds various metadata and libraries
relevant to the project.
Writing Tests
● Cypress Constructs/Hocks
● Intelligent Code Completion
● Cypress Link Navigation
● Cypress get Command
● Cypress Assertion
● Cypress Selector Playground
Cypress Constructs/Hocks
● describe(): It is is simply a way to group our tests.
It takes two arguments, the first is the name of the
test group, and the second is a callback function.
describe('My First Cypress Test Suite', function() { })
● it(): We use it for an individual test case. It takes two
arguments, a string explaining what the test should
do, and a callback function which contains our actual
test.
it('My First Cypress Test Case', function() { })
● before(): It runs once before all tests in the block.
before(function() { //runs once before all tests in the
block })
● after():It runs once after all tests in the block.
after(function() { // runs once after all tests in the block })
● beforeEach(): It runs before each test in the block.
beforeEach(function() { // runs before each test in the
block })
● afterEach(): It runs after each test in the block.
afterEach(function() { // runs after each test in the block
})
Intelligent Code Completion
Cypress get Command Cypress Assertion
Cypress Link Navigation
/// <reference types="Cypress" />
cy.get('.brand').should('have.text' , 'SHIVOM')
cy.visit("http://development-platform.shivom.io");
cy.get('#usernameId)
visit()
should()get()
Cypress Selector Playground
Use the browser built-in
selector to generate cypress
selector syntax
Reference
● https://www.toolsqa.com/cypress/what-is-cypress/
● https://docs.cypress.io/guides/overview/why-cypress.html#In-a-nutshell
● https://www.udemy.com/course/cypress-tutorial/
● https://www.youtube.com/watch?time_continue=369&v=5XQOK0v_YRE&featur
e=emb_title
Thank You

Mais conteúdo relacionado

Mais procurados

e2e testing with cypress
e2e testing with cypresse2e testing with cypress
e2e testing with cypressTomasz Bak
 
Cypress e2e automation testing - day1 intor by: Hassan Hameed
Cypress e2e automation testing -  day1 intor by: Hassan HameedCypress e2e automation testing -  day1 intor by: Hassan Hameed
Cypress e2e automation testing - day1 intor by: Hassan HameedHassan Muhammad
 
Cypress - Best Practices
Cypress - Best PracticesCypress - Best Practices
Cypress - Best PracticesBrian Mann
 
Introduction cypress
Introduction cypressIntroduction cypress
Introduction cypressOim Trust
 
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil TayarCypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil TayarApplitools
 
Cypress report
Cypress reportCypress report
Cypress reportAdarsh
 
Getting Started With Cypress
Getting Started With CypressGetting Started With Cypress
Getting Started With CypressKnoldus Inc.
 
Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)Hong Tat Yew
 
End to end test automation with cypress
End to end test automation with cypressEnd to end test automation with cypress
End to end test automation with cypressPankajSingh184960
 
QA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. SeleniumQA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. SeleniumLyudmil Latinov
 
Introduction to E2E in Cypress
Introduction to E2E in CypressIntroduction to E2E in Cypress
Introduction to E2E in CypressFabio Biondi
 
Cypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdfCypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdfbacancytechnology
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesVijay Rangaiah
 

Mais procurados (20)

Cypress testing
Cypress testingCypress testing
Cypress testing
 
e2e testing with cypress
e2e testing with cypresse2e testing with cypress
e2e testing with cypress
 
Cypress Automation
Cypress  AutomationCypress  Automation
Cypress Automation
 
Cypress e2e automation testing - day1 intor by: Hassan Hameed
Cypress e2e automation testing -  day1 intor by: Hassan HameedCypress e2e automation testing -  day1 intor by: Hassan Hameed
Cypress e2e automation testing - day1 intor by: Hassan Hameed
 
Cypress - Best Practices
Cypress - Best PracticesCypress - Best Practices
Cypress - Best Practices
 
End to end test automation with cypress
End to end test automation with cypressEnd to end test automation with cypress
End to end test automation with cypress
 
Introduction cypress
Introduction cypressIntroduction cypress
Introduction cypress
 
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil TayarCypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
 
Cypress report
Cypress reportCypress report
Cypress report
 
Cypress E2E Testing
Cypress E2E TestingCypress E2E Testing
Cypress E2E Testing
 
Component testing with cypress
Component testing with cypressComponent testing with cypress
Component testing with cypress
 
Getting Started With Cypress
Getting Started With CypressGetting Started With Cypress
Getting Started With Cypress
 
Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)
 
End to end test automation with cypress
End to end test automation with cypressEnd to end test automation with cypress
End to end test automation with cypress
 
QA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. SeleniumQA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. Selenium
 
Introduction to E2E in Cypress
Introduction to E2E in CypressIntroduction to E2E in Cypress
Introduction to E2E in Cypress
 
Cypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdfCypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdf
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering Colleges
 
SELENIUM PPT.pdf
SELENIUM PPT.pdfSELENIUM PPT.pdf
SELENIUM PPT.pdf
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 

Semelhante a Cypress for Testing

Efficient mobile automation
Efficient mobile automationEfficient mobile automation
Efficient mobile automationVitaly Tatarinov
 
Cypress Testing Demystified: A Practical Guide
Cypress Testing Demystified: A Practical GuideCypress Testing Demystified: A Practical Guide
Cypress Testing Demystified: A Practical GuideTestgrid.io
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersJavan Rasokat
 
The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldDevOps.com
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed AssafAhmed Assaf
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftYaniv cohen
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
2016 07 - CloudBridge Python library (XSEDE16)
2016 07 - CloudBridge Python library (XSEDE16)2016 07 - CloudBridge Python library (XSEDE16)
2016 07 - CloudBridge Python library (XSEDE16)Enis Afgan
 
Introduction To Cypress | Differences Between Cypress & Selenium
Introduction To Cypress | Differences Between Cypress & SeleniumIntroduction To Cypress | Differences Between Cypress & Selenium
Introduction To Cypress | Differences Between Cypress & SeleniumRavendra Singh
 
Grunt training deck
Grunt training deckGrunt training deck
Grunt training deckJames Ford
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy Systemadrian_nye
 
КОСТЯНТИН НАТАЛУХА «Setup and run automated test framework for Android applic...
КОСТЯНТИН НАТАЛУХА «Setup and run automated test framework for Android applic...КОСТЯНТИН НАТАЛУХА «Setup and run automated test framework for Android applic...
КОСТЯНТИН НАТАЛУХА «Setup and run automated test framework for Android applic...GoQA
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and TuningNGINX, Inc.
 
Developers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonDevelopers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonIneke Scheffers
 
Serverless java
Serverless   javaServerless   java
Serverless javaVishwas N
 

Semelhante a Cypress for Testing (20)

Efficient mobile automation
Efficient mobile automationEfficient mobile automation
Efficient mobile automation
 
Cypress Testing Demystified: A Practical Guide
Cypress Testing Demystified: A Practical GuideCypress Testing Demystified: A Practical Guide
Cypress Testing Demystified: A Practical Guide
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
Cypress.docx
Cypress.docxCypress.docx
Cypress.docx
 
The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote World
 
Node.js an Exectutive View
Node.js an Exectutive ViewNode.js an Exectutive View
Node.js an Exectutive View
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
Nodejs
NodejsNodejs
Nodejs
 
2016 07 - CloudBridge Python library (XSEDE16)
2016 07 - CloudBridge Python library (XSEDE16)2016 07 - CloudBridge Python library (XSEDE16)
2016 07 - CloudBridge Python library (XSEDE16)
 
Introduction To Cypress | Differences Between Cypress & Selenium
Introduction To Cypress | Differences Between Cypress & SeleniumIntroduction To Cypress | Differences Between Cypress & Selenium
Introduction To Cypress | Differences Between Cypress & Selenium
 
Test automation proposal
Test automation proposalTest automation proposal
Test automation proposal
 
Grunt training deck
Grunt training deckGrunt training deck
Grunt training deck
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
Modern web technologies
Modern web technologiesModern web technologies
Modern web technologies
 
КОСТЯНТИН НАТАЛУХА «Setup and run automated test framework for Android applic...
КОСТЯНТИН НАТАЛУХА «Setup and run automated test framework for Android applic...КОСТЯНТИН НАТАЛУХА «Setup and run automated test framework for Android applic...
КОСТЯНТИН НАТАЛУХА «Setup and run automated test framework for Android applic...
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and Tuning
 
Developers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonDevelopers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomon
 
Serverless java
Serverless   javaServerless   java
Serverless java
 

Último

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 

Último (20)

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 

Cypress for Testing

  • 1. Cypress.io JavaScript End To End Testing Framework Pooja Singh 1-Jul-2020
  • 2. Topic Outline ● Introduction ● Selenium Vs Cypress Architectural Difference ● Cypress Ecosystem ● How Cypress is different than other tools ● Features of Cypress ● Limitations ● Installation Steps ● Running Cypress Test from CLI ● Cypress Project Structure ● Writing Tests
  • 3. Introduction ● Cypress is a next generation front end testing tool built for the modern web application. ● Cypress is an Open Source, Free, Fast, Reliable and Easy to use library that allows end to end automation testing. ● Cypress uses JavaScript to write automated tests. ● Cypress addresses the key pain points from other automation tools. ● Cypress built on Node.js, it uses JavaScript for writing tests. But 90% coding can be done using cypress inbuilt commands which are easy to understand. ● Cypress makes our tests very simple when we compared with other tools. ● Cypress is having different Architecture when we compare with selenium.
  • 4. Selenium vs Cypress Architectures ● Most Test tools like selenium, operate by running outside of browser and executing remote commands across the network ● But Cypress engine directly operates inside the browser. In other words it is the browser that is executing your test code. ● This enables Cypress to listen and modify the browser behaviour at run time by manipulating DOM and altering Network requests and responses on the fly.
  • 5. Cypress Ecosystem Cypress is open source tool and consist of 1. Test Runner (Open Source Component. Locally installed) helps you set up and start writing tests. 2. Dashboard (Recording Tests). The Dashboard provides you insight into what happened when your test ran.
  • 6. 7 ways Cypress is different ● Cypress does not use selenium. ● Cypress focuses on using end to end testing well. ● Cypress works on any front-end framework or website. ● Cypress tests are only written in javascript. ● Cypress is all in one. ● Cypress is for developers and QA Engineers. ● Cypress run much, much faster.
  • 7.
  • 9. Limitations ● Support Limited set of browser - Chrome, Electron. ● Tough to read data from files. ● Third Party Reporting tool integration is limited.
  • 10. Installation Steps Steps Step 1 Step 2 Step 3 Step 4 Step 5 Install Node.js Update NPM Install Visual Studio Code Generate package.json file npm Install Cypress Description Node.js is JavaScript runtime environment. NPM is a package manager and it makes installing a tool easy IDE that comes with inbuilt support for JavaScript. package.json file holds various metadata and libraries relevant to the project. Cypress is node based tool Link/ Command https://nodejs.org/e n/ npm install npm https://code.visu alstudio.com/do wnload npm init npm install cypress --save- dev
  • 11. Running Cypress Tests From CLI Details Cypress CLI To open cypress test runner node_modules/.bin/cypress open To run all the test cases node_modules/.bin/cypress run To run specific test case node_modules/.bin/run -- --record —spec "cypress/integration/examples/test1.js To run tests in a headed mode node_modules/.bin/cypress run --headed To run tests in a specific browser node_modules/.bin/cypress run --browser chrome
  • 12. Cypress Project Structure ● Fixtures: it is where we keep the test data. ● Integration: it is where we write the test cases. ● Plugins: it is where we can alter the default cypress configuration ● Support: it is where we keep reusable methods of customized commands ● Videos: it is where the recording of the tests run is saved. ● NPM Modules: it is where npm installs all the project dependencies. ● Cypress.json: it is used to store different configurations. E.g., timeout, base URL… ● package.json: it holds various metadata and libraries relevant to the project.
  • 13. Writing Tests ● Cypress Constructs/Hocks ● Intelligent Code Completion ● Cypress Link Navigation ● Cypress get Command ● Cypress Assertion ● Cypress Selector Playground
  • 14. Cypress Constructs/Hocks ● describe(): It is is simply a way to group our tests. It takes two arguments, the first is the name of the test group, and the second is a callback function. describe('My First Cypress Test Suite', function() { }) ● it(): We use it for an individual test case. It takes two arguments, a string explaining what the test should do, and a callback function which contains our actual test. it('My First Cypress Test Case', function() { }) ● before(): It runs once before all tests in the block. before(function() { //runs once before all tests in the block }) ● after():It runs once after all tests in the block. after(function() { // runs once after all tests in the block }) ● beforeEach(): It runs before each test in the block. beforeEach(function() { // runs before each test in the block }) ● afterEach(): It runs after each test in the block. afterEach(function() { // runs after each test in the block })
  • 15. Intelligent Code Completion Cypress get Command Cypress Assertion Cypress Link Navigation /// <reference types="Cypress" /> cy.get('.brand').should('have.text' , 'SHIVOM') cy.visit("http://development-platform.shivom.io"); cy.get('#usernameId) visit() should()get()
  • 16. Cypress Selector Playground Use the browser built-in selector to generate cypress selector syntax
  • 17. Reference ● https://www.toolsqa.com/cypress/what-is-cypress/ ● https://docs.cypress.io/guides/overview/why-cypress.html#In-a-nutshell ● https://www.udemy.com/course/cypress-tutorial/ ● https://www.youtube.com/watch?time_continue=369&v=5XQOK0v_YRE&featur e=emb_title