I have an object and I need to modify some of its attributes. For this I'm using custom commands and the first one modifies a couple of them when the second modifies only one but I execute the second custom command from the first one. When I execute my test, the attribute modified by the second command is null. How can I do this?
Here's a sample of how my code looks:
Cypress.Commands.add("firstCommand", (varA, objectB) => {
let aBody = {};
aBody.a = varA;
cy.modifiesOtherAttr(aBody, objectB);
})
Cypress.Commands.add("modifiesOtherAttr", (aBody, objectB) => {
aBody.b = objectB.attrb;
})
Then my test only calls the first command
describe("a suite name", () => {
it("my test name", () => {
cy.firstCommand(variable, object);
})
})