Cypress dynamic tests

Viewed 299

I have a website I need to do testing for it, when I was using Selenium, I had excel file that contains all the login possibilities (username, password, expected result), and then read the data.

Now I want to do the same thing with Cypress but I didn't find anything that let me do the same thing exactly as Selenium.

What is the best way to do dynamic tests with Cypress? Should I put the data straight forward in JSON files or use excel?

1 Answers

You need to use fixtures to do this: https://www.toolsqa.com/cypress/fixtures-in-cypress/

cy.visit('https://shop.demoqa.com/my-account/');
cy.get('#reg_username').type(this.data.Username);
cy.get('#reg_email').type(this.data.Email);
cy.get('#reg_password').type(this.data.Password)

But I prefer to use FakerJs to generate FakeData, like username, email, address etc.

fullname: faker.name.findName(),
email: faker.internet.email(),
cpf: cpf.generate(),
zipcode: faker.address.zipCode(),
street: faker.address.streetName(),
Related