I’ve started with cypress automation and I’m struggling with JSON files.
Anyone knows how may I read a JSON file, let’s say, located in ../example/vehicle.json?
I know cypress is JavaScript, but I’m also having trouble when importing JQuery in cypress project.
Create a UserData.json file in fixtures folder and define your values something like this:
{
“Name”: “Ghulam Nabi”,
“Password”:”Admin123″
}
Now, in your Test File
cy.fixture(‘UserData.json’).then((user) => {
cy.get(‘#txtUsername’).type(user.Name)
cy.get(‘#txtPassword’).type(user.Password)
});