|
| 1 | +/// <reference types="Cypress" /> |
| 2 | + |
| 3 | +describe("Users can sign in with various providers", async () => { |
| 4 | + beforeEach(() => { |
| 5 | + cy.visit("/"); |
| 6 | + cy.findByRole("link", { name: "Sign in" }).click(); |
| 7 | + cy.location().should((loc) => { |
| 8 | + expect(loc.pathname).to.eq("/api/auth/signin"); |
| 9 | + }); |
| 10 | + }); |
| 11 | + it("Signing in with Google", () => { |
| 12 | + cy.findByRole("link", { name: "Sign in with Google" }).click(); |
| 13 | + |
| 14 | + cy.location().should((loc) => { |
| 15 | + expect(loc.hostname).to.eq("https://accounts.google.com"); |
| 16 | + expect(loc.pathname).to.eq("/signin/oauth/oauthchooseaccount"); |
| 17 | + }); |
| 18 | + }); |
| 19 | + it("Signing in with Facebook", () => { |
| 20 | + cy.findByRole("link", { name: "Sign in with Facebook" }).click(); |
| 21 | + |
| 22 | + cy.location().should((loc) => { |
| 23 | + expect(loc.hostname).to.eq("www.facebook.com"); |
| 24 | + expect(loc.pathname).to.eq("/v7.0/dialog/oauth"); |
| 25 | + }); |
| 26 | + }); |
| 27 | + it("Signing in with Twitter", () => { |
| 28 | + cy.findByRole("link", { name: "Sign in with Twitter" }).click(); |
| 29 | + |
| 30 | + cy.location().should((loc) => { |
| 31 | + expect(loc.hostname).to.eq("api.twitter.com"); |
| 32 | + expect(loc.pathname).to.eq("/oauth/authenticate"); |
| 33 | + }); |
| 34 | + }); |
| 35 | + it("Signing in with GitHub", () => { |
| 36 | + cy.findByRole("link", { name: "Sign in with GitHub" }).click(); |
| 37 | + |
| 38 | + cy.location().should((loc) => { |
| 39 | + expect(loc.hostname).to.eq("github.com"); |
| 40 | + expect(loc.pathname).to.eq("/login/oauth/authorize"); |
| 41 | + }); |
| 42 | + }); |
| 43 | +}); |
0 commit comments