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

240
Views
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 answers
Answer question

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 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!