Skip to content

Commit 68d3310

Browse files
authored
Merge pull request #71 from SolidLabResearch/fix/avg-query
Aggregating SPARQL queries
2 parents e2b169d + 0f10ab7 commit 68d3310

File tree

17 files changed

+286
-225
lines changed

17 files changed

+286
-225
lines changed

CHANGELOG.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11-
- Configurable query icons (#9).
12-
- "Username not given" when logged in, but user's name not known (#51, #65).
13-
- Templated query functionality (#52).
1411

1512
### Changed
16-
- Changed loading message to "The page is loading. Just a moment please." (#26).
17-
- Enabled no bad blocks and indentation for eslint/jsdoc (#14).
1813

1914
### Fixed
20-
- Configured title is now also visible before first query (#46).
21-
- "Unknown User" when not logged in (#51).
15+
- Aggregating SPARQL queries work now (#70).
2216

2317
### Removed
24-
- Bulk action checkboxes are removed (#44).
2518

2619
# [1.1.0] - 2024-01-22
2720

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe("Aggregating query", () => {
2+
it("AVG() function", () => {
3+
cy.visit("/");
4+
5+
cy.contains("Average value").click();
6+
cy.contains("Finished in:");
7+
cy.get('.column-average').find('span').contains("75");
8+
});
9+
});

cypress/e2e/bad-cors.cy.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
describe("Bad CORS", () => {
2+
it('Querying resource with "bad" cors header, though a proxy should work', () => {
3+
cy.visit("/");
4+
5+
cy.contains("My idols").click();
6+
cy.get(".MuiSnackbarContent-message").should("not.exist");
7+
});
8+
});

cypress/e2e/column-header.cy.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe("Column header", () => {
2+
it("Variables link to ontology", () => {
3+
cy.visit("/");
4+
5+
cy.contains("My favourite musicians").click();
6+
cy.contains("Finished in:");
7+
cy.get('a[href="http://schema.org/name"]');
8+
})
9+
});

cypress/e2e/dashboard.cy.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
describe("Dashboard", () => {
2+
it("Successfully loads", () => {
3+
cy.visit("/");
4+
});
5+
6+
it("Custom icon per query is displayed", () => {
7+
cy.visit("/");
8+
9+
cy.get('[data-testid="PhotoIcon"]').should("exist");
10+
cy.get('[data-testid="BrushIcon"]').should("exist");
11+
})
12+
});

cypress/e2e/lenient.cy.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe("Lenient mode", () => {
2+
it("When one source throws an error, the results of other sources are still shown", () => {
3+
cy.visit("/");
4+
5+
cy.contains("My favourite musicians").click();
6+
cy.contains("Finished in:");
7+
cy.contains("Ludwig van Beethoven");
8+
});
9+
});

cypress/e2e/log-in.cy.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
});

cypress/e2e/sources-info.cy.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
describe("Sources info", () => {
2+
it("Fetch status on query failed", () => {
3+
cy.visit("/");
4+
5+
cy.contains("My favourite musicians").click();
6+
cy.contains("Finished in:");
7+
cy.get('[aria-label="Sources info"]').click();
8+
9+
cy.get('[aria-label="Query failed"]').should("exist");
10+
});
11+
12+
it("Fetch status on query success", () => {
13+
cy.visit("/");
14+
15+
cy.contains("My wish list").click();
16+
cy.contains("Finished in:");
17+
cy.get('[aria-label="Sources info"]').click();
18+
19+
cy.get('[aria-label="Query was succesful"]').should("exist");
20+
});
21+
22+
it("Authentication needed for query on public data", () => {
23+
cy.visit("/");
24+
25+
cy.contains("My wish list").click();
26+
cy.contains("Finished in:");
27+
cy.get('[aria-label="Sources info"]').click();
28+
29+
cy.get('[aria-label="No authentication required"]').should("exist");
30+
});
31+
32+
it("Authentication needed for query on private data", () => {
33+
cy.visit("/");
34+
35+
cy.get('[aria-label="Profile"]').click();
36+
cy.contains('[role="menuitem"]', "Login").click();
37+
38+
cy.get('input[name="idp"]').clear();
39+
cy.get('input[name="idp"]').type("http://localhost:8080");
40+
cy.contains("Login").click();
41+
42+
cy.get("input#email").type("[email protected]");
43+
cy.get("input#password").type("abc123");
44+
cy.contains("button", "Log in").click();
45+
cy.contains("button", "Authorize").click();
46+
47+
cy.url().should("eq", "http://localhost:5173/");
48+
49+
cy.contains("A list of my favorite books").click();
50+
cy.contains("Finished in:");
51+
cy.get('[aria-label="Sources info"]').click();
52+
53+
cy.get('[aria-label="Authentication required"]').should("exist");
54+
});
55+
56+
it("Authentication needed for query on failing query", () => {
57+
cy.visit("/");
58+
59+
cy.contains("My favourite musicians").click();
60+
cy.contains("Finished in:");
61+
cy.get('[aria-label="Sources info"]').click();
62+
63+
cy.get('[aria-label="Uncertain if authentication is required"]').should("exist");
64+
});
65+
});

0 commit comments

Comments
 (0)