Cypress Question and Answers (Q & A) — Series 1

VinayakTitti-Technical QA
3 min readFeb 28, 2021
  1. How to link Fixtures in actual code- Please share any example?

A. For fixture we can call using cy.fixture() `
e.g const data = require(‘../fixtures/login.json’);
And suppose we want to access user_name we can do like data.user_name

2. Can you put some words on how POM can be implemented to reuse the functions and common web elements?

A. Regarding POM we can create a Test class (*Where all my Test cases) and for Each Test, we can create a Method and In the Test case, we have to Import the class where I have written the alley method.

3. Is it support all browsers like Firefox, IE, and safari?

A. Cypress currently supports chrome, firefox, Edge canary, and electron.

4. Could you please explain, what exactly should be inside the “it” block? Should we separate each assertion into the different “it” blocks? If yes, don’t you think that in complicated projects it will get troublesome.

A. it() block is similar to TestNG @Test annotation, in a simplified way. And, tests should be atomic instead of adding multiple assertions in single Test. We should follow standard automation practice, irrespective of the mocha or TestNg framework.

5. Is Parallel execution possible?

A. Yes, Parallel execution is possible using Cypress commercial version.

6. Is there any source where I can read more about advanced end2end structure?

A. Cypress.io team has done great documentation, can start from their website. Or can use “cypress-cookbook” for all code-snippets for e2e testing.

7. Is it comfortable With iframe?

A. Yes, using the cypress iframe module or custom commands, we can handle iframes.

8. As cypress is working under a proxy will we face an issue running it using VPN?

A. Using the cypress binary file we can handle VPN access.

Cypress Binary Install

Install a version different than the default npm package.

CYPRESS_INSTALL_BINARY=2.0.1 npm install cypress@2.0.3

Specify an external URL (to bypass a corporate firewall).

CYPRESS_INSTALL_BINARY=https://company.domain.com/cypress.zip npm install cypress

Specify a file to install locally instead of using the internet.

CYPRESS_INSTALL_BINARY=/local/path/to/cypress.zip npm install cypress

Got it to work…by setting UNIX like a path on windows cmd

SET CYPRESS_INSTALL_BINARY=C:/Users/myUserName/Downloads/cypress.zip

9. Can we use Cypress for BDD?

A. Yes, cypress can be integrated with cucumber for BDD testing.

10. can we perform mobile testing through it?

A. Yes, we can do mobile responsive testing in different View Port using cy.viewport() command.

11. Can we do API Automation using Cypress?

A. Yes, we can do API testing using cy.request() function.

--

--

VinayakTitti-Technical QA

Extensive international experience having worked in UK and Asia (India & Malaysia) in a wide variety of tools- Selenium, Appium, Protractor & Cypress.