SlideShare a Scribd company logo
Om
Q: Explain Cypress Architecture?
Ans:
Most testing tools (such as Selenium) work by operating outside of the
browser and performing network commands. The Cypress engine, on the
other hand, runs entirely within the browser. In other words, your test code
is executed by the browser.
It allows Cypress to listen in on browser activity and manipulate it in real
time by manipulating the DOM and changing network requests and
responses on the fly.
In the case of Selenium, each browser has provided its own driver, which
communicates with the browser instances to carry out the commands. On the
contrary, in Cypress, all commands are executed within the browser.
Canary, Chrome, Electron(Default), Chromium, Mozilla Firefox (beta
support), and Microsoft Edge (Chromium-based) browsers are all supported
by Cypress.
Unit, functional, integration, and end-to-end testing are all possible with
Cypress. It meets all of the requirements for a Test Pyramid.
Q: What is Cy route?
Ans:
To manage the behaviour of network requests, use cy.route().
cy.server() and cy.route() have been deprecated in Cypress 6.0.0. Support
for .server() and cy.route() will be moved to a plugin in a future release.
What are the advantages of Cypress?
 Cypress works with Single Page Applications and internal Ajax Calls.
 Cypress can take snapshots of tests after executing each step.We don't
need to have configuration with cypress.
 Cypress can provide access to the developer tools so they can debug
directly into the browser.
 Cypress can run tests and also execute commands on the browser.
 Cypress can execute commands easily and fast than Selenium based
tools.
What are the features of Cypress?
 Time Travel - Cypress is used to take snapshots as our tests runs.
 Debuggability - Cypress stops guessing why our tests are failing.It
can debug tools such as Developer Tools.
 Automatic Waiting - Cypress will add to our tests and wait for
commands and assertions before moving on.
 Screenshots and Videos - Cypress is used in viewing screenshots that
are taken automatically on the failure of our entire test suite while
running from CLI.
Test Runner helps in testing in an interactive runner which helps by
allowing us to see command and execute while viewing the application
under the test.
Test Status helps in showing us a summary of what tests Passed, Failed, or
in Progress.
URL Preview helps in showing us the URL of our test and also helps in
tracking the URL Route.
Viewport Sizing helps in setting our app viewport size for testing layouts.
Command Log helps in showing us the command logs while executing the
tests.
App Preview helps in seeing the the tests while executing the commands.
What is Cypress run?
Cypress Run helps in executing our cypress tests in Headless Browsers. It
helps in opening a New Browser Tab and in loading Cypress at the URL
Cypress which was installed from it. Cypress helps in detecting cypress.json,
it also runs cypress tests in the webpack monitor.
How can we access shadow DOM in Cypress?
Shadow DOM helps in allowing hidden DOM Trees which needs to be
attached to the elements in the regular DOM Tree. Shadow DOM can be
understood by the following command:
cy.get('#locator').shadow().find('.nb-btn').click()
How can we create custom commands in Cypress?
We can create custom commands by using the following command:
Cypress.Commands.add("login", (username, password) => {
cy.get("#username").type(username);
cy.get("#password").type(password);
cy.get("#login").click();
});
How do we press keyboard keys in Cypress?
We can press keyboard keys by using the following command:
cy.get('#locator').type('{shift}{alt}'));
How Cypress architecture is different from selenium?
Selenium relies on WebDriver to execute the commands that means
selenium executes remote command across the network. But in the cypress,
it directly operates inside the browser. So the browser executes the
commands which we run as script.
Explanation: Real world scenario,
Consider Selenium,
If I have element.click() in my test script, Once I execute this script
selenium sends this code to browser specific drivers like ChromeDriver,
Ghecko Driver etc. The browser specific drivers then interact with specific
browsers like Chrome, Firefox etc. and executes the click action.
Consider Cypress,
The same command element.click() Considering Cypress.
Once you execute code in Cypress, The cypress directly sends the code to
browser and click action gets executed.
So with the above example we can understand that the middle layer that
is webdriver which is present in the selenium but Cypress doesn’t need any
middle layer.
Could you tell me about some differences between Cypress and
Selenium?
 Selenium supports all major languages like C#, Java, Python,
