I want to use, each time i'm running the test suit, a different set of parameters:
{
"Company": {
"Name": "CompnayName1040",
"FullName": "FullName1040",
"phone": "0505551040"}
}
Meaning after each test run i'm running last test that will increment by 5 the above variables
When running this code the result phone number is: 05055510405
cy.readFile('cypress.env.json', ).then( (envVars) => {
cy.log('Old cypress.env.json.Employee.phone: '+envVars.Employee.phone);
envVars.Employee.phone = String(envVars.Employee.phone).replace(/(\d{4})$/, function(n){ return n+=5 });
cy.log('New cypress.env.json.Employee.phone: '+envVars.Employee.phone);
}
i was expecting the phone number to be 0505551045