graphdb-workbench-tests 3.5.0-TR2 → 3.5.0-TR3
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/setup/aclmanagement/create-rule.spec.js +1 -1
- package/e2e-legacy/setup/aclmanagement/delete-rule.spec.js +1 -1
- package/e2e-legacy/setup/aclmanagement/edit-rule.spec.js +1 -1
- package/e2e-legacy/setup/aclmanagement/render-rules.spec.js +1 -1
- package/e2e-legacy/setup/aclmanagement/reorder-rules.spec.js +1 -1
- package/e2e-legacy/setup/aclmanagement/revert-rules.spec.js +1 -1
- package/e2e-legacy/setup/aclmanagement/scopes.spec.js +2 -2
- package/e2e-legacy/setup/aclmanagement/update-rules.spec.js +2 -2
- package/e2e-legacy/setup/jdbc/jdbc-create.spec.js +1 -1
- package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +550 -343
- package/e2e-security/setup/users-and-access/create-user-permissions.spec.js +15 -15
- package/e2e-security/setup/users-and-access/graphql-user.spec.js +3 -3
- package/e2e-security/setup/users-and-access/repo-admin-role.spec.js +2 -2
- package/eslint.config.js +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/steps/application-steps.js +1 -1
- package/steps/main-menu-steps.js +5 -1
- package/steps/setup/user-and-access-steps.js +81 -53
- package/stubs/security-stubs.js +4 -0
|
@@ -16,11 +16,25 @@ describe('User and Access', () => {
|
|
|
16
16
|
const ROLE_CUSTOM_ADMIN = '#roleAdmin';
|
|
17
17
|
const DEFAULT_ADMIN_PASSWORD = 'root';
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
context('', () => {
|
|
19
|
+
context('User and access management', () => {
|
|
21
20
|
const user = 'user';
|
|
21
|
+
let repoName;
|
|
22
|
+
|
|
23
|
+
before(() => {
|
|
24
|
+
repoName = 'user-access-repo1-' + Date.now();
|
|
25
|
+
cy.createRepository({id: repoName});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
after(() => {
|
|
29
|
+
cy.loginAsAdmin().then(() => {
|
|
30
|
+
cy.switchOffSecurity(true);
|
|
31
|
+
cy.switchOffFreeAccess(false);
|
|
32
|
+
});
|
|
33
|
+
cy.deleteRepository(repoName, true);
|
|
34
|
+
});
|
|
22
35
|
|
|
23
36
|
beforeEach(() => {
|
|
37
|
+
SecurityStubs.spyOnUserGet();
|
|
24
38
|
UserAndAccessSteps.visit();
|
|
25
39
|
// Users table should be visible
|
|
26
40
|
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
@@ -35,191 +49,370 @@ describe('User and Access', () => {
|
|
|
35
49
|
});
|
|
36
50
|
});
|
|
37
51
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
context('Initial state', () => {
|
|
53
|
+
it('Initial state', () => {
|
|
54
|
+
// Create new user button should be visible
|
|
55
|
+
UserAndAccessSteps.getCreateNewUserButton().should('be.visible');
|
|
56
|
+
// Security should be disabled
|
|
57
|
+
UserAndAccessSteps.getSecuritySwitchLabel().should('be.visible').and('contain', 'Security is OFF');
|
|
58
|
+
UserAndAccessSteps.getSecurityCheckbox().should('not.be.checked');
|
|
59
|
+
// Only admin user should be created by default
|
|
60
|
+
UserAndAccessSteps.getTableRow().should('have.length', 1);
|
|
61
|
+
UserAndAccessSteps.findUserInTable('admin');
|
|
62
|
+
UserAndAccessSteps.getUserType().should('be.visible').and('contain', 'Administrator');
|
|
63
|
+
// The admin should have unrestricted rights
|
|
64
|
+
UserAndAccessSteps.getRepositoryRights().should('be.visible').and('contain', 'Unrestricted');
|
|
65
|
+
// And can be edited
|
|
66
|
+
UserAndAccessSteps.getEditUserButton().should('be.visible').and('not.be.disabled');
|
|
67
|
+
// And cannot be deleted
|
|
68
|
+
UserAndAccessSteps.getDeleteUserButton().should('not.exist');
|
|
69
|
+
// Date created should be visible
|
|
70
|
+
UserAndAccessSteps.getDateCreated().should('be.visible');
|
|
71
|
+
});
|
|
56
72
|
});
|
|
57
73
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
74
|
+
context('User creation', () => {
|
|
75
|
+
it('Create user', () => {
|
|
76
|
+
//create a normal read/write user
|
|
77
|
+
createUser(user, PASSWORD, ROLE_USER, {readWrite: true});
|
|
78
|
+
testForUser(user, false);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('Create repo-manager', () => {
|
|
82
|
+
//create a repo-manager
|
|
83
|
+
createUser(user, PASSWORD, ROLE_REPO_MANAGER);
|
|
84
|
+
testForUser(user, false);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('Create second admin', () => {
|
|
88
|
+
//create a custom admin
|
|
89
|
+
createUser(user, PASSWORD, ROLE_CUSTOM_ADMIN);
|
|
90
|
+
testForUser(user, true);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('Create user with custom role', () => {
|
|
94
|
+
// When I create a read/write user
|
|
95
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
96
|
+
UserAndAccessSteps.typeUsername(user);
|
|
97
|
+
UserAndAccessSteps.typePassword(PASSWORD);
|
|
98
|
+
UserAndAccessSteps.typeConfirmPasswordField(PASSWORD);
|
|
99
|
+
UserAndAccessSteps.selectRoleRadioButton(ROLE_USER);
|
|
100
|
+
// And add a custom role of 1 letter
|
|
101
|
+
UserAndAccessSteps.addTextToCustomRoleField('A');
|
|
102
|
+
UserAndAccessSteps.toggleWriteAccessAny();
|
|
103
|
+
|
|
104
|
+
// Then the 'create' button should be disabled
|
|
105
|
+
UserAndAccessSteps.getConfirmUserCreateButton().should('be.disabled');
|
|
106
|
+
// And the field should show an error
|
|
107
|
+
UserAndAccessSteps.getCustomRoleFieldError().should('contain.text', 'Must be at least 2 symbols long');
|
|
108
|
+
// When I add more text to the custom role tag
|
|
109
|
+
UserAndAccessSteps.addTextToCustomRoleField('A{enter}');
|
|
110
|
+
// Then the 'create' button should be enabled
|
|
111
|
+
UserAndAccessSteps.getConfirmUserCreateButton().should('be.enabled');
|
|
112
|
+
// And the field error should not exist
|
|
113
|
+
UserAndAccessSteps.getCustomRoleFieldError().should('not.be.visible');
|
|
114
|
+
|
|
115
|
+
// When I type an invalid tag
|
|
116
|
+
UserAndAccessSteps.addTextToCustomRoleField('B{enter}');
|
|
117
|
+
// And the field shows an error
|
|
118
|
+
UserAndAccessSteps.getCustomRoleFieldError().should('contain.text', 'Must be at least 2 symbols long');
|
|
119
|
+
// When I delete the invalid text
|
|
120
|
+
UserAndAccessSteps.addTextToCustomRoleField('{backspace}');
|
|
121
|
+
// Then the error should not be visible
|
|
122
|
+
UserAndAccessSteps.getCustomRoleFieldError().should('not.be.visible');
|
|
123
|
+
|
|
124
|
+
// When I create the user with a valid custom role
|
|
125
|
+
UserAndAccessSteps.toggleWriteAccessAny();
|
|
126
|
+
SecurityStubs.spyOnUserCreate();
|
|
127
|
+
UserAndAccessSteps.confirmUserCreate();
|
|
128
|
+
// Then the user should be created with that custom role
|
|
129
|
+
cy.wait('@create-user').its('request.body').then((body) => {
|
|
130
|
+
expect(body).to.deep.eq({
|
|
131
|
+
'password': 'password',
|
|
132
|
+
'grantedAuthorities': [
|
|
133
|
+
'ROLE_USER',
|
|
134
|
+
'CUSTOM_AA',
|
|
135
|
+
'WRITE_REPO_*',
|
|
136
|
+
'READ_REPO_*',
|
|
137
|
+
],
|
|
138
|
+
'appSettings': {
|
|
139
|
+
'DEFAULT_VIS_GRAPH_SCHEMA': true,
|
|
140
|
+
'DEFAULT_INFERENCE': true,
|
|
141
|
+
'DEFAULT_SAMEAS': true,
|
|
142
|
+
'IGNORE_SHARED_QUERIES': false,
|
|
143
|
+
'EXECUTE_COUNT': true,
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
cy.url().should('include', '/users');
|
|
149
|
+
UserAndAccessSteps.findUserInTable(user).should('be.visible');
|
|
150
|
+
UserAndAccessSteps.getUserCustomRoles('@user')
|
|
151
|
+
.should('have.length', 1)
|
|
152
|
+
.eq(0).and('have.text', 'AA');
|
|
153
|
+
// And when I open the edit page for that user, the custom role should be visible in the field without the prefix
|
|
154
|
+
UserAndAccessSteps.openEditUserPage(user);
|
|
155
|
+
cy.wait('@get-user');
|
|
156
|
+
UserAndAccessSteps.getCustomRoleField().find('.tag-item span')
|
|
157
|
+
.should('have.length', 1)
|
|
158
|
+
.eq(0).and('have.text', 'AA');
|
|
159
|
+
});
|
|
63
160
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
161
|
+
it('Adding a role with a CUSTOM_ prefix shows a warning message', () => {
|
|
162
|
+
// When I create a user
|
|
163
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
164
|
+
// And I add a custom role tag with prefix CUSTOM_
|
|
165
|
+
UserAndAccessSteps.addTextToCustomRoleField('CUSTOM_USER{Enter}');
|
|
166
|
+
// There should be a warning text
|
|
167
|
+
UserAndAccessSteps.getPrefixWarning(0).should('contain', 'Custom roles should be entered without the "CUSTOM_" prefix in Workbench');
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it('Warn users when setting no password when creating new user admin', () => {
|
|
171
|
+
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
172
|
+
createUser(user, PASSWORD, ROLE_CUSTOM_ADMIN, {noPassword: true});
|
|
173
|
+
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
174
|
+
UserAndAccessSteps.getSplashLoader().should('not.be.visible');
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Skipped until image with GDB implementation is available
|
|
178
|
+
it.skip('should create user with manage repo rights for specific repo', () => {
|
|
179
|
+
SecurityStubs.spyOnUserCreate();
|
|
180
|
+
UserAndAccessSteps.getUsersCatalogContainer().should('be.visible');
|
|
181
|
+
createUser(user, PASSWORD, ROLE_USER, {manage: true, repoName: repoName});
|
|
182
|
+
// Then the user should be created with that custom role
|
|
183
|
+
cy.wait('@create-user').its('request.body').then((body) => {
|
|
184
|
+
expect(body).to.deep.eq({
|
|
185
|
+
'password': 'password',
|
|
186
|
+
'grantedAuthorities': [
|
|
187
|
+
'ROLE_USER',
|
|
188
|
+
`MANAGE_REPO_${repoName}`,
|
|
189
|
+
`WRITE_REPO_${repoName}`,
|
|
190
|
+
`READ_REPO_${repoName}`,
|
|
191
|
+
],
|
|
192
|
+
'appSettings': {
|
|
193
|
+
'DEFAULT_VIS_GRAPH_SCHEMA': true,
|
|
194
|
+
'DEFAULT_INFERENCE': true,
|
|
195
|
+
'DEFAULT_SAMEAS': true,
|
|
196
|
+
'IGNORE_SHARED_QUERIES': false,
|
|
197
|
+
'EXECUTE_COUNT': true,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
UserAndAccessSteps.getUsersCatalogContainer().should('be.visible');
|
|
202
|
+
assertUserAuthsInCatalog(user, {repo: repoName, read: false, manage: true, graphql: false});
|
|
203
|
+
|
|
204
|
+
UserAndAccessSteps.openEditUserPage(user);
|
|
205
|
+
cy.wait('@get-user');
|
|
206
|
+
UserAndAccessSteps.getRepositoryRightsList().should('be.visible');
|
|
207
|
+
verifyCheckedUserAuth(repoName, {read: true, write: true, manage: true, graphql: false});
|
|
208
|
+
verifyDisabledUserAuth(repoName, {read: true, write: true, manage: false, graphql: true});
|
|
209
|
+
});
|
|
68
210
|
});
|
|
69
211
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
212
|
+
context('Free access', () => {
|
|
213
|
+
it('should toggle free access after Admin has logged in', () => {
|
|
214
|
+
// Given I have available repositories to allow Free Access for
|
|
215
|
+
RepositoriesStubs.stubRepositories();
|
|
216
|
+
RepositoriesStubs.stubFreeAccess();
|
|
217
|
+
// When I enable security
|
|
218
|
+
UserAndAccessSteps.toggleSecurity();
|
|
219
|
+
// When I log in as an Admin
|
|
220
|
+
LoginSteps.loginWithUser('admin', DEFAULT_ADMIN_PASSWORD);
|
|
221
|
+
// Then the page should load
|
|
222
|
+
UserAndAccessSteps.getSplashLoader().should('not.be.visible');
|
|
223
|
+
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
224
|
+
// The Free Access toggle should be OFF
|
|
225
|
+
UserAndAccessSteps.getFreeAccessSwitchInput().should('not.be.checked');
|
|
226
|
+
// When I toggle Free Access ON
|
|
227
|
+
UserAndAccessSteps.toggleFreeAccess();
|
|
228
|
+
// And I allow free access to a repository
|
|
229
|
+
ModalDialogSteps.getDialog().should('be.visible');
|
|
230
|
+
// Then I click OK in the modal
|
|
231
|
+
ModalDialogSteps.clickOKButton();
|
|
232
|
+
// Then the toggle button should be ON
|
|
233
|
+
UserAndAccessSteps.getFreeAccessSwitchInput().should('be.checked');
|
|
234
|
+
// And I should see a success message
|
|
235
|
+
ToasterSteps.verifySuccess('Free access has been enabled.');
|
|
236
|
+
ToasterSteps.getToast().should('not.exist');
|
|
237
|
+
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
238
|
+
// When I toggle Free Access OFF
|
|
239
|
+
UserAndAccessSteps.toggleFreeAccess();
|
|
240
|
+
// Then I should see a success message
|
|
241
|
+
ToasterSteps.getToast().should('exist');
|
|
242
|
+
ToasterSteps.getToasterMessage().should('contain', 'Free access has been disabled.');
|
|
243
|
+
});
|
|
74
244
|
});
|
|
75
245
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
UserAndAccessSteps.addTextToCustomRoleField('B{enter}');
|
|
100
|
-
// And the field shows an error
|
|
101
|
-
UserAndAccessSteps.getCustomRoleFieldError().should('contain.text', 'Must be at least 2 symbols long');
|
|
102
|
-
// When I delete the invalid text
|
|
103
|
-
UserAndAccessSteps.addTextToCustomRoleField('{backspace}');
|
|
104
|
-
// Then the error should not be visible
|
|
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');
|
|
246
|
+
context('Login / return URL redirects', () => {
|
|
247
|
+
it('should redirect to previous page after logout and then login', () => {
|
|
248
|
+
UserAndAccessSteps.toggleSecurity();
|
|
249
|
+
LoginSteps.loginWithUser('admin', DEFAULT_ADMIN_PASSWORD);
|
|
250
|
+
MainMenuSteps.clickOnSparqlMenu();
|
|
251
|
+
cy.url().should('include', '/sparql');
|
|
252
|
+
|
|
253
|
+
LoginSteps.logout();
|
|
254
|
+
cy.url().should('include', '/login');
|
|
255
|
+
LoginSteps.loginWithUser('admin', DEFAULT_ADMIN_PASSWORD);
|
|
256
|
+
cy.url().should('include', '/sparql');
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('should redirect to correct return url when user is authenticated and on login page', () => {
|
|
260
|
+
UserAndAccessSteps.visit();
|
|
261
|
+
UserAndAccessSteps.toggleSecurity();
|
|
262
|
+
LoginSteps.loginWithUser('admin', DEFAULT_ADMIN_PASSWORD);
|
|
263
|
+
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
264
|
+
|
|
265
|
+
cy.visit('/login?r=%252Fsparql');
|
|
266
|
+
cy.reload();
|
|
267
|
+
UserAndAccessSteps.getUrl().should('include', '/sparql');
|
|
268
|
+
});
|
|
141
269
|
});
|
|
270
|
+
});
|
|
142
271
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
272
|
+
context('Verify access states', () => {
|
|
273
|
+
let repoName;
|
|
274
|
+
|
|
275
|
+
before(() => {
|
|
276
|
+
repoName = 'user-access-repo1-' + Date.now();
|
|
277
|
+
cy.createRepository({id: repoName});
|
|
278
|
+
cy.switchOffSecurity(true);
|
|
279
|
+
SecurityStubs.spyOnUserGet();
|
|
150
280
|
});
|
|
151
281
|
|
|
152
|
-
|
|
153
|
-
UserAndAccessSteps.
|
|
154
|
-
|
|
282
|
+
beforeEach(() => {
|
|
283
|
+
UserAndAccessSteps.visit();
|
|
284
|
+
// Users table should be visible
|
|
155
285
|
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
156
|
-
UserAndAccessSteps.getSplashLoader().should('not.be.visible');
|
|
157
286
|
});
|
|
158
287
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
// When I log in as an Admin
|
|
166
|
-
LoginSteps.loginWithUser('admin', DEFAULT_ADMIN_PASSWORD);
|
|
167
|
-
// Then the page should load
|
|
168
|
-
UserAndAccessSteps.getSplashLoader().should('not.be.visible');
|
|
169
|
-
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
170
|
-
// The Free Access toggle should be OFF
|
|
171
|
-
UserAndAccessSteps.getFreeAccessSwitchInput().should('not.be.checked');
|
|
172
|
-
// When I toggle Free Access ON
|
|
173
|
-
UserAndAccessSteps.toggleFreeAccess();
|
|
174
|
-
// And I allow free access to a repository
|
|
175
|
-
ModalDialogSteps.getDialog().should('be.visible');
|
|
176
|
-
// Then I click OK in the modal
|
|
177
|
-
ModalDialogSteps.clickOKButton();
|
|
178
|
-
// Then the toggle button should be ON
|
|
179
|
-
UserAndAccessSteps.getFreeAccessSwitchInput().should('be.checked');
|
|
180
|
-
// And I should see a success message
|
|
181
|
-
ToasterSteps.verifySuccess('Free access has been enabled.');
|
|
182
|
-
ToasterSteps.getToast().should('not.exist');
|
|
183
|
-
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
184
|
-
// When I toggle Free Access OFF
|
|
185
|
-
UserAndAccessSteps.toggleFreeAccess();
|
|
186
|
-
// Then I should see a success message
|
|
187
|
-
ToasterSteps.getToast().should('exist');
|
|
188
|
-
ToasterSteps.getToasterMessage().should('contain', 'Free access has been disabled.');
|
|
288
|
+
after(() => {
|
|
289
|
+
cy.loginAsAdmin().then(() => {
|
|
290
|
+
cy.deleteRepository(repoName, true);
|
|
291
|
+
cy.switchOffFreeAccess(true);
|
|
292
|
+
cy.switchOffSecurity(true);
|
|
293
|
+
});
|
|
189
294
|
});
|
|
190
295
|
|
|
191
|
-
it('
|
|
192
|
-
UserAndAccessSteps.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
296
|
+
it('initial state', () => {
|
|
297
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
298
|
+
verifyCheckedUserAuth('*', {read: false, write: false, manage: false, graphql: false});
|
|
299
|
+
verifyDisabledUserAuth('*', {read: false, write: false, manage: true, graphql: true});
|
|
300
|
+
verifyCheckedUserAuth(repoName, {read: false, write: false, manage: false, graphql: false});
|
|
301
|
+
verifyDisabledUserAuth(repoName, {read: false, write: false, manage: false, graphql: true});
|
|
302
|
+
});
|
|
196
303
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
304
|
+
context('for non user roles', () => {
|
|
305
|
+
it('admin', () => {
|
|
306
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
307
|
+
UserAndAccessSteps.selectRoleRadioButton(ROLE_CUSTOM_ADMIN);
|
|
308
|
+
verifyCheckedUserAuth('*', {read: true, write: true, manage: true, graphql: false});
|
|
309
|
+
verifyDisabledUserAuth('*', {read: true, write: true, manage: true, graphql: true});
|
|
310
|
+
|
|
311
|
+
verifyCheckedUserAuth(repoName, {read: true, write: true, manage: true, graphql: false});
|
|
312
|
+
verifyDisabledUserAuth(repoName, {read: true, write: true, manage: true, graphql: true});
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it('repository manager', () => {
|
|
316
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
317
|
+
UserAndAccessSteps.selectRoleRadioButton(ROLE_REPO_MANAGER);
|
|
318
|
+
|
|
319
|
+
verifyCheckedUserAuth('*', {read: true, write: true, manage: true, graphql: false});
|
|
320
|
+
verifyDisabledUserAuth('*', {read: true, write: true, manage: true, graphql: true});
|
|
321
|
+
|
|
322
|
+
verifyCheckedUserAuth(repoName, {read: true, write: true, manage: true, graphql: false});
|
|
323
|
+
verifyDisabledUserAuth(repoName, {read: true, write: true, manage: true, graphql: true});
|
|
324
|
+
});
|
|
201
325
|
});
|
|
202
326
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
327
|
+
context('for specific repo', () => {
|
|
328
|
+
it('read', () => {
|
|
329
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
330
|
+
setRoles({read: true, repoName});
|
|
331
|
+
verifyCheckedUserAuth(repoName, {read: true, write: false, manage: false, graphql: false});
|
|
332
|
+
verifyDisabledUserAuth(repoName, {read: false, write: false, manage: false, graphql: false});
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it('write', () => {
|
|
336
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
337
|
+
setRoles({readWrite: true, repoName});
|
|
338
|
+
verifyCheckedUserAuth(repoName, {read: true, write: true, manage: false, graphql: false});
|
|
339
|
+
verifyDisabledUserAuth(repoName, {read: true, write: false, manage: false, graphql: false});
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
it('manage', () => {
|
|
343
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
344
|
+
setRoles({manage: true, repoName});
|
|
345
|
+
verifyCheckedUserAuth(repoName, {read: true, write: true, manage: true, graphql: false});
|
|
346
|
+
verifyDisabledUserAuth(repoName, {read: true, write: true, manage: false, graphql: true});
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it('graphql with read', () => {
|
|
350
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
351
|
+
setRoles({read: true, graphql: true, repoName});
|
|
352
|
+
verifyCheckedUserAuth(repoName, {read: true, write: false, manage: false, graphql: true});
|
|
353
|
+
verifyDisabledUserAuth(repoName, {read: false, write: false, manage: false, graphql: false});
|
|
354
|
+
});
|
|
208
355
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
356
|
+
it('graphql with write', () => {
|
|
357
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
358
|
+
setRoles({readWrite: true, graphql: true, repoName});
|
|
359
|
+
verifyCheckedUserAuth(repoName, {read: true, write: true, manage: false, graphql: true});
|
|
360
|
+
verifyDisabledUserAuth(repoName, {read: true, write: false, manage: false, graphql: false});
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
context('for any repo', () => {
|
|
365
|
+
let anyRepo = '*';
|
|
366
|
+
|
|
367
|
+
it('read', () => {
|
|
368
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
369
|
+
setRoles({read: true, anyRepo});
|
|
370
|
+
verifyCheckedUserAuth(anyRepo, {read: true, write: false, manage: false, graphql: false});
|
|
371
|
+
verifyDisabledUserAuth(anyRepo, {read: false, write: false, manage: true, graphql: false});
|
|
372
|
+
|
|
373
|
+
verifyCheckedUserAuth(repoName, {read: true, write: false, manage: false, graphql: false});
|
|
374
|
+
verifyDisabledUserAuth(repoName, {read: true, write: false, manage: false, graphql: false});
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it('write', () => {
|
|
378
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
379
|
+
setRoles({readWrite: true, anyRepo});
|
|
380
|
+
verifyCheckedUserAuth(anyRepo, {read: true, write: true, manage: false, graphql: false});
|
|
381
|
+
verifyDisabledUserAuth(anyRepo, {read: true, write: false, manage: true, graphql: false});
|
|
382
|
+
|
|
383
|
+
verifyCheckedUserAuth(repoName, {read: true, write: true, manage: false, graphql: false});
|
|
384
|
+
verifyDisabledUserAuth(repoName, {read: true, write: true, manage: false, graphql: false});
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it('graphql with read', () => {
|
|
388
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
389
|
+
setRoles({read: true, graphql: true, anyRepo});
|
|
390
|
+
verifyCheckedUserAuth(anyRepo, {read: true, write: false, manage: false, graphql: true});
|
|
391
|
+
verifyDisabledUserAuth(anyRepo, {read: false, write: false, manage: true, graphql: false});
|
|
392
|
+
|
|
393
|
+
verifyCheckedUserAuth(repoName, {read: true, write: false, manage: false, graphql: true});
|
|
394
|
+
verifyDisabledUserAuth(repoName, {read: true, write: false, manage: false, graphql: true});
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
it('graphql with write', () => {
|
|
398
|
+
UserAndAccessSteps.clickCreateNewUserButton();
|
|
399
|
+
setRoles({readWrite: true, graphql: true, anyRepo});
|
|
400
|
+
verifyCheckedUserAuth(anyRepo, {read: true, write: true, manage: false, graphql: true});
|
|
401
|
+
verifyDisabledUserAuth(anyRepo, {read: true, write: false, manage: true, graphql: false});
|
|
402
|
+
|
|
403
|
+
verifyCheckedUserAuth(repoName, {read: true, write: true, manage: false, graphql: true});
|
|
404
|
+
verifyDisabledUserAuth(repoName, {read: true, write: true, manage: false, graphql: true});
|
|
405
|
+
});
|
|
212
406
|
});
|
|
213
407
|
});
|
|
214
|
-
|
|
215
|
-
context('GraphQL
|
|
408
|
+
|
|
409
|
+
context('GraphQL access', () => {
|
|
216
410
|
let repositoryId1;
|
|
217
411
|
let repositoryId2;
|
|
218
412
|
let repositoryId3;
|
|
219
413
|
const graphqlUser = 'graphqlUser';
|
|
220
414
|
|
|
221
415
|
beforeEach(() => {
|
|
222
|
-
cy.viewport(1280, 1000);
|
|
223
416
|
RepositoriesStubs.spyGetRepositories();
|
|
224
417
|
repositoryId1 = 'user-access-repo1-' + Date.now();
|
|
225
418
|
repositoryId2 = 'user-access-repo2-' + Date.now();
|
|
@@ -231,6 +424,7 @@ describe('User and Access', () => {
|
|
|
231
424
|
UserAndAccessSteps.visit();
|
|
232
425
|
// Users table should be visible
|
|
233
426
|
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
427
|
+
SecurityStubs.spyOnUserGet();
|
|
234
428
|
});
|
|
235
429
|
|
|
236
430
|
afterEach(() => {
|
|
@@ -245,174 +439,175 @@ describe('User and Access', () => {
|
|
|
245
439
|
|
|
246
440
|
});
|
|
247
441
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
// Fails for unknown reason only in CI
|
|
254
|
-
it.skip('Can create user with different auth combinations', () => {
|
|
255
|
-
cy.wait('@getRepositories');
|
|
256
|
-
// WHEN I create a user with read + GraphQL for repository #2
|
|
257
|
-
createUser(graphqlUser, PASSWORD, ROLE_USER, {read: true, graphql: true, repoName: repositoryId2});
|
|
258
|
-
// THEN the user should have read + GraphQL on that repo
|
|
259
|
-
assertUserAuths(graphqlUser, {repo: repositoryId2, read: true, graphql: true});
|
|
260
|
-
// WHEN I open the edit page for that user
|
|
261
|
-
UserAndAccessSteps.openEditUserPage(graphqlUser);
|
|
262
|
-
// THEN for repository #1, the GraphQL checkbox should be disabled initially
|
|
263
|
-
UserAndAccessSteps.getGraphqlAccessForRepo(repositoryId1).should('be.disabled');
|
|
264
|
-
// WHEN I enable "read" for repository #1
|
|
265
|
-
editUserAuths({repo: repositoryId1, read: true});
|
|
266
|
-
// THEN GraphQL for repository #1 should become enabled
|
|
267
|
-
UserAndAccessSteps.getGraphqlAccessForRepo(repositoryId1).should('be.enabled');
|
|
268
|
-
// WHEN I enable GraphQL and read
|
|
269
|
-
editUserAuths({repo: repositoryId1, graphql: true});
|
|
270
|
-
editUserAuths({repo: repositoryId1, read: true});
|
|
271
|
-
// THEN GraphQL should be checked and disabled
|
|
272
|
-
UserAndAccessSteps.getGraphqlAccessForRepo(repositoryId1).should('be.checked').and('be.disabled');
|
|
273
|
-
// THEN for repository #3, GraphQL should be disabled initially
|
|
274
|
-
UserAndAccessSteps.getGraphqlAccessForRepo(repositoryId3).should('be.disabled');
|
|
275
|
-
// WHEN I enable "write" for repository #3
|
|
276
|
-
editUserAuths({repo: repositoryId3, write: true});
|
|
277
|
-
// THEN GraphQL for repository #3 should become enabled
|
|
278
|
-
UserAndAccessSteps.getGraphqlAccessForRepo(repositoryId3).should('be.enabled');
|
|
279
|
-
// And I expect "read" to be checked and disabled
|
|
280
|
-
UserAndAccessSteps.getReadAccessForRepo(repositoryId3).should('be.checked').and('be.disabled');
|
|
281
|
-
// I enable GraphQL for repository #3
|
|
282
|
-
editUserAuths({repo: repositoryId3, graphql: true});
|
|
283
|
-
|
|
284
|
-
// WHEN I confirm the user edit
|
|
285
|
-
UserAndAccessSteps.confirmUserEdit();
|
|
286
|
-
// THEN verify the final rights:
|
|
287
|
-
// - repo #1 has no read/write/graphql
|
|
288
|
-
// - repo #2 has read + graphql
|
|
289
|
-
// - repo #3 has write + graphql (and read was auto-checked but disabled)
|
|
290
|
-
assertUserAuths(graphqlUser, {repo: repositoryId1, read: false, write: false, graphql: false});
|
|
291
|
-
assertUserAuths(graphqlUser, {repo: repositoryId2, read: true, write: false, graphql: true});
|
|
292
|
-
assertUserAuths(graphqlUser, {repo: repositoryId3, read: false, write: true, graphql: true});
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
// TODO remove skipped flag from all tests after merge of https://github.com/Ontotext-AD/graphdb-workbench/pull/2042
|
|
296
|
-
it.skip('Should have access to 5 pages when have graphql only rights', () => {
|
|
297
|
-
cy.wait('@getRepositories');
|
|
298
|
-
// WHEN I create a user with read + GraphQL for repository #2
|
|
299
|
-
createUser(graphqlUser, PASSWORD, ROLE_USER, {readWrite: true, graphql: true, repoName: repositoryId1});
|
|
300
|
-
//enable security
|
|
301
|
-
UserAndAccessSteps.toggleSecurity();
|
|
302
|
-
//login new user
|
|
303
|
-
LoginSteps.loginWithUser(graphqlUser, PASSWORD);
|
|
304
|
-
RepositorySelectorSteps.selectRepository(repositoryId1);
|
|
305
|
-
|
|
306
|
-
MENU_ITEMS_WITHOUT_GRAPHQL.forEach(({path, expectedUrl, checks, expectedTitle}) => {
|
|
307
|
-
navigateMenuPath(path, expectedUrl, expectedTitle);
|
|
308
|
-
if (checks) {
|
|
309
|
-
runChecks(checks);
|
|
310
|
-
}
|
|
442
|
+
context('GraphQL checkbox behavior', () => {
|
|
443
|
+
it('Create user with GraphQL-only access', () => {
|
|
444
|
+
cy.wait('@getRepositories');
|
|
445
|
+
createUser(graphqlUser, PASSWORD, ROLE_USER, {read: true, graphql: true, repoName: repositoryId2});
|
|
311
446
|
});
|
|
312
|
-
});
|
|
313
447
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
448
|
+
// Fails for unknown reason only in CI
|
|
449
|
+
it('Can create user with different auth combinations', () => {
|
|
450
|
+
cy.wait('@getRepositories');
|
|
451
|
+
cy.wait('@getRepositories');
|
|
452
|
+
UserAndAccessSteps.getUsersCatalogContainer().should('be.visible');
|
|
453
|
+
// WHEN I create a user with read + GraphQL for repository #2
|
|
454
|
+
createUser(graphqlUser, PASSWORD, ROLE_USER, {read: true, graphql: true, repoName: repositoryId2});
|
|
455
|
+
// THEN the user should have read + GraphQL on that repo
|
|
456
|
+
assertUserAuthsInCatalog(graphqlUser, {repo: repositoryId2, read: true, graphql: true});
|
|
457
|
+
// WHEN I open the edit page for that user
|
|
458
|
+
UserAndAccessSteps.openEditUserPage(graphqlUser);
|
|
459
|
+
cy.wait('@get-user');
|
|
460
|
+
// THEN for repository #1, the GraphQL checkbox should be disabled initially
|
|
461
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repositoryId1, {disabled: true});
|
|
462
|
+
// WHEN I enable "read" for repository #1
|
|
463
|
+
setUserAuths({repo: repositoryId1, read: true});
|
|
464
|
+
// THEN GraphQL for repository #1 should become enabled
|
|
465
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repositoryId1, {disabled: false});
|
|
466
|
+
// WHEN I enable GraphQL with read
|
|
467
|
+
setUserAuths({repo: repositoryId1, graphql: true});
|
|
468
|
+
// THEN GraphQL should be checked and enabled
|
|
469
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repositoryId1, {checked: true, disabled: false});
|
|
470
|
+
// THEN for repository #3, GraphQL should be disabled initially
|
|
471
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repositoryId3, {disabled: true});
|
|
472
|
+
// WHEN I enable "write" for repository #3
|
|
473
|
+
setUserAuths({repo: repositoryId3, write: true});
|
|
474
|
+
// THEN GraphQL for repository #3 should become enabled
|
|
475
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repositoryId3, {disabled: false});
|
|
476
|
+
// And I expect "read" to be checked and disabled
|
|
477
|
+
UserAndAccessSteps.validateReadAccessForRepo(repositoryId3, {checked: true, disabled: true});
|
|
478
|
+
// I enable GraphQL for repository #3
|
|
479
|
+
setUserAuths({repo: repositoryId3, graphql: true});
|
|
480
|
+
// THEN GraphQL should be checked and enabled
|
|
481
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repositoryId1, {checked: true, disabled: false});
|
|
482
|
+
// When I remove "read" for repository #2
|
|
483
|
+
UserAndAccessSteps.toggleReadAccessForRepo(repositoryId2);
|
|
484
|
+
// THEN I expect "graphql" to be unchecked and disabled for repository #2
|
|
485
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repositoryId2, {checked: false, disabled: true});
|
|
486
|
+
|
|
487
|
+
// WHEN I confirm the user edit
|
|
488
|
+
UserAndAccessSteps.confirmUserEdit();
|
|
489
|
+
// THEN verify the final rights:
|
|
490
|
+
// - repo #1 has no read/write/graphql
|
|
491
|
+
// - repo #2 has read + graphql
|
|
492
|
+
// - repo #3 has write + graphql (and read was auto-checked but disabled)
|
|
493
|
+
assertUserAuthsInCatalog(graphqlUser, {repo: repositoryId1, read: true, write: false, graphql: true});
|
|
494
|
+
assertUserAuthsInCatalog(graphqlUser, {repo: repositoryId2, read: false, write: false, graphql: false});
|
|
495
|
+
assertUserAuthsInCatalog(graphqlUser, {repo: repositoryId3, read: false, write: true, graphql: true});
|
|
329
496
|
});
|
|
330
497
|
});
|
|
331
498
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
499
|
+
context('Menu navigation based on permissions', () => {
|
|
500
|
+
it('Should have access to 5 pages when have graphql only rights', () => {
|
|
501
|
+
cy.wait('@getRepositories');
|
|
502
|
+
cy.wait('@getRepositories');
|
|
503
|
+
// WHEN I create a user with read + GraphQL for repository #2
|
|
504
|
+
createUser(graphqlUser, PASSWORD, ROLE_USER, {readWrite: true, graphql: true, repoName: repositoryId1});
|
|
505
|
+
//enable security
|
|
506
|
+
UserAndAccessSteps.toggleSecurity();
|
|
507
|
+
//login new user
|
|
508
|
+
LoginSteps.loginWithUser(graphqlUser, PASSWORD);
|
|
509
|
+
cy.wait('@getRepositories');
|
|
510
|
+
cy.wait('@getRepositories');
|
|
511
|
+
|
|
512
|
+
MENU_ITEMS_WITHOUT_GRAPHQL.forEach(({path, expectedUrl, checks, expectedTitle}) => {
|
|
513
|
+
navigateMenuPath(path, expectedUrl, expectedTitle);
|
|
514
|
+
|
|
515
|
+
if (checks) {
|
|
516
|
+
runChecks(checks);
|
|
517
|
+
}
|
|
518
|
+
navigateMenuPath(['Import'], '/import', 'Import');
|
|
519
|
+
});
|
|
345
520
|
});
|
|
346
|
-
});
|
|
347
521
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
522
|
+
it('Should not have access endpoints management when have read graphql only rights', () => {
|
|
523
|
+
cy.wait('@getRepositories');
|
|
524
|
+
cy.wait('@getRepositories');
|
|
525
|
+
// WHEN I create a user with read + GraphQL for repository #2
|
|
526
|
+
createUser(graphqlUser, PASSWORD, ROLE_USER, {read: true, graphql: true, repoName: repositoryId1});
|
|
527
|
+
//enable security
|
|
528
|
+
UserAndAccessSteps.toggleSecurity();
|
|
529
|
+
//login new user
|
|
530
|
+
LoginSteps.loginWithUser(graphqlUser, PASSWORD);
|
|
531
|
+
cy.wait('@getRepositories');
|
|
532
|
+
cy.wait('@getRepositories');
|
|
533
|
+
// RepositorySelectorSteps.selectRepository(repositoryId1);
|
|
534
|
+
|
|
535
|
+
GRAPHQL_READ_MENU_ITEMS.forEach(({path, expectedUrl, checks, expectedTitle}) => {
|
|
536
|
+
navigateMenuPath(path, expectedUrl, expectedTitle);
|
|
537
|
+
if (checks) {
|
|
538
|
+
runChecks(checks);
|
|
539
|
+
}
|
|
540
|
+
navigateMenuPath(['Import'], '/import', 'Import');
|
|
541
|
+
});
|
|
542
|
+
});
|
|
370
543
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
544
|
+
it('Should have all access to endpoints management when have REPO_MANAGER role', () => {
|
|
545
|
+
cy.wait('@getRepositories');
|
|
546
|
+
cy.wait('@getRepositories');
|
|
547
|
+
createUser(graphqlUser, PASSWORD, ROLE_REPO_MANAGER);
|
|
548
|
+
//enable security
|
|
549
|
+
UserAndAccessSteps.toggleSecurity();
|
|
550
|
+
HomeSteps.visitAndWaitLoader();
|
|
551
|
+
//login new user
|
|
552
|
+
LoginSteps.loginWithUser(graphqlUser, PASSWORD);
|
|
553
|
+
cy.wait('@getRepositories');
|
|
554
|
+
cy.wait('@getRepositories');
|
|
555
|
+
GRAPHQL_REPO_MANAGER_MENU_ITEMS.forEach(({path, expectedUrl, checks, expectedTitle}) => {
|
|
556
|
+
navigateMenuPath(path, expectedUrl, expectedTitle);
|
|
557
|
+
if (checks) {
|
|
558
|
+
runChecks(checks);
|
|
559
|
+
}
|
|
560
|
+
navigateMenuPath(['Import'], '/import', 'Import');
|
|
561
|
+
});
|
|
382
562
|
});
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
cy.
|
|
563
|
+
|
|
564
|
+
it('Can have Free Access and GraphQL working together', () => {
|
|
565
|
+
cy.wait('@getRepositories');
|
|
566
|
+
cy.wait('@getRepositories');
|
|
567
|
+
//enable security
|
|
568
|
+
UserAndAccessSteps.toggleSecurity();
|
|
569
|
+
//login with the admin
|
|
570
|
+
LoginSteps.loginWithUser('admin', DEFAULT_ADMIN_PASSWORD);
|
|
571
|
+
cy.wait('@getRepositories');
|
|
572
|
+
cy.wait('@getRepositories');
|
|
573
|
+
// The Free Access toggle should be OFF
|
|
574
|
+
UserAndAccessSteps.getFreeAccessSwitchInput().should('not.be.checked');
|
|
575
|
+
// When I toggle Free Access ON
|
|
576
|
+
UserAndAccessSteps.toggleFreeAccess();
|
|
577
|
+
// Then I set repo auths
|
|
578
|
+
UserAndAccessSteps.clickFreeReadAccessRepo(repositoryId1);
|
|
579
|
+
UserAndAccessSteps.clickFreeWriteAccessRepo(repositoryId2);
|
|
580
|
+
UserAndAccessSteps.clickFreeWriteAccessRepo(repositoryId3);
|
|
581
|
+
UserAndAccessSteps.clickFreeGraphqlAccessRepo(repositoryId3);
|
|
582
|
+
// Then I click OK in the modal
|
|
583
|
+
ModalDialogSteps.clickOKButton();
|
|
584
|
+
// Then the toggle button should be ON
|
|
585
|
+
UserAndAccessSteps.getFreeAccessSwitchInput().should('be.checked');
|
|
586
|
+
// And I should see a success message
|
|
587
|
+
ToasterSteps.verifySuccess('Free access has been enabled.');
|
|
588
|
+
UserAndAccessSteps.getUsersTable().should('be.visible');
|
|
589
|
+
|
|
590
|
+
// Then I logout
|
|
591
|
+
LoginSteps.logout();
|
|
592
|
+
HomeSteps.visit();
|
|
593
|
+
// I change the repository to this with GraphQL only rights
|
|
594
|
+
RepositorySelectorSteps.selectRepository(repositoryId3);
|
|
595
|
+
// Then I should have GraphQL only rights
|
|
596
|
+
FREE_ACCESS_MENU_ITEMS_WITHOUT_GRAPHQL.forEach(({path, expectedUrl, checks, expectedTitle}) => {
|
|
597
|
+
navigateMenuPath(path, expectedUrl, expectedTitle);
|
|
598
|
+
if (checks) {
|
|
599
|
+
runChecks(checks);
|
|
600
|
+
}
|
|
601
|
+
navigateMenuPath(['Import'], '/import', 'Import');
|
|
602
|
+
});
|
|
386
603
|
});
|
|
387
604
|
});
|
|
388
605
|
});
|
|
389
606
|
|
|
390
|
-
function clickGraphqlAccessForRepo(repoName) {
|
|
391
|
-
if (repoName === '*') {
|
|
392
|
-
UserAndAccessSteps.clickGraphqlAccessAny();
|
|
393
|
-
} else {
|
|
394
|
-
UserAndAccessSteps.clickGraphqlAccessRepo(repoName);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
function clickReadAccessForRepo(repoName) {
|
|
399
|
-
if (repoName === '*') {
|
|
400
|
-
UserAndAccessSteps.clickReadAccessAny();
|
|
401
|
-
} else {
|
|
402
|
-
UserAndAccessSteps.clickReadAccessRepo(repoName);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
function clickWriteAccessForRepo(repoName) {
|
|
407
|
-
if (repoName === '*') {
|
|
408
|
-
UserAndAccessSteps.clickWriteAccessAny();
|
|
409
|
-
} else {
|
|
410
|
-
UserAndAccessSteps.clickWriteAccessRepo(repoName);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
607
|
function createUser(username, password, role, opts = {}) {
|
|
415
608
|
UserAndAccessSteps.clickCreateNewUserButton();
|
|
609
|
+
cy.url().should('include', '/user/create');
|
|
610
|
+
UserAndAccessSteps.getUsernameField().should('be.visible').and('be.enabled').and('not.be.disabled');
|
|
416
611
|
UserAndAccessSteps.typeUsername(username);
|
|
417
612
|
UserAndAccessSteps.typePassword(password);
|
|
418
613
|
UserAndAccessSteps.typeConfirmPasswordField(password);
|
|
@@ -421,8 +616,9 @@ describe('User and Access', () => {
|
|
|
421
616
|
|
|
422
617
|
if (role === '#roleUser') {
|
|
423
618
|
setRoles(opts);
|
|
424
|
-
|
|
425
|
-
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if (role === ROLE_CUSTOM_ADMIN && opts.noPassword) {
|
|
426
622
|
UserAndAccessSteps.getNoPasswordCheckbox().check()
|
|
427
623
|
.then(() => {
|
|
428
624
|
UserAndAccessSteps.getNoPasswordCheckbox()
|
|
@@ -442,16 +638,8 @@ describe('User and Access', () => {
|
|
|
442
638
|
}
|
|
443
639
|
|
|
444
640
|
function setRoles(opts = {}) {
|
|
445
|
-
const {read = false, readWrite = false, graphql = false, repoName = '*'} = opts;
|
|
446
|
-
|
|
447
|
-
clickReadAccessForRepo(repoName);
|
|
448
|
-
}
|
|
449
|
-
if (readWrite) {
|
|
450
|
-
clickWriteAccessForRepo(repoName);
|
|
451
|
-
}
|
|
452
|
-
if (graphql) {
|
|
453
|
-
clickGraphqlAccessForRepo(repoName);
|
|
454
|
-
}
|
|
641
|
+
const {read = false, readWrite = false, graphql = false, manage = false, repoName = '*'} = opts;
|
|
642
|
+
setUserAuths({repo: repoName, read, write: readWrite, graphql, manage});
|
|
455
643
|
}
|
|
456
644
|
|
|
457
645
|
function testForUser(name, isAdmin) {
|
|
@@ -470,10 +658,10 @@ describe('User and Access', () => {
|
|
|
470
658
|
}
|
|
471
659
|
}
|
|
472
660
|
|
|
473
|
-
function
|
|
661
|
+
function assertUserAuthsInCatalog(username, {repo, read = false, write = false, manage = false, graphql = false} = {}) {
|
|
474
662
|
UserAndAccessSteps.findUserRowAlias(username, 'userRow');
|
|
475
663
|
|
|
476
|
-
if (!read && !write) {
|
|
664
|
+
if (!read && !write && !manage) {
|
|
477
665
|
return UserAndAccessSteps.getRepoLine('@userRow', repo).should('not.exist');
|
|
478
666
|
}
|
|
479
667
|
|
|
@@ -492,6 +680,12 @@ describe('User and Access', () => {
|
|
|
492
680
|
UserAndAccessSteps.findWriteIconAlias('@repoLine').should('not.exist');
|
|
493
681
|
}
|
|
494
682
|
|
|
683
|
+
if (manage) {
|
|
684
|
+
UserAndAccessSteps.findManageIconAlias('@repoLine').should('be.visible');
|
|
685
|
+
} else {
|
|
686
|
+
UserAndAccessSteps.findManageIconAlias('@repoLine').should('not.exist');
|
|
687
|
+
}
|
|
688
|
+
|
|
495
689
|
if (graphql) {
|
|
496
690
|
UserAndAccessSteps.findGraphqlIconAlias('@repoLine').should('exist');
|
|
497
691
|
} else {
|
|
@@ -499,28 +693,56 @@ describe('User and Access', () => {
|
|
|
499
693
|
}
|
|
500
694
|
}
|
|
501
695
|
|
|
502
|
-
function
|
|
696
|
+
function setUserAuths({repo, read = false, write = false, graphql = false, manage = false} = {}) {
|
|
503
697
|
if (read === true) {
|
|
504
698
|
UserAndAccessSteps.toggleReadAccessForRepo(repo);
|
|
699
|
+
UserAndAccessSteps.validateReadAccessForRepo(repo, {checked: read});
|
|
505
700
|
}
|
|
506
701
|
|
|
507
702
|
if (write === true) {
|
|
508
703
|
UserAndAccessSteps.toggleWriteAccessForRepo(repo);
|
|
704
|
+
UserAndAccessSteps.validateWriteAccessForRepo(repo, {checked: write});
|
|
509
705
|
}
|
|
510
706
|
|
|
511
707
|
if (graphql === true) {
|
|
512
708
|
UserAndAccessSteps.toggleGraphqlAccessForRepo(repo);
|
|
709
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repo, {checked: graphql});
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
if (manage === true) {
|
|
713
|
+
UserAndAccessSteps.toggleManageRepoForRepo(repo);
|
|
714
|
+
UserAndAccessSteps.validateManageAccessForRepo(repo, {checked: manage});
|
|
513
715
|
}
|
|
514
716
|
}
|
|
515
717
|
|
|
718
|
+
function verifyCheckedUserAuth(repo, {read = false, write = false, graphql = false, manage = false} = {}) {
|
|
719
|
+
UserAndAccessSteps.validateReadAccessForRepo(repo, {checked: read});
|
|
720
|
+
UserAndAccessSteps.validateWriteAccessForRepo(repo, {checked: write});
|
|
721
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repo, {checked: graphql});
|
|
722
|
+
UserAndAccessSteps.validateManageAccessForRepo(repo, {checked: manage});
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
function verifyDisabledUserAuth(repo, {read = false, write = false, graphql = false, manage = false} = {}) {
|
|
726
|
+
UserAndAccessSteps.validateReadAccessForRepo(repo, {disabled: read});
|
|
727
|
+
UserAndAccessSteps.validateWriteAccessForRepo(repo, {disabled: write});
|
|
728
|
+
UserAndAccessSteps.validateGraphqlAccessForRepo(repo, {disabled: graphql});
|
|
729
|
+
UserAndAccessSteps.validateManageAccessForRepo(repo, {disabled: manage});
|
|
730
|
+
}
|
|
731
|
+
|
|
516
732
|
function navigateMenuPath(pathArray, expectedUrl, expectedTitle) {
|
|
517
733
|
pathArray.forEach((label, index) => {
|
|
518
734
|
if (index === 0) {
|
|
519
735
|
MainMenuSteps.clickOnMenu(label);
|
|
736
|
+
if (pathArray.length > 1) {
|
|
737
|
+
MainMenuSteps.getSubmenuFor(label).scrollIntoView().should('be.visible');
|
|
738
|
+
}
|
|
520
739
|
} else {
|
|
521
740
|
MainMenuSteps.clickOnSubMenu(label);
|
|
741
|
+
}
|
|
742
|
+
if (index === pathArray.length - 1) {
|
|
743
|
+
// wait for the page label on the last navigation step to be visible before moving on
|
|
522
744
|
const title = expectedTitle ? expectedTitle : label;
|
|
523
|
-
cy.get('h1').should('contain', title);
|
|
745
|
+
cy.get('h1').should('be.visible').should('contain', title);
|
|
524
746
|
}
|
|
525
747
|
});
|
|
526
748
|
|
|
@@ -558,9 +780,6 @@ describe('User and Access', () => {
|
|
|
558
780
|
}
|
|
559
781
|
|
|
560
782
|
const noAuthChecks = {
|
|
561
|
-
'div[role="main]': [
|
|
562
|
-
'not.exist',
|
|
563
|
-
],
|
|
564
783
|
'.no-authority-panel .alert-warning': [
|
|
565
784
|
'be.visible',
|
|
566
785
|
['contains.text', 'Some functionalities are not available because'],
|
|
@@ -569,10 +788,6 @@ describe('User and Access', () => {
|
|
|
569
788
|
};
|
|
570
789
|
|
|
571
790
|
const hasAuthChecks = {
|
|
572
|
-
'div[role="main"]': [
|
|
573
|
-
'exist',
|
|
574
|
-
'be.visible',
|
|
575
|
-
],
|
|
576
791
|
'.no-authority-panel .alert-warning': [
|
|
577
792
|
'not.exist',
|
|
578
793
|
],
|
|
@@ -813,13 +1028,5 @@ describe('User and Access', () => {
|
|
|
813
1028
|
expectedUrl: '/sparql-templates',
|
|
814
1029
|
checks: noAuthChecks,
|
|
815
1030
|
},
|
|
816
|
-
|
|
817
|
-
// 7) Help
|
|
818
|
-
{
|
|
819
|
-
path: ['Help', 'REST API'],
|
|
820
|
-
expectedUrl: '/webapi',
|
|
821
|
-
expectedTitle: 'REST API documentation',
|
|
822
|
-
checks: hasAuthChecks,
|
|
823
|
-
},
|
|
824
1031
|
];
|
|
825
1032
|
});
|