red-stone-72927
02/08/2023, 7:15 PMenough-truck-68085
02/09/2023, 12:27 AMCypress.env variable. Then you can use the stored variable in your visit string making the call always dynamic for each session.
// Understand how the id is generated and if it's availabe through an API call after authentication
// Intercept call and store it in an env var
login.getLogin.click()
cy.wait("@someEndpoint").then(((body) => {
Cypress.env('myId', body.rsp.id)
})
Then in your test
// Use the same env var in your test, as an example
cy.visit(`http://yourwebsite${Cypress.env('myId')}/loader`)
Start with your engineering team first and then I'd look into documentation if you have further questions
https://docs.cypress.io/api/commands/intercept
https://docs.cypress.io/api/cypress-api/env