graphdb-workbench-tests 3.4.0-dynamic-guides-test → 3.4.0-migrated-guide-services
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/guides/navigation/navigation-guide.spec.js +64 -0
- 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 +344 -122
- 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/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/guides/confirm-cancel-dialog/confirm-cancel-dialog-guide.json +15 -0
- package/fixtures/guides/navigation/navigation-guide.json +60 -0
- 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 +2 -2
- 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/guides/guide-dialog-steps.js +56 -2
- package/steps/header-steps.js +13 -0
- package/steps/home-steps.js +0 -20
- package/steps/login-steps.js +1 -0
- package/steps/main-menu-steps.js +1 -0
- package/steps/setup/settings-steps.js +1 -1
- package/steps/shared-modal-dialog-steps.js +45 -0
- package/steps/visual-graph-steps.js +57 -3
- 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/e2e-security.js +1 -1
- package/support/settings-commands.js +18 -2
- package/e2e-legacy/home/cookie-policy.spec.js +0 -108
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class CookieConsentBannerSteps {
|
|
2
|
+
static getCookieConsentBanner() {
|
|
3
|
+
return cy.get('.cookie-consent-banner');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
static getCookieConsentButton() {
|
|
7
|
+
return this.getCookieConsentBanner().find('button');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static giveCookieConsent() {
|
|
11
|
+
return this.getCookieConsentButton().click();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static getCookiePolicyLink() {
|
|
15
|
+
return cy.get('.cookie-consent-content a');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static clickCookiePolicyLink() {
|
|
19
|
+
return this.getCookiePolicyLink().click();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {SharedModalDialogSteps} from '../shared-modal-dialog-steps';
|
|
2
|
+
|
|
3
|
+
export class CookiePolicyModalSteps extends SharedModalDialogSteps {
|
|
4
|
+
static getDialogComponent(cssClass = '.cookie-policy-modal') {
|
|
5
|
+
return super.getDialogComponent(cssClass);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
static getStatisticCookiesToggle() {
|
|
9
|
+
return this.getBody().find('.statistic-cookies-toggle .toggle-switch');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static getStatisticCookiesCheckbox() {
|
|
13
|
+
return this.getStatisticCookiesToggle().find('input');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static toggleStatisticCookies() {
|
|
17
|
+
this.getStatisticCookiesToggle().click();
|
|
18
|
+
// Wait here is intentional because there is a debounce before the checkbox state is updated
|
|
19
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
20
|
+
cy.wait(500);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static getThirdPartyCookiesToggle() {
|
|
24
|
+
return this.getBody().find('.third-party-cookies-toggle .toggle-switch');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static getThirdPartyCookiesCheckbox() {
|
|
28
|
+
return this.getThirdPartyCookiesToggle().find('input');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static toggleThirdPartyCookies() {
|
|
32
|
+
this.getThirdPartyCookiesToggle().click();
|
|
33
|
+
// Wait here is intentional because there is a debounce before the checkbox state is updated
|
|
34
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
35
|
+
cy.wait(500);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static closeDialog() {
|
|
39
|
+
this.getFooter().find('.close-btn').click();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Validates the cookie policy dialog by checking the visibility of the dialog and the state of the checkboxes for
|
|
44
|
+
* analytic and third party cookies.
|
|
45
|
+
* @param {boolean} expectedStatisticChecked
|
|
46
|
+
* @param {boolean} expectedThirdPartyChecked
|
|
47
|
+
*/
|
|
48
|
+
static validateCookiePolicyDialog(expectedStatisticChecked, expectedThirdPartyChecked) {
|
|
49
|
+
// I should see the cookie policy
|
|
50
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
51
|
+
CookiePolicyModalSteps.getBody().should('be.visible');
|
|
52
|
+
// And I expect to see that analytic and third party cookies are allowed
|
|
53
|
+
CookiePolicyModalSteps.getStatisticCookiesCheckbox().should(expectedStatisticChecked ? 'be.checked' : 'not.be.checked');
|
|
54
|
+
CookiePolicyModalSteps.getThirdPartyCookiesCheckbox().should(expectedThirdPartyChecked ? 'be.checked' : 'not.be.checked');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import {BaseSteps} from "../base-steps.js";
|
|
2
|
+
|
|
3
|
+
export class GuideDialogSteps extends BaseSteps {
|
|
2
4
|
|
|
3
5
|
static getModalDialog() {
|
|
4
6
|
return cy.get('.shepherd-content:visible');
|
|
@@ -8,6 +10,50 @@ export class GuideDialogSteps {
|
|
|
8
10
|
return GuideDialogSteps.getModalDialog().find('.shepherd-header');
|
|
9
11
|
}
|
|
10
12
|
|
|
13
|
+
static getCancelButton() {
|
|
14
|
+
return this.getHeader().find('.shepherd-cancel-icon');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static clickOnCancelButton() {
|
|
18
|
+
return this.getCancelButton().click();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static getConfirmCancelDialog() {
|
|
22
|
+
return this.getByTestId('confirm-cancel-dialog');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static getConfirmCancelDialogCloseButton() {
|
|
26
|
+
return this.getByTestId('close-dialog-btn');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static clickOnConfirmCancelDialogCloseButton() {
|
|
30
|
+
return this.getConfirmCancelDialogCloseButton().click();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static getConfirmCancelDialogCancelButton() {
|
|
34
|
+
return this.getByTestId('cancel-btn');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static clickConfirmCancelDialogCancelButton() {
|
|
38
|
+
return this.getConfirmCancelDialogCancelButton().click();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static getConfirmCancelDialogDontShowAgainButton() {
|
|
42
|
+
return this.getByTestId('dont-show-again-btn');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static clickConfirmCancelDialogDontShowAgainButton() {
|
|
46
|
+
return this.getConfirmCancelDialogDontShowAgainButton().click();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static getConfirmCancelDialogExitButton() {
|
|
50
|
+
return this.getByTestId('exit-btn');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static clickConfirmCancelDialogExitButton() {
|
|
54
|
+
return this.getConfirmCancelDialogExitButton().click();
|
|
55
|
+
}
|
|
56
|
+
|
|
11
57
|
static getContent() {
|
|
12
58
|
return GuideDialogSteps.getModalDialog().find('.shepherd-text');
|
|
13
59
|
}
|
|
@@ -28,8 +74,12 @@ export class GuideDialogSteps {
|
|
|
28
74
|
return GuideDialogSteps.getFooter().find('.shepherd-button').contains('Close');
|
|
29
75
|
}
|
|
30
76
|
|
|
77
|
+
static getSkipButton() {
|
|
78
|
+
return GuideDialogSteps.getFooter().find('.shepherd-button').contains('Skip');
|
|
79
|
+
}
|
|
80
|
+
|
|
31
81
|
static clickOnNextButton(forceVisible = false) {
|
|
32
|
-
GuideDialogSteps.getNextButton().scrollIntoView().click({force: forceVisible});
|
|
82
|
+
return GuideDialogSteps.getNextButton().scrollIntoView().click({force: forceVisible});
|
|
33
83
|
}
|
|
34
84
|
|
|
35
85
|
static clickOnPreviousButton(forceVisible = false) {
|
|
@@ -40,6 +90,10 @@ export class GuideDialogSteps {
|
|
|
40
90
|
GuideDialogSteps.getCloseButton().scrollIntoView().click();
|
|
41
91
|
}
|
|
42
92
|
|
|
93
|
+
static clickOnSkipButton() {
|
|
94
|
+
GuideDialogSteps.getSkipButton().scrollIntoView().click();
|
|
95
|
+
}
|
|
96
|
+
|
|
43
97
|
static getContentLink() {
|
|
44
98
|
return GuideDialogSteps.getContent().find('a');
|
|
45
99
|
}
|
package/steps/header-steps.js
CHANGED
|
@@ -6,4 +6,17 @@ export class HeaderSteps {
|
|
|
6
6
|
static openHomePage() {
|
|
7
7
|
HeaderSteps.getHeader().find('.home-page').click();
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
static logout() {
|
|
11
|
+
this.getHeader().find('onto-user-menu').click();
|
|
12
|
+
cy.get('.onto-user-menu-dropdown')
|
|
13
|
+
.contains('Logout')
|
|
14
|
+
.first()
|
|
15
|
+
// Force the click because Cypress sometimes determines that the item has 0x0 dimensions
|
|
16
|
+
.click({force: true});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static login() {
|
|
20
|
+
this.getHeader().find('.onto-user-login').click();
|
|
21
|
+
}
|
|
9
22
|
}
|
package/steps/home-steps.js
CHANGED
|
@@ -313,26 +313,6 @@ class HomeSteps extends BaseSteps {
|
|
|
313
313
|
return cy.get('#license-label-home');
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
static getCookieConsentPopup() {
|
|
317
|
-
return cy.get('.cookie-consent-modal');
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
static getAgreeButton() {
|
|
321
|
-
return HomeSteps.getCookieConsentPopup().find('button');
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
static clickAgreeButton() {
|
|
325
|
-
return HomeSteps.getAgreeButton().click();
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
static getCookiePolicyLink() {
|
|
329
|
-
return cy.get('.cookie-consent-content a');
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
static clickCookiePolicyLink() {
|
|
333
|
-
return HomeSteps.getCookiePolicyLink().click();
|
|
334
|
-
}
|
|
335
|
-
|
|
336
316
|
static getCookiePolicyModal() {
|
|
337
317
|
return cy.get('.cookie-policy-modal');
|
|
338
318
|
}
|
package/steps/login-steps.js
CHANGED
package/steps/main-menu-steps.js
CHANGED
|
@@ -16,6 +16,7 @@ export class MainMenuSteps {
|
|
|
16
16
|
return MainMenuSteps.getMenuButton('Import');
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// TODO: temporary using more complex implementation until we have two SPARQL menu elements in the navbar
|
|
19
20
|
static getMenuSparql() {
|
|
20
21
|
return MainMenuSteps.getMenuButton('SPARQL');
|
|
21
22
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic steps for interacting with the onto-dialog component. This class is designed to be extended by more specific
|
|
3
|
+
* dialog steps classes.
|
|
4
|
+
*/
|
|
5
|
+
export class SharedModalDialogSteps {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the onto-dialog element.
|
|
8
|
+
* This is the generic method to get the dialog element.
|
|
9
|
+
*/
|
|
10
|
+
static getDialog() {
|
|
11
|
+
return cy.get('onto-dialog');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns a child component of the dialog based on the provided CSS class. The onto-dialog component is designed to
|
|
16
|
+
* be flexible and can contain be composed of various child components included in different slots: header, body,
|
|
17
|
+
* and footer.
|
|
18
|
+
* The purpose of this method is to allow selection of specific dialog in case there are multiple dialogs in the page.
|
|
19
|
+
* @param cssClass - The CSS class of the child component to retrieve. Defaults to '.dialog', which will return the
|
|
20
|
+
* dialog itself.
|
|
21
|
+
*/
|
|
22
|
+
static getDialogComponent(cssClass = '.dialog') {
|
|
23
|
+
return cy.get(cssClass);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static getHeader() {
|
|
27
|
+
return this.getDialog().find('.dialog-header');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getBody() {
|
|
31
|
+
return this.getDialog().find('.dialog-body');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static getFooter() {
|
|
35
|
+
return this.getDialog().find('.dialog-footer');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static getCloseButton() {
|
|
39
|
+
return this.getHeader().find('.close');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static close() {
|
|
43
|
+
this.getCloseButton().click();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -87,6 +87,30 @@ export class VisualGraphSteps extends BaseSteps {
|
|
|
87
87
|
return cy.get('.autocomplete-toast a');
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
static getRdfResourceSearchInput() {
|
|
91
|
+
return cy.getByTestId('rdf-resource-input');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static searchForRdfResource(resource) {
|
|
95
|
+
this.getRdfResourceSearchInput().type(resource, {force: true});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static shareVisualGraphWithOtherUsers() {
|
|
99
|
+
this.getShareGraphButton().click();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static getShareGraphButton() {
|
|
103
|
+
return cy.getByTestId('share-graph-config');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static selectConfig(configName) {
|
|
107
|
+
this.getConfigByName(configName).click();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static getConfigByName(name) {
|
|
111
|
+
return cy.getByTestId(`graph-config-${name}`);
|
|
112
|
+
}
|
|
113
|
+
|
|
90
114
|
static getGraphVisualizationNodes() {
|
|
91
115
|
return this.getGraphVisualizationPane().find('.node-wrapper');
|
|
92
116
|
}
|
|
@@ -133,7 +157,7 @@ export class VisualGraphSteps extends BaseSteps {
|
|
|
133
157
|
}
|
|
134
158
|
|
|
135
159
|
static getNodeLabel(nodeId) {
|
|
136
|
-
return this.getNode(nodeId).find('.node-label-body');
|
|
160
|
+
return this.getNode(nodeId).find('.node-label-body div');
|
|
137
161
|
}
|
|
138
162
|
|
|
139
163
|
static getPredicates() {
|
|
@@ -153,7 +177,7 @@ export class VisualGraphSteps extends BaseSteps {
|
|
|
153
177
|
}
|
|
154
178
|
|
|
155
179
|
static dblclickOnNode(nodeId) {
|
|
156
|
-
this.getCircleOfNodeByNodeId(nodeId).dblclick
|
|
180
|
+
this.getCircleOfNodeByNodeId(nodeId).trigger('dblclick');
|
|
157
181
|
}
|
|
158
182
|
|
|
159
183
|
static getLineBetweenNodesById(narrowId) {
|
|
@@ -176,6 +200,16 @@ export class VisualGraphSteps extends BaseSteps {
|
|
|
176
200
|
this.getSidePanelCloseButton().click();
|
|
177
201
|
}
|
|
178
202
|
|
|
203
|
+
// Note the index is 1-based
|
|
204
|
+
static openConfigTab(tabIndex) {
|
|
205
|
+
return this.getConfigTab(tabIndex).click();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Note the index is 1-based
|
|
209
|
+
static getConfigTab(tabIndex) {
|
|
210
|
+
return cy.getByTestId(`graph-config-tab-${tabIndex}`);
|
|
211
|
+
}
|
|
212
|
+
|
|
179
213
|
// Visual graph settings form field access
|
|
180
214
|
|
|
181
215
|
static openPredicatesTab() {
|
|
@@ -263,12 +297,32 @@ export class VisualGraphSteps extends BaseSteps {
|
|
|
263
297
|
return cy.get('.create-graph-config').should('be.visible');
|
|
264
298
|
}
|
|
265
299
|
|
|
300
|
+
static createCustomGraph() {
|
|
301
|
+
this.getCreateCustomGraphLink().click();
|
|
302
|
+
}
|
|
303
|
+
|
|
266
304
|
static getGraphConfigName() {
|
|
267
305
|
return cy.get('.graph-config-name').should('be.visible');
|
|
268
306
|
}
|
|
269
307
|
|
|
270
308
|
static typeGraphConfigName(name) {
|
|
271
|
-
this.getGraphConfigName().type(name);
|
|
309
|
+
this.getGraphConfigName().type(name, {force: true});
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
static typeGraphConfigDescription(description) {
|
|
313
|
+
return this.getGraphConfigDescription().type(description, {force: true});
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
static getGraphConfigDescription() {
|
|
317
|
+
return cy.get('.graph-config-description').should('be.visible');
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
static typeGraphConfigHint(hint) {
|
|
321
|
+
return this.getGraphConfigHint().type(hint, {force: true});
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
static getGraphConfigHint() {
|
|
325
|
+
return cy.get('.graph-config-example').should('be.visible');
|
|
272
326
|
}
|
|
273
327
|
|
|
274
328
|
static getSaveConfigButton() {
|
|
@@ -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/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.
|
|
@@ -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
|
};
|
|
@@ -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
|
-
});
|