Cypress IO Interview questions

How do you check a checkbox in Cypress IO?

By using one of the below syntaxes you can check the checkboxes.

cy.get("CSS selector").check()
cy.get("CSS selector").check(value)
cy.get("CSS selector").check(values)
cy.get("CSS selector").check(options)
cy.get("CSS selector").check(value, options)
cy.get("CSS selector").check(values, options)
How is CypressIO is different from protractor?

PROS of cypress

  • Open-source
  • Great documentation
  • Simple usage
  • Fast
  • Cross-Browser testing
  • Easy use with CI
  • Npm install cypress only

CONS of Cypress

  • Cypress is weak at cross-browser testing
  • Switch tabs: Cypress can't support
  • No multiple domain support
  • No XPath support
  • Cypress doesn't support native app
  • No support for multiple tab control
  • Re-run failed tests retries not supported yet
  • No iFrame support
  • No page object support
  • No file upload support
  • No support for multiple browser control

Pros of protractor

  • Easy setup
  • Quick tests implementation
  • Open-source
  • Promise support
  • Flexible
How do you click a button in Cypress IO?
//Performs single click action
cy.get().click() 
//Performs double click action
cy.get().dblclick()
//Performs right click action
cy.get().rightclick()
How do you enter text in Cypress IO?
cy.get("CSS or Xpath").type("type something{enter}");
How do you get value from a text bar in Cypress IO?
cy.get('input[name="email"]') .invoke('val') .then(sometext => cy.log(sometext));
What is the command to install Cypress IO?
npm install cypress
What are the other tools recommended to use along with Cypress IO?

The recommended tool is prettier which formats the code. Plugins such as Cucumber, Xpath, Docker are also recommended to install while doing product testing.

How do you uninstall Cypress IO?
npm uninstall cypress
How do you verify a value is greater than the expected value in CypressIO?
cy.get('CSS selector').invoke('text').should('be.gt', 10)
What is the role of node CypressIO?

In CypressIO, javascript is the only programming language that can be used. So in order to work in Cypress, we need NPM packages and node modules.

How do you select a value from a dropdown using CypressIO?

static dropdowns: Select supports value or text as parameter

cy.get('select').select('option1').should('have.value','option1')

dynamic dropdowns: Enter the value and click on the value.

cy.get('#country').type('dev').each(($el, index, $list) => {
        if ($el.text() === "Chercher") {
            $el.click()
        }
    )
}
$el.get('#country').should('have.value', 'Chercher')
How do you check if a value is selected in Cypress IO?

With the help of assertion, we can know whether the value is selected or not from the dropdowns

cy.get('select')
  .select('apples').should('have.value', '456')
How do you open a webpage using CypressIO?

By using the below syntax use can open the webpage in CypressIO

cy.visit("webpage URL to open")
What are the navigation comments present in CypressIO?
//To go to the previous Page
cy.go("back") OR: cy.go(-1) 
//To go to the next page
cy.go("forward") OR cy.go(1) 
What is Cypress?

Cypress is a javascript based entry and testing framework. It is built on top of the mocha which is again a feature in the javascript test framework learning on Algiers and in the browser making asynchronous testing simple and fun.

Cypress also uses chai or BDD and TDD assertions library for note and the browser that can be paired with any javascript testing framework.

Additionally, Cypress is a free open source that is focused on developers and QA engineers. You can do Unit testing, integration testing, and internal testing by writing test cases using Cypress.

Using Cypress, You can basically test anything that can run inside of a browser.

Does Cypress use Selenium?

And the answer no. Cypress does not use selenium. Cypress is one of the free popular test automation tools that does not run on Selenium along with puppeteer. Cypress runs tests directly inside a browser.

Basically, Cypress executes in the same loop as your application runs which is one of its greatest advantages.

Compared to the selenium frameworks, Cypress executes commands outside your application through the network.

What are some of the Cypress features?

The first is automatic waiting. Cypress automatically waits for the DOM to load, the element to become visible, and the animation to get completed.

Other cool features are for example Time Travel, the ability to control network traffic, or video recording of the test runs and taking screenshots on the failed test.

Last but not least is debug ability. Cypress gives you the ability to directly debug your application under a test from the DEV tools. It not only gives you straightforward messages but also suggests how you should approach them.

What makes Cypress different?

The first thing is architecture. Most distinct tools operate by running outside of the browser and executing remote commands across the network. Cypress is the exact opposite. Cypress is executed in the same loop as your application.

Cypress ultimately controls the entire automation process from top to bottom. Cypress is also having ultimate control over your application, network traffic, and easy access to every host object and that unlocks a new way of testing that has never been possible before.

And last but not least is shortcuts. This means you do not have to visit the login page and type username and password and wait for the page to load but you can basically take a shortcut and programmatically look into your application

Which programming languages supported in Cypress?

And the answer is simple.

There is only one programming language supported and that is javascript. Unfortunately, no other languages are supported, and also have no plans to add support for languages.

So if you need to write your automated tests for example in Python or Java you have to consider using a different tool probably on selenium webdriver.

What is a fixture?

Basically, fixtures are used as external pieces of data that can be used by your test. fixture files are located in Cypress fixtures by default but you can configure them to other directories.

You will typically use them with the cy.fixture() command and most often manually stubbing your network requests.

Which browsers are supported in Cypress?

Cypress supports Google Chrome,electron,firefox,chromium,Microsoft edge.

Does Cypress support Xpath?

And the answer is No.

Cypress has no native support for Xpath. Cypress basically leverages the Jquery powerful selector engine to help make that familiar and readable format for developers.

In effect, Cypress bundles Jquery and exposes many of its elements. So you're going to work with the complex HDMI structures with ease.

But there are few third-party libraries that allow you to use Xpaths in your Cypress test.

How do you handle multiple Windows in CypressIO?

No, we can't handle multiple windows in Cypress

0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions