Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
How to set token into firebaseLocalStorage in Cypress

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")
            }
        }
    )
})
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!