cy.origin() unable to find any elements on Auth0 page

Viewed 43

I'm trying to automate a login process for our site which uses Auth0 & Google Sign in. On the login page if you click Google sign in you get sent to an Auto0 page with a form and another Google sign in link, the page contains a URL something like:

https://OURDOMAIN.auth0.com/login?state=*REMOVED*

It's the first time I'm trying to use cy.origin() In my test I'm trying this:

cy.get("a[testid='googleSignInButton']").click()

cy.origin('https://OURDOMAIN.auth0.com/', () => {

      cy.get("input[type='email']").type('anEmail@me.com')
 })

The problem is whatever I try to do in the origin block just returns a timeout trying to find the element.

I've set experimentalSessionAndOrigin: true is there something I'm doing wrong? Unfortuantly the way we are using Auth0 and Google Sign in means it's not possible to do it via API calls.

1 Answers

try without cy.origin()

I had the same problem, and it was fixed by removing the cy.origin()

Try this one:

 Cypress.Commands.add('loginSession', (email, password) => { cy.session([email, password], () => {
    cy.visit('/').then(() => {
      //cy.origin('auth0.com', { args: [email, password] }, ([email, password]) => {
      cy.get('#username').type(email)
      cy.get('#password').type(password)
      cy.get("button[type='submit']").click({ force: true })
      // })
    })
    cy.get('[data-cy="logo"]').should('be.visible')
  })
});
Related