How to test auth0 login with github using cypress

Viewed 221

I'm trying to write E2E tests for my UI. In order to login, I'm using auth0 with social login - Github. I have tried several ways to get access token for Github:

  1. Using cypress button clicking:

     cy.visit("https://myapp.io/login");
     cy.get('.auth0-lock-social-button-text').click();
     // Redirect me into Github login page.
     cy.get('#login_field').type(my_username);
     cy.get('#password').type(my_password);
     cy.get('.btn').click();
    

output: url: https://github.com/session

page content: Cookies must be enabled to use GitHub.

  1. Login with cy.request
    This is where I'm stuck. I want to mock the flow of the ui by sending the requests by myself, but I'm not sure how to do it. All the examples I found were with users they manually created in auth0 users manager, and they received the data by passing client_secret and some other params. Thats not what I'm looking for. I'm trying to illustrate the flow as a user see it, or at least the requests that happens behind.

Is someone have example that explains how to do it?

Note: I don't want to use cypress-social-logins because I need it to pass CI.

Thanks.

0 Answers
Related