question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Login command using the cy.origin no longer works in 10.6

See original GitHub issue

Current behavior

Using a login command that with cy.origin and with Cypress configured to use experimentalSessionAndOrigin: true, I was previously (Cypress.10.2) able to use idaas to handle authentication. After uprading to Cypress.10.6 this resulted in the browser loading a page labelled BAD REQUEST. The console had no useful error message or details.

I’m not sure what happened here, and I’d like to be able to fix it myself as we need to be able to authenticate out test users via idaas.

Desired behavior

The Cross-origin request should be successful and I should be able to continue to navigate on the website under test.

Test code to reproduce

Cypress.Commands.add('login', (username, password, idaasEnv) => {
  const args = { username, password, idaasEnv }

  cy.visit(`/myidaas${idaasEnv}.onmicrosoft.com`,
  onLoad: (contentWindow) => {
    console.log('Login page loaded.')
  })
  cy.origin(`${idaasEnv}.login.mycompany.com`, { args: {username, password, idaasEnv}}, ({ username, password, idaasEnv }) => {
    console.log(`idaas is ${idaasEnv}`)
    Cypress.on('uncaught:exception', (err, runnable) => {
        // returning false here prevents Cypress from
        // failing the test
        return false
    })
  })
  .url()
  .should('include', `${idaasEnv}.login.mycompany.com/myidaas${idaasEnv}.onmicrosoft.com`, { timeout: 15000 })  
  
  cy.contains('User ID', { timeout: 15000 })
  cy.get('#logonIdentifier').type(username).should('have.value', user name)
  cy.get('#password').type(password)
  cy.get('#next').click()
  cy.url().should('contain', 'qa.newModernReactBasedWebapp.mycompany.net')
});

Cypress Version

10.6.0

Node version

v16.17.0

Operating System

Windows 10 Enterprise

Debug Logs

Should/contain does not pass as the page loaded is a blank white web page with the words Bad Request.

Other

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
emilyrohrboughcommented, Sep 6, 2022

@anark Ooops 😅 sorry about that! You are correct. Meant for @anbeck77.

1reaction
anarkcommented, Sep 6, 2022

@anark I am going to go ahead and close this a duplicate of #23531 base on how you’ve describe how your application/login should work verse how it is working in Cypress.

As I am sure you are aware of by now, there were several cookie-related issues logged where cookies stop working as expected after the 10.3.0 release. Once those are fixed and if you issue is not resolved, please comment & we can re-open and try to create a reproducible example and/or dig into your logs so can figure out why this is no longer working.

Thank you for the details you have provided! 🙏

I think this comment was meant for @anbeck77 not me

Read more comments on GitHub >

github_iconTop Results From Across the Web

origin - Cypress Documentation
The cy.origin() command allows your tests to bypass this limitation. Obstructive Third Party Code. By default Cypress will search through the response ...
Read more >
User is not able to "signin with Google" using Cy.origin in ...
It's working for login with github but not for Google. . .Don't know why not working for Google. I know there is solution...
Read more >
An Introduction to R - The Comprehensive R Archive Network
argument; 10.5 Assignments within functions; 10.6 More advanced examples ... If a command is not complete at the end of a line, R...
Read more >
College, Career, and Civic Life (C3) Framework
NOW MORE THAN EVER, students need the intellectual power to recognize ... Work on the C3 Framework began in 2010 with the de-...
Read more >
cypress: Versions - Openbase
Consider using the experimental cy.session() command instead to cache and restore ... cross-origin requests will no longer immediately fail, but instead, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found