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

224
Views
Cypress: cierre de sesión automático después de 5 funciones en ejecución

Encontré este código para cypress que es ideal para almacenar cookies y no delegar la prueba después de la primera función.

Enlace del artículo: https://dzone.com/articles/cypress-preserve-cookies-and-keep-login-session-active-in-tests

Desafortunadamente, durante la ejecución de la quinta función en mi código, la aplicación se cierra.

 afterEach(() => { //Code to Handle the Sesssions in cypress. //Keep the Session alive when you jump to another test let str = []; cy.getCookies().then((cook) => { cy.log(cook); for (let l = 0; l < cook.length; l++) { if (cook.length > 0 && l == 0) { str[l] = cook[l].name; Cypress.Cookies.preserveOnce(str[l]); } else if (cook.length > 1 && l > 1) { str[l] = cook[l].name; Cypress.Cookies.preserveOnce(str[l]); } } })

La última función se ve así:

 it('Start Creating New Appointment ',function () { cy.get('.user-box__input .dx-dropdowneditor-icon').first().click() cy.get('.dx-calendar-contoured-date').click() cy.get('.user-box__input .dx-dropdowneditor-icon').eq(1).click() cy.contains('01:30 AM').click() cy.get('.dx-dropdowneditor-button .dx-button-content').eq(2).click() cy.wait(1000) cy.get('.dx-item-content dx-list-item-content').eq(2).click() cy.get('.dx-dropdowneditor-button .dx-button-content').eq(3).click() cy.wait(1000) cy.get('.dx-list-item-content').eq(2).click() cy.contains('Save').click() cy.wait(2000) })
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!