Currently I'm doing a Cypress test where I have to be logged in in my testing environment. Therefore I'm creating a new Session with pre defined email and password. The sessions gets created but the problem is, that the token is set into the localStorage and not the firebaseLocalStorage. The login was done with Firebase. Here's the code I currently have in commands.js.
Cypress.Commands.add("loginViaAPISession", (email, password) => {
cy.session([email, password], () => {
cy.request({
method: "GET",
// url: "https://localhost:3000/login?redirect=/",
url: Cypress.env("apiserver") + "/login?redirect=/",
body: {
email, password
}
}).then(res => {
expect(res.status).to.eq(200)
window.localStorage.setItem("token", JSON.stringify(res.body)) //this line should be replaced, save token into firebaseLocalStorage
})
cy.visit("/offers/new")
cy.get('[data-cy="page-offer-new"]')
},
{
validate() {
cy.visit("/https://localhost:3000/offers/new")
}
}
)
})