graphdb-workbench-tests 3.3.1 → 3.3.2-RC2
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/graphql/graphql-theme.spec.js +73 -0
- package/e2e-legacy/guides/main-menu/main-menu-guide.spec.js +302 -0
- package/e2e-legacy/guides/ttyg/conversation/ttyg-conversation-guide.spec.js +6 -2
- package/e2e-legacy/guides/ttyg/edit-agent/edit-ttyg-agent-guide.spec.js +87 -0
- package/e2e-legacy/home/cookie-policy/cookie-policy.spec.js +182 -0
- package/e2e-legacy/import/import-server-files.spec.js +3 -1
- package/e2e-legacy/repository/repositories.spec.js +5 -2
- package/e2e-legacy/repository/url-with-repository-id-parameter.spec.js +25 -0
- package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +36 -0
- package/e2e-security/repository/url-with-repository-id-parameter.spec.js +57 -0
- package/e2e-security/setup/home/cookie-policy.spec.js +232 -6
- package/fixtures/guides/main-menu/main-menu-guide.json +98 -0
- package/fixtures/guides/ttyg/edit-ttyg-agent/edit-ttyg-agent-guide.json +22 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/steps/base-steps.js +4 -0
- package/steps/cookie-policy/cookie-consent-banner-steps.js +21 -0
- package/steps/cookie-policy/cookie-policy-modal.steps.js +56 -0
- package/steps/error-page-steps.js +9 -0
- package/steps/graphql/playground-editor-steps.js +46 -0
- package/steps/header-steps.js +13 -0
- package/steps/home-steps.js +0 -20
- package/steps/import/import-resource-message-dialog.js +1 -1
- package/steps/login-steps.js +5 -0
- package/steps/main-menu-steps.js +12 -0
- package/steps/repository-steps.js +2 -2
- package/steps/setup/settings-steps.js +1 -1
- package/steps/setup/user-and-access-steps.js +14 -6
- package/steps/shared-modal-dialog-steps.js +45 -0
- package/steps/visual-graph-steps.js +1 -1
- package/stubs/guides/guides-stubs.js +8 -0
- package/stubs/security-stubs.js +8 -0
- package/stubs/ttyg/ttyg-stubs.js +2 -4
- package/support/e2e-security.js +9 -0
- package/support/settings-commands.js +18 -2
- package/e2e-legacy/home/cookie-policy.spec.js +0 -108
|
@@ -0,0 +1,182 @@
|
|
|
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
|
+
import {CookiePolicyModalSteps} from '../../../steps/cookie-policy/cookie-policy-modal.steps';
|
|
6
|
+
import {MainMenuSteps} from '../../../steps/main-menu-steps.js';
|
|
7
|
+
import {CookieConsentBannerSteps} from '../../../steps/cookie-policy/cookie-consent-banner-steps.js';
|
|
8
|
+
|
|
9
|
+
Cypress.env('set_default_user_data', false);
|
|
10
|
+
|
|
11
|
+
describe('Cookie policy', () => {
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
cy.setCookieConsent(undefined);
|
|
14
|
+
cy.viewport(1280, 1000);
|
|
15
|
+
LicenseStubs.stubFreeLicense();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
cy.setCookieConsent(undefined);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should have default state when security is OFF', () => {
|
|
23
|
+
// Given GDB security is OFF
|
|
24
|
+
// When I open home page
|
|
25
|
+
HomeSteps.visitInProdMode();
|
|
26
|
+
// Then I expect to see cookie consent banner
|
|
27
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
|
|
28
|
+
// When I click on the cookie policy link in the banner
|
|
29
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
30
|
+
// Then I see the cookie policy
|
|
31
|
+
CookiePolicyModalSteps.getDialogComponent().and('be.visible');
|
|
32
|
+
CookiePolicyModalSteps.getBody().should('be.visible');
|
|
33
|
+
// And I expect to see that analytic and third party cookies are allowed
|
|
34
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
|
|
35
|
+
// When I close the cookie policy modal
|
|
36
|
+
CookiePolicyModalSteps.closeDialog();
|
|
37
|
+
// Then I expect the cookie policy modal to be closed
|
|
38
|
+
CookiePolicyModalSteps.getDialogComponent().should('not.exist');
|
|
39
|
+
// When I open my settings page
|
|
40
|
+
SettingsSteps.visitInProdMode();
|
|
41
|
+
// Then I expect to see cookie policy button in My settings widget
|
|
42
|
+
SettingsSteps.getCookiePolicyButton().and('be.visible');
|
|
43
|
+
// When I click on the cookie policy button in My settings widget
|
|
44
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
45
|
+
// Then I see the cookie policy
|
|
46
|
+
CookiePolicyModalSteps.getDialogComponent().and('be.visible');
|
|
47
|
+
CookiePolicyModalSteps.getBody().should('be.visible');
|
|
48
|
+
// And I expect to see that analytic and third party cookies are allowed
|
|
49
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
|
|
50
|
+
// When I close the cookie policy modal
|
|
51
|
+
CookiePolicyModalSteps.closeDialog();
|
|
52
|
+
// Then I expect the cookie policy modal to be closed
|
|
53
|
+
CookiePolicyModalSteps.getDialogComponent().should('not.exist');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should give consent for default cookie policy when security is OFF', () => {
|
|
57
|
+
// Given GDB security is OFF
|
|
58
|
+
// When I open home page
|
|
59
|
+
HomeSteps.visitInProdMode();
|
|
60
|
+
// Then I expect to see cookie consent banner
|
|
61
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
|
|
62
|
+
// When I click OK in the cookie consent banner
|
|
63
|
+
SecurityStubs.spyOnUserUpdate('admin');
|
|
64
|
+
CookieConsentBannerSteps.giveCookieConsent();
|
|
65
|
+
// Then I expect to save cookie consent in user settings
|
|
66
|
+
validateUserUpdateWithCookieConsent();
|
|
67
|
+
// And I expect the banner to be hidden
|
|
68
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
69
|
+
// And I expect GA tracking script to be added to the head
|
|
70
|
+
validateGATracking();
|
|
71
|
+
// When I open another page
|
|
72
|
+
MainMenuSteps.clickOnMenuImport();
|
|
73
|
+
cy.url().should('include', '/import');
|
|
74
|
+
// Then I expect the banner to be hidden
|
|
75
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
76
|
+
// When I reload the page
|
|
77
|
+
cy.reload();
|
|
78
|
+
// Then I expect the banner to be hidden
|
|
79
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should update cookie policy and give consent when security is OFF', () => {
|
|
83
|
+
// Given GDB security is OFF
|
|
84
|
+
// When I open home page
|
|
85
|
+
HomeSteps.visitInProdMode();
|
|
86
|
+
// Then I expect to see cookie consent banner
|
|
87
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
|
|
88
|
+
// When I click on the cookie policy link in the banner
|
|
89
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
90
|
+
// Then I see the cookie policy
|
|
91
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
92
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
|
|
93
|
+
// When I toggle off the analytics cookie checkbox
|
|
94
|
+
CookiePolicyModalSteps.toggleStatisticCookies();
|
|
95
|
+
// And I close the dialog
|
|
96
|
+
CookiePolicyModalSteps.closeDialog();
|
|
97
|
+
CookiePolicyModalSteps.getDialog().should('not.exist');
|
|
98
|
+
// When I reopen the cookie policy dialog using the button in the banner
|
|
99
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
100
|
+
// And I expect to see that analytic cookies are not allowed and third party cookies are allowed
|
|
101
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
|
|
102
|
+
// When I close the cookie policy dialog
|
|
103
|
+
CookiePolicyModalSteps.closeDialog();
|
|
104
|
+
// And I open my settings page
|
|
105
|
+
MainMenuSteps.clickOnMySettings();
|
|
106
|
+
// Then I expect to see cookie policy button in My settings widget
|
|
107
|
+
SettingsSteps.getCookiePolicyButton().and('be.visible');
|
|
108
|
+
// When I click on the cookie policy button in My settings widget
|
|
109
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
110
|
+
// Then I see the cookie policy
|
|
111
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
112
|
+
// And I expect to see that analytic cookies are not allowed and third party cookies are allowed
|
|
113
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
|
|
114
|
+
// When I toggle off the third party cookies checkbox
|
|
115
|
+
CookiePolicyModalSteps.toggleThirdPartyCookies();
|
|
116
|
+
// And I close the cookie policy dialog
|
|
117
|
+
CookiePolicyModalSteps.closeDialog();
|
|
118
|
+
// When I reopen the cookie policy dialog using the button in my settings widget
|
|
119
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
120
|
+
// And I expect to see that analytic cookies are not allowed and third party cookies are not allowed
|
|
121
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
|
|
122
|
+
CookiePolicyModalSteps.closeDialog();
|
|
123
|
+
// When I reload the page
|
|
124
|
+
cy.reload();
|
|
125
|
+
// And I reopen the cookie policy dialog using the button in my settings widget
|
|
126
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
127
|
+
// And I expect to see that analytic cookies are not allowed and third party cookies are not allowed
|
|
128
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
|
|
129
|
+
// When I close the cookie policy dialog
|
|
130
|
+
CookiePolicyModalSteps.closeDialog();
|
|
131
|
+
// And I click OK in the cookie consent banner
|
|
132
|
+
CookieConsentBannerSteps.giveCookieConsent();
|
|
133
|
+
// Then I expect the banner to be hidden
|
|
134
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
135
|
+
// When I reload the page
|
|
136
|
+
cy.reload();
|
|
137
|
+
// Then I expect the banner to be hidden
|
|
138
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
function validateUserUpdateWithCookieConsent() {
|
|
143
|
+
cy.wait('@updateUser').then((xhr) => {
|
|
144
|
+
expect(xhr.request.body.appSettings).to.include({
|
|
145
|
+
DEFAULT_INFERENCE: true,
|
|
146
|
+
DEFAULT_VIS_GRAPH_SCHEMA: true,
|
|
147
|
+
DEFAULT_SAMEAS: true,
|
|
148
|
+
IGNORE_SHARED_QUERIES: false,
|
|
149
|
+
EXECUTE_COUNT: true
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// Assert COOKIE_CONSENT properties, excluding updatedAt
|
|
153
|
+
expect(xhr.request.body.appSettings.COOKIE_CONSENT).to.include({
|
|
154
|
+
policyAccepted: true
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Assert that updatedAt is present, is a number, and is a reasonable timestamp
|
|
158
|
+
const updatedAt = xhr.request.body.appSettings.COOKIE_CONSENT.updatedAt;
|
|
159
|
+
expect(updatedAt).to.exist;
|
|
160
|
+
expect(updatedAt).to.be.a('number');
|
|
161
|
+
|
|
162
|
+
// Check that updatedAt is within 1 hour of the current time
|
|
163
|
+
const oneHourInMilliseconds = 60 * 60 * 1000;
|
|
164
|
+
const now = Date.now();
|
|
165
|
+
expect(updatedAt).to.be.within(now - oneHourInMilliseconds, now + oneHourInMilliseconds);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function validateGATracking() {
|
|
170
|
+
// Check if the GA tracking script is set correctly in the head
|
|
171
|
+
cy.document()
|
|
172
|
+
.get('head script')
|
|
173
|
+
.should("have.attr", "src")
|
|
174
|
+
.should('include', 'https://www.googletagmanager.com/gtm.js?id=GTM-WBP6C6Z4');
|
|
175
|
+
|
|
176
|
+
// Check if the installation ID cookie is set correctly
|
|
177
|
+
cy.getCookie('_wb').then((cookie) => {
|
|
178
|
+
expect(cookie).to.exist;
|
|
179
|
+
// Check the cookie structure: WB1.<installationId>.<timestamp>
|
|
180
|
+
expect(cookie.value).to.match(/^WB1\.[a-zA-Z0-9\-]+\.\d+$/);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
@@ -127,7 +127,9 @@ describe('Import server files', () => {
|
|
|
127
127
|
ImportResourceMessageDialog.getDialog().should('be.visible');
|
|
128
128
|
|
|
129
129
|
// with full error message
|
|
130
|
-
ImportResourceMessageDialog
|
|
130
|
+
ImportResourceMessageDialog
|
|
131
|
+
.getMessage()
|
|
132
|
+
.should('contain.text', 'RDF Parse Error: The element type "ex:looooooooooooooooooooooooooooooooongTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame" must be terminated by the matching end-tag');
|
|
131
133
|
|
|
132
134
|
// When I click on corner close button.
|
|
133
135
|
ImportResourceMessageDialog.close();
|
|
@@ -102,7 +102,7 @@ describe('Repositories', () => {
|
|
|
102
102
|
// Check the repo is present in the list of repos and we are not yet connected to it
|
|
103
103
|
RepositorySteps.getRepositoryFromList(repositoryId)
|
|
104
104
|
.should('be.visible')
|
|
105
|
-
.find('.
|
|
105
|
+
.find('.icon-connection-off')
|
|
106
106
|
.should('be.visible');
|
|
107
107
|
|
|
108
108
|
// Verify it's configuration can be downloaded
|
|
@@ -121,7 +121,10 @@ describe('Repositories', () => {
|
|
|
121
121
|
cy.get('.onto-dropdown-menu-item')
|
|
122
122
|
.contains(repositoryId)
|
|
123
123
|
.first()
|
|
124
|
-
.scrollIntoView()
|
|
124
|
+
.scrollIntoView();
|
|
125
|
+
cy.get('.onto-dropdown-menu-item')
|
|
126
|
+
.contains(repositoryId)
|
|
127
|
+
.first()
|
|
125
128
|
.click();
|
|
126
129
|
|
|
127
130
|
// Should visualize the selected repo
|
|
@@ -3,6 +3,8 @@ import HomeSteps from '../../steps/home-steps.js';
|
|
|
3
3
|
import {RepositoryErrorsWidgetSteps} from '../../steps/widgets/repository-errors-widget-steps.js';
|
|
4
4
|
import {RepositorySteps} from '../../steps/repository-steps.js';
|
|
5
5
|
import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
|
|
6
|
+
import {ErrorPageSteps} from '../../steps/error-page-steps.js';
|
|
7
|
+
import {MainMenuSteps} from '../../steps/main-menu-steps.js';
|
|
6
8
|
|
|
7
9
|
describe('URL with Repository ID parameter', () => {
|
|
8
10
|
let repositoryId;
|
|
@@ -152,4 +154,27 @@ describe('URL with Repository ID parameter', () => {
|
|
|
152
154
|
cy.url().should('include', 'repositoryId=' + repositoryId);
|
|
153
155
|
});
|
|
154
156
|
});
|
|
157
|
+
|
|
158
|
+
describe('When navigating between legacy and new workbench', () => {
|
|
159
|
+
beforeEach(() => {
|
|
160
|
+
repositoryId = 'repository-in-url-' + Date.now();
|
|
161
|
+
cy.createRepository({id: repositoryId});
|
|
162
|
+
cy.presetRepository(repositoryId);
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
afterEach(() => {
|
|
166
|
+
cy.deleteRepository(repositoryId);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('should preserve repositoryId parameter when navigating from 404 (new workbench) to legacy page', () => {
|
|
170
|
+
// Given I am on the 404 page which is in the new workbench
|
|
171
|
+
ErrorPageSteps.visit404();
|
|
172
|
+
ErrorPageSteps.get404Page().should('be.visible');
|
|
173
|
+
cy.url().should('not.include', 'repositoryId=');
|
|
174
|
+
// When I navigate to some legacy page
|
|
175
|
+
MainMenuSteps.clickOnSparqlMenu();
|
|
176
|
+
// Then repositoryId parameter should be preserved in the URL
|
|
177
|
+
cy.url().should('include', `repositoryId=${repositoryId}`);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
155
180
|
});
|
|
@@ -6,6 +6,7 @@ import {ToasterSteps} from '../../../steps/toaster-steps';
|
|
|
6
6
|
import HomeSteps from '../../../steps/home-steps';
|
|
7
7
|
import {LoginSteps} from '../../../steps/login-steps';
|
|
8
8
|
import {MainMenuSteps} from '../../../steps/main-menu-steps';
|
|
9
|
+
import {SecurityStubs} from '../../../stubs/security-stubs.js';
|
|
9
10
|
|
|
10
11
|
describe('User and Access', () => {
|
|
11
12
|
|
|
@@ -102,6 +103,41 @@ describe('User and Access', () => {
|
|
|
102
103
|
UserAndAccessSteps.addTextToCustomRoleField('{backspace}');
|
|
103
104
|
// Then the error should not be visible
|
|
104
105
|
UserAndAccessSteps.getCustomRoleFieldError().should('not.be.visible');
|
|
106
|
+
|
|
107
|
+
// When I create the user with a valid custom role
|
|
108
|
+
UserAndAccessSteps.clickWriteAccessAny();
|
|
109
|
+
SecurityStubs.spyOnUserCreate()
|
|
110
|
+
UserAndAccessSteps.confirmUserCreate();
|
|
111
|
+
// Then the user should be created with that custom role
|
|
112
|
+
cy.wait('@create-user').its('request.body').then((body) => {
|
|
113
|
+
expect(body).to.deep.eq({
|
|
114
|
+
"password": "password",
|
|
115
|
+
"grantedAuthorities": [
|
|
116
|
+
"ROLE_USER",
|
|
117
|
+
"CUSTOM_AA",
|
|
118
|
+
"WRITE_REPO_*",
|
|
119
|
+
"READ_REPO_*"
|
|
120
|
+
],
|
|
121
|
+
"appSettings": {
|
|
122
|
+
"DEFAULT_VIS_GRAPH_SCHEMA": true,
|
|
123
|
+
"DEFAULT_INFERENCE": true,
|
|
124
|
+
"DEFAULT_SAMEAS": true,
|
|
125
|
+
"IGNORE_SHARED_QUERIES": false,
|
|
126
|
+
"EXECUTE_COUNT": true
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
cy.url().should('include', '/users');
|
|
132
|
+
UserAndAccessSteps.findUserInTable(user).should('be.visible');
|
|
133
|
+
UserAndAccessSteps.getUserCustomRoles('@user')
|
|
134
|
+
.should('have.length', 1)
|
|
135
|
+
.eq(0).and('have.text', 'AA');
|
|
136
|
+
// And when I open the edit page for that user, the custom role should be visible in the field without the prefix
|
|
137
|
+
UserAndAccessSteps.openEditUserPage(user);
|
|
138
|
+
UserAndAccessSteps.getCustomRoleField().find('.tag-item span')
|
|
139
|
+
.should('have.length', 1)
|
|
140
|
+
.eq(0).and('have.text', 'AA');
|
|
105
141
|
});
|
|
106
142
|
|
|
107
143
|
it('Adding a role with a CUSTOM_ prefix shows a warning message', () => {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
|
|
2
|
+
import {LoginSteps} from '../../steps/login-steps.js';
|
|
3
|
+
import {UserAndAccessSteps} from '../../steps/setup/user-and-access-steps.js';
|
|
4
|
+
import HomeSteps from '../../steps/home-steps.js';
|
|
5
|
+
|
|
6
|
+
describe('URL with Repository ID parameter', () => {
|
|
7
|
+
let repositoryId;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
repositoryId = 'repository-in-url-' + Date.now();
|
|
11
|
+
cy.createRepository({id: repositoryId});
|
|
12
|
+
cy.presetRepository(repositoryId);
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
cy.loginAsAdmin();
|
|
17
|
+
cy.switchOffSecurity(true);
|
|
18
|
+
cy.deleteRepository(repositoryId);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should set repositoryId in url after enable security->login', () => {
|
|
22
|
+
enableSecurity(repositoryId);
|
|
23
|
+
// When user logs in again
|
|
24
|
+
LoginSteps.loginWithUser('admin', 'root');
|
|
25
|
+
// Then repositoryId parameter should be present in the URL and repository should be selected in the selector
|
|
26
|
+
UserAndAccessSteps.getUsersCatalogContainer().should('be.visible');
|
|
27
|
+
cy.url().should('include', 'repositoryId=' + repositoryId);
|
|
28
|
+
RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should set repositoryId in ur after first login', () => {
|
|
32
|
+
// Given security is on
|
|
33
|
+
cy.switchOnSecurity();
|
|
34
|
+
// And I log in with user admin
|
|
35
|
+
LoginSteps.visitLoginPage();
|
|
36
|
+
LoginSteps.loginWithUser('admin', 'root');
|
|
37
|
+
// Then repositoryId parameter should be present in the URL and repository should be selected in the selector
|
|
38
|
+
HomeSteps.getView().should('be.visible');
|
|
39
|
+
cy.url().should('include', 'repositoryId=' + repositoryId);
|
|
40
|
+
RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
function enableSecurity(repositoryId) {
|
|
45
|
+
// Given security is off
|
|
46
|
+
// When user visits user and access page
|
|
47
|
+
UserAndAccessSteps.visit();
|
|
48
|
+
// Then url should contain repositoryId parameter and repository should be selected in the selector
|
|
49
|
+
cy.url().should('include', 'repositoryId=' + repositoryId);
|
|
50
|
+
RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
|
|
51
|
+
// When user toggles security on
|
|
52
|
+
UserAndAccessSteps.toggleSecurity();
|
|
53
|
+
// Then user should be logged out and login page should be shown
|
|
54
|
+
LoginSteps.getLoginPage().should('be.visible');
|
|
55
|
+
// And repositoryId parameter should not be present in the URL
|
|
56
|
+
cy.url().should('not.include', 'repositoryId=');
|
|
57
|
+
}
|
|
@@ -2,7 +2,12 @@ import {UserAndAccessSteps} from "../../../steps/setup/user-and-access-steps";
|
|
|
2
2
|
import {LicenseStubs} from "../../../stubs/license-stubs";
|
|
3
3
|
import {LoginSteps} from "../../../steps/login-steps";
|
|
4
4
|
import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
|
|
5
|
-
import
|
|
5
|
+
import {MainMenuSteps} from '../../../steps/main-menu-steps.js';
|
|
6
|
+
import {CookieConsentBannerSteps} from '../../../steps/cookie-policy/cookie-consent-banner-steps.js';
|
|
7
|
+
import ImportSteps from '../../../steps/import/import-steps.js';
|
|
8
|
+
import {CookiePolicyModalSteps} from '../../../steps/cookie-policy/cookie-policy-modal.steps.js';
|
|
9
|
+
import {SettingsSteps} from '../../../steps/setup/settings-steps.js';
|
|
10
|
+
import {HeaderSteps} from '../../../steps/header-steps.js';
|
|
6
11
|
|
|
7
12
|
Cypress.env('set_default_user_data', false);
|
|
8
13
|
|
|
@@ -15,7 +20,7 @@ describe('Cookie policy', () => {
|
|
|
15
20
|
cy.switchOffFreeAccess(true);
|
|
16
21
|
cy.switchOffSecurity(true);
|
|
17
22
|
});
|
|
18
|
-
cy.setDefaultUserData(
|
|
23
|
+
cy.setDefaultUserData(undefined);
|
|
19
24
|
LicenseStubs.stubFreeLicense();
|
|
20
25
|
repository = 'cypress-test-cookie-policy-security-' + Date.now();
|
|
21
26
|
cy.createRepository({id: repository});
|
|
@@ -26,10 +31,231 @@ describe('Cookie policy', () => {
|
|
|
26
31
|
cy.loginAsAdmin().then(() => {
|
|
27
32
|
cy.switchOffFreeAccess(true);
|
|
28
33
|
cy.switchOffSecurity(true);
|
|
29
|
-
cy.setDefaultUserData();
|
|
34
|
+
cy.setDefaultUserData(undefined);
|
|
30
35
|
});
|
|
31
36
|
});
|
|
32
37
|
|
|
38
|
+
// Scenario 5
|
|
39
|
+
it('should hide cookie consent banner when security is ON and user is logged out', () => {
|
|
40
|
+
// Given I open user and access page in prod mode
|
|
41
|
+
UserAndAccessSteps.visitInProdMode();
|
|
42
|
+
// Then the cookie policy banner should be visible
|
|
43
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('exist').and('be.visible');
|
|
44
|
+
// When I enable security
|
|
45
|
+
UserAndAccessSteps.toggleSecurity();
|
|
46
|
+
// Then I should be logged out
|
|
47
|
+
LoginSteps.getLoginPage().should('be.visible');
|
|
48
|
+
// And the cookie policy banner should be hidden
|
|
49
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
50
|
+
// When I login with admin
|
|
51
|
+
LoginSteps.loginWithUser('admin', 'root');
|
|
52
|
+
// Then the cookie policy banner should be visible
|
|
53
|
+
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
54
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('exist').and('be.visible');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Scenario 6
|
|
58
|
+
it('should give cookie consent when security is ON', () => {
|
|
59
|
+
// Given I open user and access page in prod mode
|
|
60
|
+
UserAndAccessSteps.visitInProdMode();
|
|
61
|
+
// When I enable security
|
|
62
|
+
UserAndAccessSteps.toggleSecurity();
|
|
63
|
+
// Then I should be logged out
|
|
64
|
+
LoginSteps.getLoginPage().should('be.visible');
|
|
65
|
+
// When I login with admin
|
|
66
|
+
LoginSteps.loginWithUser('admin', 'root');
|
|
67
|
+
// Then I should see the users and access page
|
|
68
|
+
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
69
|
+
// Then the cookie policy banner should be visible
|
|
70
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
|
|
71
|
+
// When I click OK in the cookie consent banner
|
|
72
|
+
CookieConsentBannerSteps.giveCookieConsent();
|
|
73
|
+
// Then the cookie policy banner should be hidden
|
|
74
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
75
|
+
// When I open another page
|
|
76
|
+
MainMenuSteps.clickOnMenuImport();
|
|
77
|
+
ImportSteps.getView().should('be.visible');
|
|
78
|
+
// Then the cookie policy banner should be hidden
|
|
79
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
80
|
+
// When I reload the page
|
|
81
|
+
cy.reload();
|
|
82
|
+
// Then the cookie policy banner should be hidden
|
|
83
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Scenario 7
|
|
87
|
+
it('should update cookie policy and give cookie consent when security is ON', () => {
|
|
88
|
+
// Given I open user and access page in prod mode
|
|
89
|
+
UserAndAccessSteps.visitInProdMode();
|
|
90
|
+
// And I enable security
|
|
91
|
+
UserAndAccessSteps.toggleSecurity();
|
|
92
|
+
// And I login with admin
|
|
93
|
+
LoginSteps.loginWithUser('admin', 'root');
|
|
94
|
+
// When I click on the cookie policy link in the banner
|
|
95
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
96
|
+
// Then I see the cookie policy
|
|
97
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
98
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
|
|
99
|
+
// When I toggle off the analytics cookie checkbox
|
|
100
|
+
CookiePolicyModalSteps.toggleStatisticCookies();
|
|
101
|
+
// And I close the dialog
|
|
102
|
+
CookiePolicyModalSteps.closeDialog();
|
|
103
|
+
CookiePolicyModalSteps.getDialog().should('not.exist');
|
|
104
|
+
// When I reload the page
|
|
105
|
+
cy.reload();
|
|
106
|
+
// Then I expect to see that analytic cookies are not allowed and third party cookies are allowed
|
|
107
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
108
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
|
|
109
|
+
// And I close the cookie policy dialog
|
|
110
|
+
CookiePolicyModalSteps.closeDialog();
|
|
111
|
+
// When I open my settings page
|
|
112
|
+
MainMenuSteps.clickOnMySettings();
|
|
113
|
+
// And I open cookie policy modal using the button in the my settings widget
|
|
114
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
115
|
+
// Then I should see the cookie policy
|
|
116
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
117
|
+
// And I expect to see that analytic cookies are not allowed and third party cookies are allowed
|
|
118
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
|
|
119
|
+
// When I toggle off third party cookies checkbox
|
|
120
|
+
CookiePolicyModalSteps.toggleThirdPartyCookies();
|
|
121
|
+
// And I close the modal
|
|
122
|
+
CookiePolicyModalSteps.closeDialog();
|
|
123
|
+
// When I reopen modal from the widget
|
|
124
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
125
|
+
// Then I expect to see that analytic cookies are not allowed and third party cookies are not allowed
|
|
126
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
|
|
127
|
+
CookiePolicyModalSteps.closeDialog();
|
|
128
|
+
// When I click OK in the banner
|
|
129
|
+
CookieConsentBannerSteps.giveCookieConsent();
|
|
130
|
+
// Then I expect the banner to be hidden
|
|
131
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
132
|
+
// When I reload the page
|
|
133
|
+
cy.reload();
|
|
134
|
+
// Then I expect the banner to be hidden
|
|
135
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
136
|
+
// When I logout
|
|
137
|
+
LoginSteps.logout();
|
|
138
|
+
// Then I should see the login page
|
|
139
|
+
LoginSteps.getLoginPage().should('be.visible');
|
|
140
|
+
// And the cookie policy banner should be hidden
|
|
141
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
142
|
+
// When I login with admin
|
|
143
|
+
LoginSteps.loginWithUser('admin', 'root');
|
|
144
|
+
// Then the cookie policy banner should be hidden
|
|
145
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
146
|
+
// When I open cookie policy modal from the widget
|
|
147
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
148
|
+
// Then I expect to see that analytic cookies are not allowed and third party cookies are not allowed
|
|
149
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
|
|
150
|
+
// When I toggle on third party cookies checkbox
|
|
151
|
+
CookiePolicyModalSteps.toggleThirdPartyCookies();
|
|
152
|
+
// And I close the modal
|
|
153
|
+
CookiePolicyModalSteps.closeDialog();
|
|
154
|
+
// When I reload the page
|
|
155
|
+
cy.reload();
|
|
156
|
+
// Then I expect to see that analytic cookies are not allowed and third party cookies are allowed
|
|
157
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
158
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Scenario 8
|
|
162
|
+
it('should update cookie policy and give cookie consent when security is ON and free access is ON', () => {
|
|
163
|
+
// Given I open user and access page in prod mode
|
|
164
|
+
UserAndAccessSteps.visitInProdMode();
|
|
165
|
+
// And I enable security
|
|
166
|
+
UserAndAccessSteps.toggleSecurity();
|
|
167
|
+
// And I login with admin
|
|
168
|
+
LoginSteps.loginWithUser('admin', 'root');
|
|
169
|
+
// And I enable free access
|
|
170
|
+
UserAndAccessSteps.toggleFreeAccess();
|
|
171
|
+
UserAndAccessSteps.clickFreeWriteAccessRepo(repository);
|
|
172
|
+
ModalDialogSteps.clickOKButton();
|
|
173
|
+
// Then the cookie policy banner should be visible
|
|
174
|
+
CookieConsentBannerSteps.getCookieConsentBanner().and('be.visible');
|
|
175
|
+
// When I click on the cookie policy link in the banner
|
|
176
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
177
|
+
// Then I see the cookie policy
|
|
178
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
179
|
+
// And I expect to see that analytic and third party cookies are allowed
|
|
180
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
|
|
181
|
+
// When I toggle off the analytics cookie checkbox
|
|
182
|
+
// The policy is saved on the server
|
|
183
|
+
CookiePolicyModalSteps.toggleStatisticCookies();
|
|
184
|
+
// And I close the dialog
|
|
185
|
+
CookiePolicyModalSteps.closeDialog();
|
|
186
|
+
CookiePolicyModalSteps.getDialog().should('not.exist');
|
|
187
|
+
// When I logout
|
|
188
|
+
HeaderSteps.logout();
|
|
189
|
+
// Then I should still see the user and access page but I have no access to it which is unimportant for this test
|
|
190
|
+
cy.url().should('include', '/users');
|
|
191
|
+
// And the cookie policy banner should be visible
|
|
192
|
+
CookieConsentBannerSteps.getCookieConsentBanner().and('be.visible');
|
|
193
|
+
// When I click on the cookie policy link in the banner
|
|
194
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
195
|
+
// Then I see the cookie policy
|
|
196
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
197
|
+
// And I expect to see that analytic cookies are allowed and third party cookies are allowed
|
|
198
|
+
// (using browser data, because user is logged out)
|
|
199
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
|
|
200
|
+
// And I close the cookie policy modal
|
|
201
|
+
CookiePolicyModalSteps.closeDialog();
|
|
202
|
+
// When I open another page
|
|
203
|
+
MainMenuSteps.clickOnMenuImport();
|
|
204
|
+
// Then the cookie policy banner should be visible
|
|
205
|
+
CookieConsentBannerSteps.getCookieConsentBanner().and('be.visible');
|
|
206
|
+
// When I give cookie consent
|
|
207
|
+
CookieConsentBannerSteps.giveCookieConsent();
|
|
208
|
+
// Then the cookie policy banner should be hidden
|
|
209
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
210
|
+
// When I open another page
|
|
211
|
+
MainMenuSteps.clickOnSparqlMenu();
|
|
212
|
+
cy.url().should('include', '/sparql');
|
|
213
|
+
// Then the cookie policy banner should be hidden
|
|
214
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
215
|
+
// When I reload the page
|
|
216
|
+
cy.reload();
|
|
217
|
+
// Then the cookie policy banner should be hidden
|
|
218
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
219
|
+
// When I login with admin
|
|
220
|
+
HeaderSteps.login();
|
|
221
|
+
LoginSteps.loginWithUser('admin', 'root');
|
|
222
|
+
cy.url().should('include', '/sparql');
|
|
223
|
+
// Then the cookie policy banner should be visible (because consent is saved on the server, but user has no changes persisted on server, so defaults are considered)
|
|
224
|
+
CookieConsentBannerSteps.getCookieConsentBanner().and('be.visible');
|
|
225
|
+
// When I click on the cookie policy link in the banner
|
|
226
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
227
|
+
// Then I see the cookie policy
|
|
228
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
229
|
+
// And I expect to see that analytic cookies are allowed and third party cookies are allowed
|
|
230
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
|
|
231
|
+
// When I toggle off third party cookies checkbox
|
|
232
|
+
CookiePolicyModalSteps.toggleThirdPartyCookies();
|
|
233
|
+
// And I close the modal
|
|
234
|
+
CookiePolicyModalSteps.closeDialog();
|
|
235
|
+
// When I reopen modal from the banner button
|
|
236
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
237
|
+
// Then I expect to see that analytic cookies are allowed and third party cookies are not allowed
|
|
238
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
|
|
239
|
+
CookiePolicyModalSteps.closeDialog();
|
|
240
|
+
// When I logout
|
|
241
|
+
HeaderSteps.logout();
|
|
242
|
+
// And the cookie policy banner should be hidden (using browser data)
|
|
243
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
244
|
+
// When I login with admin
|
|
245
|
+
HeaderSteps.login();
|
|
246
|
+
LoginSteps.loginWithUser('admin', 'root');
|
|
247
|
+
// Then the cookie policy banner should be visible (consent is persisted with the user on server)
|
|
248
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
|
|
249
|
+
// When I give cookie consent
|
|
250
|
+
CookieConsentBannerSteps.giveCookieConsent();
|
|
251
|
+
// Then the cookie policy banner should be hidden
|
|
252
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
253
|
+
// When I reload the page
|
|
254
|
+
cy.reload();
|
|
255
|
+
// Then the cookie policy banner should be hidden
|
|
256
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
257
|
+
});
|
|
258
|
+
|
|
33
259
|
it('should show the consent popup if free access is on and the user is on the login page', () => {
|
|
34
260
|
// Given: Security is enabled and free access is on
|
|
35
261
|
UserAndAccessSteps.visitInProdMode();
|
|
@@ -44,7 +270,7 @@ describe('Cookie policy', () => {
|
|
|
44
270
|
// When: The user visits the login page
|
|
45
271
|
LoginSteps.visitInProdMode();
|
|
46
272
|
// Then: The cookie policy popup should be shown
|
|
47
|
-
|
|
273
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('exist').and('be.visible');
|
|
48
274
|
});
|
|
49
275
|
|
|
50
276
|
it('should not show the consent popup if free access is off and the user is on the login page', () => {
|
|
@@ -57,8 +283,8 @@ describe('Cookie policy', () => {
|
|
|
57
283
|
// When: The user logs out and visits the login page
|
|
58
284
|
LoginSteps.logout();
|
|
59
285
|
// Then: The cookie policy popup should not be shown
|
|
60
|
-
|
|
286
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
61
287
|
LoginSteps.visitInProdMode();
|
|
62
|
-
|
|
288
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
63
289
|
});
|
|
64
290
|
});
|