graphdb-workbench-tests 3.3.2-RC1 → 3.3.2-TR1
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/home/cookie-policy.spec.js +108 -0
- package/e2e-security/setup/home/cookie-policy.spec.js +6 -232
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/steps/header-steps.js +0 -13
- package/steps/home-steps.js +20 -0
- package/steps/login-steps.js +0 -1
- package/steps/setup/settings-steps.js +1 -1
- package/stubs/security-stubs.js +0 -4
- package/support/settings-commands.js +2 -18
- package/e2e-legacy/home/cookie-policy/cookie-policy.spec.js +0 -182
- package/steps/cookie-policy/cookie-consent-banner-steps.js +0 -21
- package/steps/cookie-policy/cookie-policy-modal.steps.js +0 -56
- package/steps/shared-modal-dialog-steps.js +0 -45
- package/support/e2e-security.js +0 -9
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
});
|
|
@@ -2,12 +2,7 @@ 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
|
|
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';
|
|
5
|
+
import HomeSteps from "../../../steps/home-steps";
|
|
11
6
|
|
|
12
7
|
Cypress.env('set_default_user_data', false);
|
|
13
8
|
|
|
@@ -20,7 +15,7 @@ describe('Cookie policy', () => {
|
|
|
20
15
|
cy.switchOffFreeAccess(true);
|
|
21
16
|
cy.switchOffSecurity(true);
|
|
22
17
|
});
|
|
23
|
-
cy.setDefaultUserData(
|
|
18
|
+
cy.setDefaultUserData(false);
|
|
24
19
|
LicenseStubs.stubFreeLicense();
|
|
25
20
|
repository = 'cypress-test-cookie-policy-security-' + Date.now();
|
|
26
21
|
cy.createRepository({id: repository});
|
|
@@ -31,231 +26,10 @@ describe('Cookie policy', () => {
|
|
|
31
26
|
cy.loginAsAdmin().then(() => {
|
|
32
27
|
cy.switchOffFreeAccess(true);
|
|
33
28
|
cy.switchOffSecurity(true);
|
|
34
|
-
cy.setDefaultUserData(
|
|
29
|
+
cy.setDefaultUserData();
|
|
35
30
|
});
|
|
36
31
|
});
|
|
37
32
|
|
|
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
|
-
|
|
259
33
|
it('should show the consent popup if free access is on and the user is on the login page', () => {
|
|
260
34
|
// Given: Security is enabled and free access is on
|
|
261
35
|
UserAndAccessSteps.visitInProdMode();
|
|
@@ -270,7 +44,7 @@ describe('Cookie policy', () => {
|
|
|
270
44
|
// When: The user visits the login page
|
|
271
45
|
LoginSteps.visitInProdMode();
|
|
272
46
|
// Then: The cookie policy popup should be shown
|
|
273
|
-
|
|
47
|
+
HomeSteps.getCookieConsentPopup().should('exist').and('be.visible');
|
|
274
48
|
});
|
|
275
49
|
|
|
276
50
|
it('should not show the consent popup if free access is off and the user is on the login page', () => {
|
|
@@ -283,8 +57,8 @@ describe('Cookie policy', () => {
|
|
|
283
57
|
// When: The user logs out and visits the login page
|
|
284
58
|
LoginSteps.logout();
|
|
285
59
|
// Then: The cookie policy popup should not be shown
|
|
286
|
-
|
|
60
|
+
HomeSteps.getCookieConsentPopup().should('not.exist');
|
|
287
61
|
LoginSteps.visitInProdMode();
|
|
288
|
-
|
|
62
|
+
HomeSteps.getCookieConsentPopup().should('not.exist');
|
|
289
63
|
});
|
|
290
64
|
});
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphdb-workbench-tests",
|
|
3
|
-
"version": "3.3.2-
|
|
3
|
+
"version": "3.3.2-TR1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "graphdb-workbench-tests",
|
|
9
|
-
"version": "3.3.2-
|
|
9
|
+
"version": "3.3.2-TR1",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@bahmutov/cypress-code-coverage": "^2.7.2",
|
package/package.json
CHANGED
package/steps/header-steps.js
CHANGED
|
@@ -6,17 +6,4 @@ 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
|
-
}
|
|
22
9
|
}
|
package/steps/home-steps.js
CHANGED
|
@@ -313,6 +313,26 @@ 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
|
+
|
|
316
336
|
static getCookiePolicyModal() {
|
|
317
337
|
return cy.get('.cookie-policy-modal');
|
|
318
338
|
}
|
package/steps/login-steps.js
CHANGED
package/stubs/security-stubs.js
CHANGED
|
@@ -20,10 +20,6 @@ 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
|
-
|
|
27
23
|
static stubUpdateUserData(userName) {
|
|
28
24
|
cy.intercept('PATCH', `/rest/security/users/${userName}`, {
|
|
29
25
|
statusCode: 200,
|
|
@@ -1,12 +1,4 @@
|
|
|
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) => {
|
|
1
|
+
Cypress.Commands.add('setDefaultUserData', (cookieConsent = true) => {
|
|
10
2
|
const defaultUserSettings = {
|
|
11
3
|
'COOKIE_CONSENT': cookieConsent,
|
|
12
4
|
'DEFAULT_SAMEAS': true,
|
|
@@ -27,15 +19,7 @@ Cypress.Commands.add('setDefaultUserData', (cookieConsent) => {
|
|
|
27
19
|
});
|
|
28
20
|
});
|
|
29
21
|
|
|
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 ) => {
|
|
22
|
+
Cypress.Commands.add('setCookieConsent', (cookieConsent) => {
|
|
39
23
|
const defaultUserSettings = {
|
|
40
24
|
'COOKIE_CONSENT': cookieConsent
|
|
41
25
|
};
|
|
@@ -1,182 +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
|
-
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
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
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,45 +0,0 @@
|
|
|
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
|
-
}
|
package/support/e2e-security.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import './e2e';
|
|
2
|
-
|
|
3
|
-
beforeEach(() => {
|
|
4
|
-
cy.loginAsAdmin();
|
|
5
|
-
// Switch off security after each test to ensure that tests are independent and don't affect each other.
|
|
6
|
-
// For example, if security is enabled in one test, it can cause other tests that don't expect security to fail.
|
|
7
|
-
cy.switchOffSecurity(true);
|
|
8
|
-
cy.switchOffFreeAccess(true);
|
|
9
|
-
});
|