Skip to content

Commit df4b565

Browse files
committed
added tests for sources info cases
1 parent 2648096 commit df4b565

File tree

1 file changed

+69
-3
lines changed

1 file changed

+69
-3
lines changed

cypress/e2e/spec.cy.js

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,79 @@ describe("Web app", () => {
33
cy.visit("/");
44
});
55

6+
it("Fetch status source info on query failed", () => {
7+
cy.visit("/");
8+
9+
cy.contains("My favourite musicians").click();
10+
cy.contains("Finished in:");
11+
cy.get('[aria-label="Sources info"]').click();
12+
13+
cy.get('[aria-label="Query failed"]').should("exist");
14+
});
15+
16+
it("Fetch status source info on query success", () => {
17+
cy.visit("/");
18+
19+
cy.contains("My wish list").click();
20+
cy.contains("Finished in:");
21+
cy.get('[aria-label="Sources info"]').click();
22+
23+
cy.get('[aria-label="Query was succesful"]').should("exist");
24+
});
25+
26+
it("Authentication needed source info for query on public data", () => {
27+
cy.visit("/");
28+
29+
cy.contains("My wish list").click();
30+
cy.contains("Finished in:");
31+
cy.get('[aria-label="Sources info"]').click();
32+
33+
cy.get('[aria-label="No authentication required"]').should("exist");
34+
});
35+
36+
it("Authentication needed source info for query on private data", () => {
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"]').clear();
43+
cy.get('input[name="idp"]').type("http://localhost:8080");
44+
cy.contains("Login").click();
45+
46+
cy.get("input#email").type("hello@example.com");
47+
cy.get("input#password").type("abc123");
48+
cy.contains("button", "Log in").click();
49+
cy.contains("button", "Authorize").click();
50+
51+
cy.url().should("eq", "http://localhost:5173/");
52+
53+
cy.contains("A list of my favorite books").click();
54+
cy.contains("Finished in:");
55+
cy.get('[aria-label="Sources info"]').click();
56+
57+
cy.get('[aria-label="Authentication required"]').should("exist");
58+
});
59+
60+
it("Authentication needed source info for query on failing query", () => {
61+
cy.visit("/");
62+
63+
cy.contains("My favourite musicians").click();
64+
cy.contains("Finished in:");
65+
cy.get('[aria-label="Sources info"]').click();
66+
67+
cy.get('[aria-label="Uncertain if authentication is required"]').should(
68+
"exist"
69+
);
70+
});
71+
672
it("When one source throws an error, the results of other sources are still shown", () => {
773
cy.visit("/");
874

975
cy.contains("My favourite musicians").click();
1076
cy.contains("Finished in:");
1177
cy.contains("Ludwig van Beethoven");
12-
})
78+
});
1379

1480
it("Log in and execute query on private data", () => {
1581
cy.visit("/");
@@ -29,14 +95,14 @@ describe("Web app", () => {
2995
cy.url().should("eq", "http://localhost:5173/");
3096

3197
cy.contains("A list of my favorite books").click();
32-
cy.contains('It Ends With Us');
98+
cy.contains("It Ends With Us");
3399
});
34100

35101
it("Query on private data unauthenticated", () => {
36102
cy.visit("/");
37103

38104
cy.contains("A list of my favorite books").click();
39-
cy.get("div").should("have.class", "MuiSnackbarContent-message")
105+
cy.get("div").should("have.class", "MuiSnackbarContent-message");
40106
});
41107

42108
it('Querying resource with "bad" cors header, though a proxy should work', () => {

0 commit comments

Comments
 (0)