Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress run command does not support Auth0 #29716

Open
LukaButikashvili opened this issue Jun 20, 2024 · 2 comments
Open

Cypress run command does not support Auth0 #29716

LukaButikashvili opened this issue Jun 20, 2024 · 2 comments
Labels
stale no activity on this issue for a long period

Comments

@LukaButikashvili
Copy link

LukaButikashvili commented Jun 20, 2024

Current behavior

Currently, we are using Auth0 for registration. The test case starts with visiting the website, and if the user is not logged in, the site redirects to the Auth0 page. Then, it should log in using a custom command. (get from the docs), but getting an error:

"CypressError: Timed out retrying after 15000ms: The command was expected to run against origin https://domain.com but the application is at origin https://domain.auth0.com."

beforeEach(() => {
    cy.visit('/')

    cy.getCookie('appSession').then((cookie) => {
      if (!cookie) {
        cy.loginToAuth0(
          Cypress.env('auth0_username'),
          Cypress.env('auth0_password')
        )
      }
    })
  })

loginToAuth0 command is:

e2e/support/auth0Authentication.ts

declare namespace Cypress {
  interface Chainable {
    loginToAuth0(username: string, password: string): void
  }
}

function loginViaAuth0Ui(username: string, password: string) {
  cy.origin(
    Cypress.env('auth0_domain'),
    { args: { username, password } },
    ({ username, password }) => {
      cy.get('input#username').type(username)
      cy.get('input#password').type(password, { log: false })
      cy.contains('button[data-action-button-primary=true]', 'ログイン').click()
    }
  )
}

Cypress.Commands.add('loginToAuth0', (username: string, password: string) => {
  loginViaAuth0Ui(username, password)
})

Note that this problem only exists in Cypress run, not in Cypress open, and it affects test cases run in that way.

Desired behavior

Using origin it should be worked when running

Test code to reproduce

run command yarn cypress: run

package.json
"cypress:run": "cypress run --browser chrome"

Cypress Version

^13.6.6

Node version

^18.17.0

Operating System

macOS Ventura 13.0.1

Debug Logs

No response

Other

No response

@LukaButikashvili LukaButikashvili changed the title Cypress do not support multiple origin Cypress run command does not support Auth0 Jun 20, 2024
@jennifer-shehane
Copy link
Member

@LukaButikashvili Could you make sure to use the latest version of Cypress?

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity on this issue for a long period
Projects
None yet
Development

No branches or pull requests

3 participants