JavaScript, Ruby etc.
 Cypress Supports only JavaScript/Typescript languages
 Selenium Commands are executed through web drivers
 Cypress Commands Executed directly on the browser
 Selenium Supports all major browsers chrome,Edge, Internet
Explorer, Safari, Firefox
 Cypress supports only Chrome, Edge and Firefox
 With Selenium Configuration of drivers and language biding should
be done by our own
 With Cypress we get ready framework available we just need to
install.
 Selenium Appium can we used to test native mobile applications
 Cypress doesn’t support any native mobile application testing
What is the disadvantage of using Cypress?
 Cypress doesn’t supports only Javascript/Typescript
 Cypress doesn’t supports all the browsers like Safari, Internet
Explorer is not supported
 Cypress doesn’t support multiple tabs
 We cannot run cypress tests on multiple browsers at the same time.
 Cypress doesn’t support Iframe
Can I use Junit or TestNG in cypress?
Or
What is Testing Framework Cypress comes with?
We cannot use the Junit or TestNG in Cypress, Cypress comes with Mocha
and Chai assertion libraries.
How can I install cypress?
If you want to install cypress, we need to install Node first, once we install
node we can install cypress with command npm install cypress
Could you talk something about Cypress file and folder structures?
 Cypress uses cypress.json file, if we want to specify any custom
configuration which is located in the root of our project.
 The folder named cypress is located in the project root folder which
is main folder for cypress automation framework.
 By default Cypress folder contains 4
subfolders namely fixtures, integration, plugins and support.
 Fixtures folder can be used to store our external Json data files and
we can use these files in our tests using the command cy.fixture().
 Integration folder mainly consists of our actual spec/test files
 Plugins folder contains special files that executes in Node before
