Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

237
Vistas
SSO Login in Cypress

enter image description herethe app that I test has SSO login. So, 1st I am cy.vist(xxx) to one URL then system directs me another cy.visit(yyy). But currently I cant handle the issue that currently I am facing. Can you please help me to figure out?

Thank you

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 Respuestas
Responde la pregunta

0

After clicking the login button, you can directly assert whether url contains some text. Also you can add some timeout as well for the redirection to complete.

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

Considering your url is https://example.com/ Within the same test you can work with urls if they have format like https://example.com/something or https://example.com/something/123 or https://superdomain.example.com/. So basically the url should have the same origin. But in case the url is not from the same origin which is in your case, then you have to move to a new test to resolve this. This is a trade-off of cypress and you can read more about it from here. So you can do something like this:

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda