Created
February 2, 2018 21:24
-
-
Save jennifer-shehane/79e331afef286c683911625ebc3913e6 to your computer and use it in GitHub Desktop.
Auth0 testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Tests to make sure we're calling auth0 correctly | |
context "popup display on login", -> | |
it "displays github popup", -> | |
cy.visit("/#/login", { | |
onLoad: (win) -> | |
@loginWithPopup = cy.stub(win.Auth0.prototype, "loginWithPopup") | |
}) | |
cy.contains("Log In with GitHub").click() | |
.then -> | |
expect(@loginWithPopup).to.be.called | |
expect(@loginWithPopup.args[0][0].connection).to.eq("github") | |
## My login command I use for other tests | |
token='zovL2N5cHJlc3MuYXV0aDAuY29tLyIsInN1YiI6ImdpdGh1YnwxMjcxMzY0IiwiYXVkIjoiWFRkQ2xTOEE5MURueExabzFUTjZQakRTMGNMWklmaUQiLCJleHAiOjE0NjE4MDQ4MjIsImlhdCI6MTQ2MTc2ODgyMn0.DIOpihizE3S1vf-QKSpbaTkrEm7Yjz8I-ptg0Y5xkFY' | |
Cypress.Commands.add "login", (opts = {}) -> | |
opts.log = false | |
log = Cypress.log({ | |
autoEnd: false | |
name: 'login' | |
}) | |
cy.visit("#/access_token=abc123&id_token=#{token}", opts).then -> | |
log.snapshot().end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also note, in my application code I have this