|
| 1 | +describe("Log in", () => { |
| 2 | + it("Log in with WebID with no OIDC issuer", () => { |
| 3 | + cy.visit("/"); |
| 4 | + |
| 5 | + cy.get('[aria-label="Profile"]').click(); |
| 6 | + cy.contains('[role="menuitem"]', "Login").click(); |
| 7 | + |
| 8 | + cy.get('input[value="webId"]').click(); |
| 9 | + |
| 10 | + cy.get('input[name="idp"]') |
| 11 | + .clear(); |
| 12 | + cy.get('input[name="idp"]') |
| 13 | + .type("http://localhost:8080/example2/profile/card#me"); |
| 14 | + cy.contains("Login").click(); |
| 15 | + |
| 16 | + cy.contains("No IDP found"); |
| 17 | + }); |
| 18 | + |
| 19 | + it("Log in with invalid WebID document", () => { |
| 20 | + cy.visit("/"); |
| 21 | + |
| 22 | + cy.get('[aria-label="Profile"]').click(); |
| 23 | + cy.contains('[role="menuitem"]', "Login").click(); |
| 24 | + |
| 25 | + cy.get('input[value="webId"]').click(); |
| 26 | + |
| 27 | + cy.get('input[name="idp"]') |
| 28 | + .clear(); |
| 29 | + cy.get('input[name="idp"]') |
| 30 | + .type("http://localhost:8080/invalidWebId/profile/card#me"); |
| 31 | + cy.contains("Login").click(); |
| 32 | + |
| 33 | + cy.contains("Couldn't query the Identity Provider from the WebID"); |
| 34 | + }); |
| 35 | + |
| 36 | + it("Log in with an invalid IDP issuer", () => { |
| 37 | + cy.visit("/"); |
| 38 | + |
| 39 | + cy.get('[aria-label="Profile"]').click(); |
| 40 | + cy.contains('[role="menuitem"]', "Login").click(); |
| 41 | + |
| 42 | + cy.get('input[name="idp"]') |
| 43 | + .clear(); |
| 44 | + cy.get('input[name="idp"]') |
| 45 | + .type("https://facebook.com"); |
| 46 | + cy.contains("Login").click(); |
| 47 | + |
| 48 | + cy.contains("Login failed"); |
| 49 | + }); |
| 50 | + |
| 51 | + it("Log in and execute query on private data", () => { |
| 52 | + cy.visit("/"); |
| 53 | + |
| 54 | + cy.get('[aria-label="Profile"]').click(); |
| 55 | + cy.contains('[role="menuitem"]', "Login").click(); |
| 56 | + |
| 57 | + cy.get('input[name="idp"]').clear(); |
| 58 | + cy.get('input[name="idp"]').type("http://localhost:8080"); |
| 59 | + cy.contains("Login").click(); |
| 60 | + |
| 61 | + cy.get("input#email").type("[email protected]"); |
| 62 | + cy.get("input#password").type("abc123"); |
| 63 | + cy.contains("button", "Log in").click(); |
| 64 | + cy.contains("button", "Authorize").click(); |
| 65 | + |
| 66 | + cy.url().should("eq", "http://localhost:5173/"); |
| 67 | + |
| 68 | + cy.contains("A list of my favorite books").click(); |
| 69 | + cy.contains("It Ends With Us"); |
| 70 | + }); |
| 71 | + |
| 72 | + it("Do not log in and query on private data unauthenticated", () => { |
| 73 | + cy.visit("/"); |
| 74 | + |
| 75 | + cy.contains("A list of my favorite books").click(); |
| 76 | + cy.get("div").should("have.class", "MuiSnackbarContent-message"); |
| 77 | + }); |
| 78 | + |
| 79 | + it("Do not log in and query public data", () => { |
| 80 | + cy.visit("/"); |
| 81 | + |
| 82 | + cy.contains("My wish list").click(); |
| 83 | + cy.contains("Too Late"); |
| 84 | + }); |
| 85 | +}); |
0 commit comments