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

238
Views
Inicio de sesión SSO en Cypress

ingrese la descripción de la imagen aquí la aplicación que pruebo tiene inicio de sesión SSO. Entonces, primero soy cy.vist (xxx) a una URL, luego el sistema me dirige a otra cy.visit (yyy). Pero actualmente no puedo manejar el problema que actualmente estoy enfrentando. ¿Puedes ayudarme a averiguarlo?

Gracias

 it.only("logs in using env variables", () => { const username = Cypress.env("username"); const password = Cypress.env("password"); let href; cy.visit("/"); cy.get(".chakra-stack > .css-1n94901").click() cy.contains("Login with Carmarket").click(); cy.get(":nth-child(1) > .form-control").type(username); cy.get(":nth-child(2) > .form-control").type(password); cy.get(".login > .submit > .button").click({multiple: true,force: true}); cy.url().then((url) => { href = url; cy.log("href ", href); cy.visit(href); cy.url().should("include", "blabla[][1]][1]"); //assertion of that we are in this url }); }); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Después de hacer clic en el botón de inicio de sesión, puede afirmar directamente si la URL contiene algún texto. También puede agregar un tiempo de espera para que se complete la redirección.

 cy.url({timeout: 6000}).should("include", "blabla[][1]][1]")

Teniendo en cuenta que su URL es https://example.com/ Dentro de la misma prueba , puede trabajar con URL si tienen un formato como https://example.com/something o https://example.com/something/123 o https://superdomain.example.com/ . Entonces, básicamente, la URL debe tener el mismo origen. Pero en caso de que la url no sea del mismo origen que en su caso, debe pasar a una nueva prueba para resolver esto. Esta es una compensación de ciprés y puede leer más sobre esto aquí . Así que puedes hacer algo como esto:

 it('logs in using env variables', () => { const username = Cypress.env('username') const password = Cypress.env('password') let href cy.visit('/') cy.get('.chakra-stack > .css-1n94901').click() cy.contains('Login with Carmarket').click() cy.get(':nth-child(1) > .form-control').type(username) cy.get(':nth-child(2) > .form-control').type(password) cy.get('.login > .submit > .button').click({multiple: true, force: true}) }) it('validate content of url', () => { cy.url({timeout: 6000}).should('include', 'blabla[][1]][1]') })
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!