project is loaded, before the browser launches, and during your test
execution. This is very helpful when we want to have pre processers
and post processors. Files in this folder can be executed after all the
test execution is complete as well.
7. Example: Let us consider, If we want to generate HTML result after
all the test is completed. The HTML report generation or collating
those HTML reports can be done here in this file.
8. Support folder contains the special file index.js which will be run
before each and every test. Support folder can also be used to create
utility methods which will be helpful in through out our automation
framework. This file is the perfect place to put all your reusable
behavior such as Custom commands or global overrides that you want
to be applied to all of your spec files.
What is Cypress CLI?
Cypress CLI is unique feature in cypress it provides ability to run our
cypress tests in command line. This feature is helpful when we run our
cypress tests in pipelines. It provides many options and flags control the
cypress test behavior.
Example: use npm cypress run to run your tests in command line.
How can I run single specfile in command line?
We can run single spec file in command line using - - spec option and
specifying test name.
Example: npm cypress run - - spec=”myspec.ts”
Tell me at least 5 Cypress commands?
cy.visit(): cy.visit() is used to navigate to the specific website
Ex: cy.visit(‘http://www.google.com’);
cy.log(): cy.log is used for display cypress console logs during execution
Ex: cy.log(‘test 123’);
cy.get(): cy.get is used for getting dom element in cypress, once we get dom
element we can perform action on that like click, type etc.
Example: let myElement = cy.get(‘#username’)
cy.url(): cy.url() is used to Get the current URL of the page that is currently
active.
Example: Consider you have navigate to https://google.com using
cy.visit();, now you can use the cy.url() to get the url back.
How can I create suites in cypress?
We can create a describe() block the describe block acts as suite, inside that
each test can be created as single it() block.
Describe() is like a suite here.
List out some commands which I can use to interact with DOM
elements?
.click() : is used to click on the element
Example:
cy.get('#search').click()
.dblclick() : is used to double click on the element.
Example:
cy.get('input[name="btnK"]').dblclick();
.rightclick(): is used to right click on the element
Example:
cy.get('body').rightclick();
.type() : is used to type on element or text boxes
Example:
cy.get('input[name="texbox"]').type("This is to test");
.clear() : is used to clear the fields or text boxes.
Example:
cy.get('input[name="q"]').clear();
.check() : is used to Check checkbox(es) or radio(s).
Example:
cy.get('input[name="chkbox"]').check();
.uncheck() : is used to unCheck checkbox(es) or radio(s).
Example:
cy.get('input[name="chkbox"]').uncheck();
.select(): Select an <option> within a <select>
Example:
cy.get('select').select('user-1')
Consider a scenario, I have link on webpage and clicking this link opens
new window I need to verify some text in that window. How can I
verify?
Cypress by default doesn’t support, working with new windows so we need
to follow different approach here.
Let’s consider example:
<a href="http://google.com" target="_blank"> Take me to Google </a>
In the above code clicking on Take me to Google link opens the new
window the reason is we have attribute target="_blank". So now if we
remove attribute. target="_blank" then it will open in the same window.
That can be performed by below code
What are the selectors supported by Cypress?
By Default cypress supports only CSS selectors, However we can use third
party plugin to use Xpath selectors
Can I use XPath in Cypress?
Cypress doesn’t support xpath by default, but if we install third party plugin
like cypress-xpath we can use xpath in your script.
Example:
We need to install cypress-xpath in our project first using
How can I read the value from Cypress Configuration file?
We can read the cypress.config values from cypress using Cypress.config();
Example:
If I have defined pageLoadTimeout in config file like blow.
Below code is in cypress.json
Cypress.docx

More Related Content

PPTX
End to end test automation with cypress
PPTX
Why you should switch to Cypress for modern web testing?
PDF
Cypress - Best Practices
PPTX
Cypress Testing.pptx
PDF
Automated testing with Cypress
PPTX
Cypress report
PDF
Cypress e2e automation testing - day1 intor by: Hassan Hameed
PDF
Cypress testing
End to end test automation with cypress
Why you should switch to Cypress for modern web testing?
Cypress - Best Practices
Cypress Testing.pptx
Automated testing with Cypress
Cypress report
Cypress e2e automation testing - day1 intor by: Hassan Hameed
Cypress testing

What's hot (20)

PPTX
Cypress for Testing
PPTX
Introduction to Integration Testing With Cypress
PDF
Introduction to E2E in Cypress
PDF
e2e testing with cypress
PPTX
How to Get Started with Cypress
PDF
Cloud Computing
PPTX
End to end test automation with cypress
PDF
Introduction cypress
PPTX
Cypress E2E Testing
PPTX
CI/CD
PPTX
CI/CD Overview
PDF
Component testing with cypress
PDF
Testing Angular
PDF
Zipline—Airbnb’s Declarative Feature Engineering Framework
PPTX
DevOps and Build Automation
PDF
Ceph with CloudStack
PDF
CI/CD (DevOps) 101
PPTX
Cypress test techniques cucumber bdd framework,tdd,api tests course
Cypress for Testing
Introduction to Integration Testing With Cypress
Introduction to E2E in Cypress
e2e testing with cypress
How to Get Started with Cypress
Cloud Computing
End to end test automation with cypress
Introduction cypress
Cypress E2E Testing
CI/CD
CI/CD Overview
Component testing with cypress
Testing Angular
Zipline—Airbnb’s Declarative Feature Engineering Framework
DevOps and Build Automation
Ceph with CloudStack
CI/CD (DevOps) 101
Cypress test techniques cucumber bdd framework,tdd,api tests course
Ad

Similar to Cypress.docx (20)

PDF
Getting Started With Cypress
PPTX
Progressive Web App Testing With Cypress.io
PDF
Cypress vs Selenium Choosing the Best Tool for Your Automation Needs.pdf
PPTX
Cypress.pptx
PDF
Introduction To Cypress | Differences Between Cypress & Selenium
PPTX
Cypress Automation
PDF
Cypress new old Selenium
PPTX
Introduction to cypress in Angular (Chinese)
PDF
Cypress Best Pratices for Test Automation
PPTX
Automation using Cypress
PPTX
Slides for Automation Testing or End to End testing
PDF
Cypress Testing Demystified: A Practical Guide
PDF
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
PDF
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
PDF
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
PPTX
QA Challenge Accepted 4.0 - Cypress vs. Selenium
PPTX
How to Get Started with Cypress
PDF
Modern e2e-testing-for-complex-web-applications-with-cypressio
PDF
Cypress, charm and easy.
PDF
Cypress Automation Testing Tutorial (Part 1).pdf
Getting Started With Cypress
Progressive Web App Testing With Cypress.io
Cypress vs Selenium Choosing the Best Tool for Your Automation Needs.pdf
Cypress.pptx
Introduction To Cypress | Differences Between Cypress & Selenium
Cypress Automation
Cypress new old Selenium
Introduction to cypress in Angular (Chinese)
Cypress Best Pratices for Test Automation
Automation using Cypress
Slides for Automation Testing or End to End testing
Cypress Testing Demystified: A Practical Guide
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
QA Challenge Accepted 4.0 - Cypress vs. Selenium
How to Get Started with Cypress
Modern e2e-testing-for-complex-web-applications-with-cypressio
Cypress, charm and easy.
Cypress Automation Testing Tutorial (Part 1).pdf
Ad

Recently uploaded (20)

PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
L1 - Introduction to python Backend.pptx
PDF
Digital Strategies for Manufacturing Companies
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
history of c programming in notes for students .pptx
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
System and Network Administraation Chapter 3
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Cost to Outsource Software Development in 2025
PDF
Understanding Forklifts - TECH EHS Solution
PDF
System and Network Administration Chapter 2
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Designing Intelligence for the Shop Floor.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
L1 - Introduction to python Backend.pptx
Digital Strategies for Manufacturing Companies
Wondershare Filmora 15 Crack With Activation Key [2025
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Computer Software and OS of computer science of grade 11.pptx
How to Choose the Right IT Partner for Your Business in Malaysia
history of c programming in notes for students .pptx
PTS Company Brochure 2025 (1).pdf.......
System and Network Administraation Chapter 3
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Cost to Outsource Software Development in 2025
Understanding Forklifts - TECH EHS Solution
System and Network Administration Chapter 2
Navsoft: AI-Powered Business Solutions & Custom Software Development
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises

Cypress.docx

  • 1. Om Q: Explain Cypress Architecture? Ans: Most testing tools (such as Selenium) work by operating outside of the browser and performing network commands. The Cypress engine, on the other hand, runs entirely within the browser. In other words, your test code is executed by the browser. It allows Cypress to listen in on browser activity and manipulate it in real time by manipulating the DOM and changing network requests and responses on the fly. In the case of Selenium, each browser has provided its own driver, which communicates with the browser instances to carry out the commands. On the contrary, in Cypress, all commands are executed within the browser. Canary, Chrome, Electron(Default), Chromium, Mozilla Firefox (beta support), and Microsoft Edge (Chromium-based) browsers are all supported by Cypress. Unit, functional, integration, and end-to-end testing are all possible with Cypress. It meets all of the requirements for a Test Pyramid. Q: What is Cy route? Ans: To manage the behaviour of network requests, use cy.route(). cy.server() and cy.route() have been deprecated in Cypress 6.0.0. Support for .server() and cy.route() will be moved to a plugin in a future release. What are the advantages of Cypress?  Cypress works with Single Page Applications and internal Ajax Calls.  Cypress can take snapshots of tests after executing each step.We don't need to have configuration with cypress.
  • 2.  Cypress can provide access to the developer tools so they can debug directly into the browser.  Cypress can run tests and also execute commands on the browser.  Cypress can execute commands easily and fast than Selenium based tools. What are the features of Cypress?  Time Travel - Cypress is used to take snapshots as our tests runs.  Debuggability - Cypress stops guessing why our tests are failing.It can debug tools such as Developer Tools.  Automatic Waiting - Cypress will add to our tests and wait for commands and assertions before moving on.  Screenshots and Videos - Cypress is used in viewing screenshots that are taken automatically on the failure of our entire test suite while running from CLI.
  • 3. Test Runner helps in testing in an interactive runner which helps by allowing us to see command and execute while viewing the application under the test. Test Status helps in showing us a summary of what tests Passed, Failed, or in Progress.
  • 4. URL Preview helps in showing us the URL of our test and also helps in tracking the URL Route. Viewport Sizing helps in setting our app viewport size for testing layouts. Command Log helps in showing us the command logs while executing the tests. App Preview helps in seeing the the tests while executing the commands. What is Cypress run? Cypress Run helps in executing our cypress tests in Headless Browsers. It helps in opening a New Browser Tab and in loading Cypress at the URL Cypress which was installed from it. Cypress helps in detecting cypress.json, it also runs cypress tests in the webpack monitor. How can we access shadow DOM in Cypress? Shadow DOM helps in allowing hidden DOM Trees which needs to be attached to the elements in the regular DOM Tree. Shadow DOM can be understood by the following command: cy.get('#locator').shadow().find('.nb-btn').click() How can we create custom commands in Cypress? We can create custom commands by using the following command: Cypress.Commands.add("login", (username, password) => { cy.get("#username").type(username); cy.get("#password").type(password); cy.get("#login").click(); }); How do we press keyboard keys in Cypress?
  • 5. We can press keyboard keys by using the following command: cy.get('#locator').type('{shift}{alt}')); How Cypress architecture is different from selenium? Selenium relies on WebDriver to execute the commands that means selenium executes remote command across the network. But in the cypress, it directly operates inside the browser. So the browser executes the commands which we run as script. Explanation: Real world scenario, Consider Selenium, If I have element.click() in my test script, Once I execute this script selenium sends this code to browser specific drivers like ChromeDriver, Ghecko Driver etc. The browser specific drivers then interact with specific browsers like Chrome, Firefox etc. and executes the click action. Consider Cypress, The same command element.click() Considering Cypress. Once you execute code in Cypress, The cypress directly sends the code to browser and click action gets executed. So with the above example we can understand that the middle layer that is webdriver which is present in the selenium but Cypress doesn’t need any middle layer. Could you tell me about some differences between Cypress and Selenium?
  • 6.  Selenium supports all major languages like C#, Java, Python, JavaScript, Ruby etc.  Cypress Supports only JavaScript/Typescript languages  Selenium Commands are executed through web drivers  Cypress Commands Executed directly on the browser  Selenium Supports all major browsers chrome,Edge, Internet Explorer, Safari, Firefox  Cypress supports only Chrome, Edge and Firefox  With Selenium Configuration of drivers and language biding should be done by our own  With Cypress we get ready framework available we just need to install.  Selenium Appium can we used to test native mobile applications  Cypress doesn’t support any native mobile application testing What is the disadvantage of using Cypress?  Cypress doesn’t supports only Javascript/Typescript  Cypress doesn’t supports all the browsers like Safari, Internet Explorer is not supported  Cypress doesn’t support multiple tabs  We cannot run cypress tests on multiple browsers at the same time.  Cypress doesn’t support Iframe Can I use Junit or TestNG in cypress? Or What is Testing Framework Cypress comes with? We cannot use the Junit or TestNG in Cypress, Cypress comes with Mocha and Chai assertion libraries. How can I install cypress? If you want to install cypress, we need to install Node first, once we install node we can install cypress with command npm install cypress
  • 7. Could you talk something about Cypress file and folder structures?  Cypress uses cypress.json file, if we want to specify any custom configuration which is located in the root of our project.  The folder named cypress is located in the project root folder which is main folder for cypress automation framework.  By default Cypress folder contains 4 subfolders namely fixtures, integration, plugins and support.  Fixtures folder can be used to store our external Json data files and we can use these files in our tests using the command cy.fixture().  Integration folder mainly consists of our actual spec/test files  Plugins folder contains special files that executes in Node before project is loaded, before the browser launches, and during your test execution. This is very helpful when we want to have pre processers and post processors. Files in this folder can be executed after all the test execution is complete as well. 7. Example: Let us consider, If we want to generate HTML result after all the test is completed. The HTML report generation or collating those HTML reports can be done here in this file. 8. Support folder contains the special file index.js which will be run before each and every test. Support folder can also be used to create utility methods which will be helpful in through out our automation framework. This file is the perfect place to put all your reusable behavior such as Custom commands or global overrides that you want to be applied to all of your spec files. What is Cypress CLI? Cypress CLI is unique feature in cypress it provides ability to run our cypress tests in command line. This feature is helpful when we run our cypress tests in pipelines. It provides many options and flags control the cypress test behavior. Example: use npm cypress run to run your tests in command line.
  • 8. How can I run single specfile in command line? We can run single spec file in command line using - - spec option and specifying test name. Example: npm cypress run - - spec=”myspec.ts” Tell me at least 5 Cypress commands? cy.visit(): cy.visit() is used to navigate to the specific website Ex: cy.visit(‘http://www.google.com’); cy.log(): cy.log is used for display cypress console logs during execution Ex: cy.log(‘test 123’); cy.get(): cy.get is used for getting dom element in cypress, once we get dom element we can perform action on that like click, type etc. Example: let myElement = cy.get(‘#username’) cy.url(): cy.url() is used to Get the current URL of the page that is currently active. Example: Consider you have navigate to https://google.com using cy.visit();, now you can use the cy.url() to get the url back. How can I create suites in cypress? We can create a describe() block the describe block acts as suite, inside that each test can be created as single it() block. Describe() is like a suite here. List out some commands which I can use to interact with DOM elements? .click() : is used to click on the element
  • 9. Example: cy.get('#search').click() .dblclick() : is used to double click on the element. Example: cy.get('input[name="btnK"]').dblclick(); .rightclick(): is used to right click on the element Example: cy.get('body').rightclick(); .type() : is used to type on element or text boxes Example: cy.get('input[name="texbox"]').type("This is to test"); .clear() : is used to clear the fields or text boxes. Example: cy.get('input[name="q"]').clear(); .check() : is used to Check checkbox(es) or radio(s). Example: cy.get('input[name="chkbox"]').check(); .uncheck() : is used to unCheck checkbox(es) or radio(s). Example:
  • 10. cy.get('input[name="chkbox"]').uncheck(); .select(): Select an <option> within a <select> Example: cy.get('select').select('user-1') Consider a scenario, I have link on webpage and clicking this link opens new window I need to verify some text in that window. How can I verify? Cypress by default doesn’t support, working with new windows so we need to follow different approach here. Let’s consider example: <a href="http://google.com" target="_blank"> Take me to Google </a> In the above code clicking on Take me to Google link opens the new window the reason is we have attribute target="_blank". So now if we remove attribute. target="_blank" then it will open in the same window. That can be performed by below code
  • 11. What are the selectors supported by Cypress? By Default cypress supports only CSS selectors, However we can use third party plugin to use Xpath selectors Can I use XPath in Cypress? Cypress doesn’t support xpath by default, but if we install third party plugin like cypress-xpath we can use xpath in your script. Example: We need to install cypress-xpath in our project first using
  • 12. How can I read the value from Cypress Configuration file? We can read the cypress.config values from cypress using Cypress.config(); Example: If I have defined pageLoadTimeout in config file like blow. Below code is in cypress.json