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

314
Views
En Cypress, ¿cómo configurar Cookie antes de la prueba?

¿Como resolverlo?

Cypress detectó que usted devolvió una promesa de un comando al mismo tiempo que invocaba uno o más comandos cy en esa promesa.

El comando que devolvió la promesa fue:

cy.visit()

El comando cy que invocaste dentro de la promesa fue:

cy.setCookie()

ingrese la descripción de la imagen aquí

 /// <reference types="cypress" /> import { internet, name } from "faker"; import "cypress-localstorage-commands"; const email = internet.exampleEmail(); const password = internet.password(); const first_name = name.firstName(); const last_name = name.lastName(); let user; before(function registerUser() { cy.request("POST", "https://api.domain.io/api/users/", { first_name: first_name, last_name: last_name, email: email, password: password, }) .its("body") .then((res) => { user = res; }); }); beforeEach(function setUser() { cy.visit("https://app.domain.io/projects/create", { onBeforeLoad: (win) => { cy.setCookie("token", user.token); }, }); }); describe("JWT", () => { it("create project", () => { cy.get('[type="text"]').type("Autotest project"); cy.get('[type="submit"]').click(); }); });

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Logré resolverlo de esta manera:

 beforeEach(function setUser() { cy.setCookie("token", user.token); cy.visit("https://app.domain.io/projects/create"); });

about 4 years ago · Juan Pablo Isaza Report
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!