I have several feature files in a Cypress test framework.
Here is the final step in Test File 2:
Then('I store that Order ID in a JSON file', () => {
cy.get('.dx-font-l').then(orderId => {
cy.writeFile("cypress/fixtures/purchase.json", {
orderId: orderId.text()
});
})
});
And here is the first step definition in Test File 3 (the next feature file executed):
Given('I navigate to the store website', () => {
cy.visit(Cypress.env('storeUrl'));
});
As-is:
Test File 2 above completes, Test File 3 begins to load, but then another test file that I ran at the beginning is re-run rather than Test File 3.If, I remove the below code from Test File 2, all 3 files pass as expected.
cy.get('.dx-font-l').then(orderId => {
cy.writeFile("cypress/fixtures/purchase.json", {
orderId: orderId.text()
});
})
Can someone please tell me why this block of code is causing this behavior? I expect that it shouldn't.