graphdb-workbench-tests 3.4.0-dynamic-guides-test → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/e2e-legacy/cluster/cluster-states.spec.js +3 -3
- package/e2e-legacy/explore/visual-graph/node-info-panel.spec.js +58 -0
- package/e2e-legacy/explore/visual-graph/visual-graph-links-limit.spec.js +167 -0
- package/e2e-legacy/explore/visual-graph/visual.graph.spec.js +55 -78
- package/e2e-legacy/graphql/graphql-in-remote-location.spec.js +49 -0
- package/e2e-legacy/guides/navigation/navigation-guide.spec.js +64 -0
- package/e2e-legacy/guides/table-graph-explore/table-graph-explore-guide.spec.js +2 -1
- package/e2e-legacy/guides/ttyg/configure-agent/configure-agent-guide.spec.js +34 -26
- package/e2e-legacy/guides/ttyg/edit-agent/edit-ttyg-agent-guide.spec.js +1 -0
- package/e2e-legacy/guides/visual-graph/visual-graph-guide.spec.js +330 -124
- package/e2e-legacy/help/guides/guides-autostart.spec.js +36 -3
- package/e2e-legacy/help/guides/guides-confirm-cancel-dialog.js +83 -0
- package/e2e-legacy/home/cookie-policy/cookie-policy.spec.js +182 -0
- package/e2e-legacy/home/create-repository.spec.js +6 -0
- package/e2e-legacy/repository/attach-remote-location.spec.js +47 -12
- package/e2e-legacy/resource/resource.spec.js +33 -13
- package/e2e-legacy/setup/aclmanagement/acl-management-with-selected repository.spec.js +44 -0
- package/e2e-legacy/sparql-editor/actions/expand-results-over-sameas.spec.js +8 -8
- package/e2e-legacy/sparql-editor/actions/include-inferred-statements.spec.js +4 -4
- package/e2e-legacy/sparql-editor/actions/inferred-sameas.spec.js +3 -3
- package/e2e-legacy/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +90 -36
- package/e2e-legacy/sparql-editor/yasr/yasr.spec.js +80 -0
- package/e2e-legacy/ttyg/chat-panel.spec.js +9 -0
- package/e2e-legacy/ttyg/clone-agent.spec.js +22 -0
- package/e2e-legacy/ttyg/edit-agent.spec.js +17 -0
- package/e2e-security/setup/home/cookie-policy.spec.js +232 -6
- package/e2e-security/setup/users-and-access/turn-on-security-and-password-change.spec.js +72 -59
- package/fixtures/graph/graph-configurations.json +59 -0
- package/fixtures/guides/confirm-cancel-dialog/confirm-cancel-dialog-guide.json +15 -0
- package/fixtures/guides/navigation/navigation-guide.json +60 -0
- package/fixtures/guides/ttyg/configure-agent/configure-ttyg-agent-guide.json +6 -1
- package/fixtures/guides/visual-graph/visual-graph-config-guide.json +39 -0
- package/fixtures/ttyg/chats/explain-response-1.json +2 -48
- package/npm-shrinkwrap.json +32 -33
- package/package.json +1 -1
- package/steps/cookie-policy/cookie-consent-banner-steps.js +21 -0
- package/steps/cookie-policy/cookie-policy-modal.steps.js +56 -0
- package/steps/graphql/create-graphql-endpoint-steps.js +8 -0
- package/steps/graphql/graphql-endpoint-management-steps.js +8 -0
- package/steps/graphql/graphql-playground-steps.js +8 -0
- package/steps/guides/guide-dialog-steps.js +56 -2
- package/steps/guides/movies-guide-steps.js +2 -1
- package/steps/header-steps.js +13 -0
- package/steps/home-steps.js +4 -27
- package/steps/login-steps.js +1 -0
- package/steps/main-menu-steps.js +1 -0
- package/steps/repositories/attach-repository-steps.js +16 -0
- package/steps/repository-steps.js +24 -0
- package/steps/resource/resource-steps.js +0 -8
- package/steps/setup/acl-management-steps.js +12 -0
- package/steps/setup/settings-steps.js +1 -1
- package/steps/shared-modal-dialog-steps.js +45 -0
- package/steps/sparql-editor-steps.js +18 -4
- package/steps/ttyg/ttyg-agent-settings-modal.steps.js +1 -1
- package/steps/visual-graph-split-button-steps.js +45 -0
- package/steps/visual-graph-steps.js +69 -3
- package/steps/yasgui/yasr-steps.js +30 -6
- package/stubs/cluster/remote-location-stubs.js +4 -0
- package/stubs/graph-config-stubs.js +17 -0
- package/stubs/guides/guides-stubs.js +8 -0
- package/stubs/repositories/repositories-stubs.js +22 -0
- package/stubs/security-stubs.js +4 -0
- package/stubs/sparql-stubs.js +10 -0
- package/support/commands.js +1 -0
- package/support/e2e-security.js +1 -1
- package/support/repository-commands.js +22 -3
- package/support/settings-commands.js +18 -2
- package/support/url-commands.js +13 -0
- package/e2e-legacy/home/cookie-policy.spec.js +0 -108
|
@@ -7,6 +7,10 @@ export class RemoteLocationStubs extends Stubs {
|
|
|
7
7
|
}).as('add-remote-location');
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
static spyRemoteLocationCreate() {
|
|
11
|
+
cy.intercept('POST', '/rest/locations').as('add-remote-location');
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
static stubGetRemoteLocations(count = 'no') {
|
|
11
15
|
cy.intercept('GET', '/rest/locations', {
|
|
12
16
|
fixture: `/remote-location/get-${count}-remote-locations.json`,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {Stubs} from './stubs.js';
|
|
2
|
+
|
|
3
|
+
export class GraphConfigStubs extends Stubs {
|
|
4
|
+
static stubGetEmptyGraphConfigs() {
|
|
5
|
+
cy.intercept('GET', '/rest/explore-graph/config', {
|
|
6
|
+
statusCode: 200,
|
|
7
|
+
body: [],
|
|
8
|
+
}).as('getEmptyGraphConfigs');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static stubGetGraphConfigs(fixture = '/graph/graph-configurations.json') {
|
|
12
|
+
GraphConfigStubs.stubQueryResponse(
|
|
13
|
+
'/rest/explore-graph/config',
|
|
14
|
+
fixture,
|
|
15
|
+
'getGraphConfigs');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -85,6 +85,14 @@ export class GuidesStubs {
|
|
|
85
85
|
GuidesStubs.stubWithFixture('../fixtures/guides/visual-graph/visual-graph-guide.json');
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
static stubVisualGraphConfigGuide() {
|
|
89
|
+
GuidesStubs.stubWithFixture('../fixtures/guides/visual-graph/visual-graph-config-guide.json');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static stubNavigationGuide() {
|
|
93
|
+
GuidesStubs.stubWithFixture('../fixtures/guides/navigation/navigation-guide.json');
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
static stubWithFixture(fixturePath) {
|
|
89
97
|
cy.intercept('/rest/guides', {fixture: fixturePath}).as('getGuides');
|
|
90
98
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {Stubs} from '../stubs';
|
|
2
2
|
import {REPOSITORIES_URL} from '../../support/repository-commands';
|
|
3
3
|
import {GlobalOperationsStatusesStub} from '../global-operations-statuses-stub.js';
|
|
4
|
+
import repoTemplate from "../../fixtures/repo-template.json";
|
|
4
5
|
|
|
5
6
|
export class RepositoriesStubs extends Stubs {
|
|
6
7
|
static stubRepositories(withDelay = 0, fixture = '/repositories/get-repositories.json') {
|
|
@@ -225,4 +226,25 @@ export class RepositoriesStubs extends Stubs {
|
|
|
225
226
|
RepositoriesStubs.stubAutocomplete();
|
|
226
227
|
GlobalOperationsStatusesStub.stubNoOperationsResponse('starwars');
|
|
227
228
|
}
|
|
229
|
+
|
|
230
|
+
static stubRepositoryModel(repositoryId, options = {}) {
|
|
231
|
+
const body = Cypress._.defaultsDeep(
|
|
232
|
+
{ id: repositoryId, ...options },
|
|
233
|
+
repoTemplate
|
|
234
|
+
);
|
|
235
|
+
cy.intercept('GET', `/rest/repositories/${repositoryId}`, {
|
|
236
|
+
statusCode: 200,
|
|
237
|
+
body
|
|
238
|
+
}).as('repository-model');
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
static stubFtsSearchDisabled(repositoryId) {
|
|
242
|
+
RepositoriesStubs.stubRepositoryModel(repositoryId, {
|
|
243
|
+
params: {
|
|
244
|
+
enableFtsIndex: {
|
|
245
|
+
value: 'false'
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
228
250
|
}
|
package/stubs/security-stubs.js
CHANGED
|
@@ -20,6 +20,10 @@ export class SecurityStubs {
|
|
|
20
20
|
}).as('security-all');
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
static spyOnUserUpdate(userName) {
|
|
24
|
+
cy.intercept('PATCH', `rest/security/users/${userName}`).as('updateUser');
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
static stubUpdateUserData(userName) {
|
|
24
28
|
cy.intercept('PATCH', `/rest/security/users/${userName}`, {
|
|
25
29
|
statusCode: 200,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {Stubs} from './stubs.js';
|
|
2
|
+
|
|
3
|
+
export class SparqlStubs extends Stubs {
|
|
4
|
+
static spyAddKnownPrefixes() {
|
|
5
|
+
cy.intercept('/rest/sparql/add-known-prefixes', {
|
|
6
|
+
method: 'POST',
|
|
7
|
+
body: 'PREFIX voc: <https://swapi.co/vocabulary/> SELECT ?name ?height WHERE { ?character voc:height ?height; rdfs:label ?name. FILTER(?name = "Luke Skywalker" || ?name = "Leia Organa") }'
|
|
8
|
+
}).as('addKnownPrefixes')
|
|
9
|
+
}
|
|
10
|
+
}
|
package/support/commands.js
CHANGED
package/support/e2e-security.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './e2e';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
beforeEach(() => {
|
|
4
4
|
cy.loginAsAdmin();
|
|
5
5
|
// Switch off security after each test to ensure that tests are independent and don't affect each other.
|
|
6
6
|
// For example, if security is enabled in one test, it can cause other tests that don't expect security to fail.
|
|
@@ -47,13 +47,13 @@ Cypress.Commands.add('deleteRepository', (id, secured = false) => {
|
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
Cypress.Commands.add('presetRepository', (id) => {
|
|
51
|
-
cy.setLocalStorage(PRESET_REPO, JSON.stringify({id: id, location
|
|
50
|
+
Cypress.Commands.add('presetRepository', (id, location = '') => {
|
|
51
|
+
cy.setLocalStorage(PRESET_REPO, JSON.stringify({id: id, location}));
|
|
52
52
|
cy.waitUntil(() =>
|
|
53
53
|
cy.getLocalStorage(PRESET_REPO)
|
|
54
54
|
.then((preset) => {
|
|
55
55
|
const presetRepo = JSON.parse(preset);
|
|
56
|
-
return presetRepo && presetRepo.id === id
|
|
56
|
+
return presetRepo && presetRepo.id === id && presetRepo.location === location;
|
|
57
57
|
}));
|
|
58
58
|
cy.log('Pre-set repository:', id);
|
|
59
59
|
});
|
|
@@ -78,6 +78,25 @@ Cypress.Commands.add('initializeRepository', (id) => {
|
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* A command for deleting remote locations by URI. It sends a DELETE request to the appropriate endpoint and waits until
|
|
83
|
+
* the response is received.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} uri - The URI of the remote location to be deleted.
|
|
86
|
+
*/
|
|
87
|
+
Cypress.Commands.add('deleteRemoteLocation', (uri) => {
|
|
88
|
+
cy.request({
|
|
89
|
+
method: 'DELETE',
|
|
90
|
+
url: '/rest/locations?uri=' + encodeURIComponent(uri),
|
|
91
|
+
headers: {
|
|
92
|
+
'Content-Type': 'application/json'
|
|
93
|
+
},
|
|
94
|
+
failOnStatusCode: false
|
|
95
|
+
}).then((response) => {
|
|
96
|
+
cy.waitUntil(() => response);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
81
100
|
Cypress.Commands.add('enableAutocomplete', (repositoryId) => {
|
|
82
101
|
toggleAutocomplete(repositoryId, true);
|
|
83
102
|
});
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Sets the default user settings for the admin user, including cookie consent.
|
|
3
|
+
* @param {CookieConsent} cookieConsent - The value to set for cookie consent.
|
|
4
|
+
* - policyAccepted: boolean indicating whether the cookie policy has been accepted.
|
|
5
|
+
* - statistic: boolean indicating consent for statistical cookies.
|
|
6
|
+
* - thirdParty: boolean indicating consent for third-party cookies.
|
|
7
|
+
* - updatedAt: epoch timestamp of last update in seconds.
|
|
8
|
+
*/
|
|
9
|
+
Cypress.Commands.add('setDefaultUserData', (cookieConsent) => {
|
|
2
10
|
const defaultUserSettings = {
|
|
3
11
|
'COOKIE_CONSENT': cookieConsent,
|
|
4
12
|
'DEFAULT_SAMEAS': true,
|
|
@@ -19,7 +27,15 @@ Cypress.Commands.add('setDefaultUserData', (cookieConsent = true) => {
|
|
|
19
27
|
});
|
|
20
28
|
});
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Sets the cookie consent in user settings for the admin user.
|
|
32
|
+
* @param {CookieConsent} cookieConsent - The value to set for cookie consent.
|
|
33
|
+
* - policyAccepted: boolean indicating whether the cookie policy has been accepted.
|
|
34
|
+
* - statistic: boolean indicating consent for statistical cookies.
|
|
35
|
+
* - thirdParty: boolean indicating consent for third-party cookies.
|
|
36
|
+
* - updatedAt: epoch timestamp of last update in seconds.
|
|
37
|
+
*/
|
|
38
|
+
Cypress.Commands.add('setCookieConsent', (cookieConsent ) => {
|
|
23
39
|
const defaultUserSettings = {
|
|
24
40
|
'COOKIE_CONSENT': cookieConsent
|
|
25
41
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Cypress command to retrieve the value of a query parameter from the current page URL.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} key - The name of the query parameter to retrieve.
|
|
5
|
+
* @returns {Cypress.Chainable<string | null>} A chainable that resolves to the value of the query parameter,
|
|
6
|
+
* or null if the parameter is not present.
|
|
7
|
+
*/
|
|
8
|
+
Cypress.Commands.add('getQueryParam', (key) => {
|
|
9
|
+
return cy.location('search').then((search) => {
|
|
10
|
+
const params = new URLSearchParams(search);
|
|
11
|
+
return params.get(key);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import HomeSteps from '../../steps/home-steps';
|
|
2
|
-
import {SecurityStubs} from '../../stubs/security-stubs';
|
|
3
|
-
import {SettingsSteps} from '../../steps/setup/settings-steps';
|
|
4
|
-
import {LicenseStubs} from '../../stubs/license-stubs';
|
|
5
|
-
|
|
6
|
-
Cypress.env('set_default_user_data', false);
|
|
7
|
-
|
|
8
|
-
describe('Cookie policy', () => {
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
cy.setCookieConsent(undefined);
|
|
11
|
-
cy.viewport(1280, 1000);
|
|
12
|
-
LicenseStubs.stubFreeLicense();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
afterEach(() => cy.setCookieConsent(true));
|
|
16
|
-
|
|
17
|
-
context('should show', () => {
|
|
18
|
-
it('Should show consent popup to user', () => {
|
|
19
|
-
HomeSteps.visitInProdMode();
|
|
20
|
-
HomeSteps.getCookieConsentPopup().should('exist').and('be.visible');
|
|
21
|
-
// When I click on the link
|
|
22
|
-
HomeSteps.clickCookiePolicyLink();
|
|
23
|
-
// Then I see the cookie policy
|
|
24
|
-
HomeSteps.getCookiePolicyModal().should('exist').and('be.visible');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('Should show cookie policy to user in user settings', () => {
|
|
28
|
-
SettingsSteps.visitInProdMode();
|
|
29
|
-
SettingsSteps.getCookiePolicyButton().should('exist').and('be.visible');
|
|
30
|
-
|
|
31
|
-
// When I click on the link
|
|
32
|
-
SettingsSteps.clickCookiePolicyLink();
|
|
33
|
-
// Then I see the cookie policy
|
|
34
|
-
SettingsSteps.getCookiePolicyModal().should('exist').and('be.visible');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('Should save consent in user settings', () => {
|
|
38
|
-
HomeSteps.visitInProdMode();
|
|
39
|
-
SecurityStubs.stubUpdateUserData('admin');
|
|
40
|
-
|
|
41
|
-
// When I click Agree button
|
|
42
|
-
HomeSteps.clickAgreeButton();
|
|
43
|
-
|
|
44
|
-
// I expect to save cookie consent in user settings
|
|
45
|
-
cy.wait('@updateUser').then((xhr) => {
|
|
46
|
-
expect(xhr.request.body.appSettings).to.include({
|
|
47
|
-
DEFAULT_INFERENCE: true,
|
|
48
|
-
DEFAULT_VIS_GRAPH_SCHEMA: true,
|
|
49
|
-
DEFAULT_SAMEAS: true,
|
|
50
|
-
IGNORE_SHARED_QUERIES: false,
|
|
51
|
-
EXECUTE_COUNT: true
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// Assert COOKIE_CONSENT properties, excluding updatedAt
|
|
55
|
-
expect(xhr.request.body.appSettings.COOKIE_CONSENT).to.include({
|
|
56
|
-
policyAccepted: true
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Assert that updatedAt is present, is a number, and is a reasonable timestamp
|
|
60
|
-
const updatedAt = xhr.request.body.appSettings.COOKIE_CONSENT.updatedAt;
|
|
61
|
-
expect(updatedAt).to.exist;
|
|
62
|
-
expect(updatedAt).to.be.a('number');
|
|
63
|
-
|
|
64
|
-
// Check that updatedAt is within 1 hour of the current time
|
|
65
|
-
const oneHourInMilliseconds = 60 * 60 * 1000;
|
|
66
|
-
const now = Date.now();
|
|
67
|
-
expect(updatedAt).to.be.within(now - oneHourInMilliseconds, now + oneHourInMilliseconds);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('Should set cookies for tracking when accepted', () => {
|
|
72
|
-
cy.intercept('PATCH', `/rest/security/users/admin`).as('updateUser');
|
|
73
|
-
HomeSteps.visitInProdMode();
|
|
74
|
-
|
|
75
|
-
// When I click Agree button
|
|
76
|
-
HomeSteps.clickAgreeButton();
|
|
77
|
-
|
|
78
|
-
// I expect to save cookie consent in user settings
|
|
79
|
-
// There are two requests one from the new shared component and one in the legacy
|
|
80
|
-
cy.wait('@updateUser');
|
|
81
|
-
cy.wait('@updateUser');
|
|
82
|
-
|
|
83
|
-
// Check if the GA tracking script is set correctly in the head
|
|
84
|
-
cy.document()
|
|
85
|
-
.get('head script')
|
|
86
|
-
.should("have.attr", "src")
|
|
87
|
-
.should('include', 'https://www.googletagmanager.com/gtm.js?id=GTM-WBP6C6Z4');
|
|
88
|
-
|
|
89
|
-
// Check if the installation ID cookie is set correctly
|
|
90
|
-
cy.getCookie('_wb').then((cookie) => {
|
|
91
|
-
expect(cookie).to.exist;
|
|
92
|
-
expect(cookie.value).to.match(/^WB1\.[a-zA-Z0-9\-]+\.\d+$/); // Check the cookie structure: WB1.<installationId>.<timestamp>
|
|
93
|
-
});
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
context('should not show', () => {
|
|
98
|
-
it('Should NOT show consent popup to user when tracking is not applicable', () => {
|
|
99
|
-
HomeSteps.visitInDevMode();
|
|
100
|
-
HomeSteps.getCookieConsentPopup().should('not.exist');
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('Should NOT show cookie policy to user when tracking is not applicable', () => {
|
|
104
|
-
SettingsSteps.visitInDevMode();
|
|
105
|
-
SettingsSteps.getCookiePolicyButton().should('not.exist');
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
});
|