graphdb-workbench-tests 2.6.0-TR5 → 2.6.0-TR6

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.
@@ -144,21 +144,30 @@
144
144
  },
145
145
  "acl_management": {
146
146
  "rulestable": {
147
+ "tab": {
148
+ "statement": "Statement",
149
+ "clear_graph": "Clear graph",
150
+ "plugin": "Plugin",
151
+ "system": "System"
152
+ },
147
153
  "column": {
148
154
  "index": "#",
155
+ "policy": "Policy",
156
+ "role": "Role",
157
+ "operation": "Operation",
149
158
  "subject": "Subject",
150
159
  "predicate": "Predicate",
151
160
  "object": "Object",
152
161
  "context": "Context",
153
- "role": "Role",
154
- "policy": "Policy"
162
+ "plugin": "Plugin"
155
163
  },
156
164
  "field_placeholders": {
157
165
  "subject": "Subject",
158
166
  "predicate": "Predicate",
159
167
  "object": "Object",
160
168
  "context": "Context",
161
- "role": "Role"
169
+ "role": "Custom role",
170
+ "plugin": "Plugin"
162
171
  },
163
172
  "actions": {
164
173
  "move_up": "Move the rule up",
@@ -1,6 +1,5 @@
1
1
  import {AclManagementSteps} from "../../../steps/setup/acl-management-steps";
2
- import {ACL} from "../../../steps/setup/acl-management-steps";
3
- import {ToasterSteps} from "../../../steps/toaster-steps";
2
+ import {ACL_VIEW} from "../../../steps/setup/acl-management-steps";
4
3
  import {ApplicationSteps} from "../../../steps/application-steps";
5
4
 
6
5
  describe('ACL Management: create rule', () => {
@@ -19,6 +18,7 @@ describe('ACL Management: create rule', () => {
19
18
  cy.enableAutocomplete(repositoryId);
20
19
  AclManagementSteps.importRules(repositoryId);
21
20
  AclManagementSteps.visit();
21
+ ApplicationSteps.geLoader().should('not.exist');
22
22
  // ensure rules are rendered
23
23
  AclManagementSteps.getAclRules().should('have.length.gt', 0);
24
24
  });
@@ -41,6 +41,9 @@ describe('ACL Management: create rule', () => {
41
41
  it('Should add a new rule in the list', () => {
42
42
  // When I add a new rule
43
43
  AclManagementSteps.addRule(1);
44
+ // When I fill in the role field
45
+ AclManagementSteps.getRoleField(2).should('have.value', '');
46
+ AclManagementSteps.fillRole(2, 'ROLE1');
44
47
  // Then I expect that the save rule button should be enabled because all fields have some default values
45
48
  AclManagementSteps.checkIfRuleSavingIsAllowed(2);
46
49
  // When I fill in the subject field
@@ -63,30 +66,103 @@ describe('ACL Management: create rule', () => {
63
66
  AclManagementSteps.fillContext(2, '*');
64
67
  // Then I expect that the save rule button should be enabled
65
68
  AclManagementSteps.checkIfRuleSavingIsAllowed(2);
66
- // When I fill in the role field
67
- AclManagementSteps.getRoleField(2).should('have.value', 'CUSTOM_');
68
- AclManagementSteps.fillRole(2, 'CUSTOM_ROLE1');
69
69
  // Then I expect that the save rule button should be enabled
70
70
  AclManagementSteps.checkIfRuleSavingIsAllowed(2);
71
71
  // When I change the policy
72
72
  AclManagementSteps.selectPolicy(2, 'deny');
73
73
  // Then I expect that the save rule button should be enabled
74
74
  AclManagementSteps.checkIfRuleSavingIsAllowed(2);
75
+ // When I change the operation
76
+ AclManagementSteps.selectOperation(2, 'write');
77
+ // Then I expect that the save rule button should be enabled
78
+ AclManagementSteps.checkIfRuleSavingIsAllowed(2);
75
79
  // When I save the rule
76
80
  AclManagementSteps.saveRule(2);
77
81
  // Then the rule should be saved
78
82
  AclManagementSteps.getAclRules().should('have.length', 6);
79
83
  const newRule = {
84
+ "scope": "statement",
85
+ "policy": "deny",
86
+ "role": "ROLE1",
80
87
  "subject": "<urn:John>",
81
88
  "predicate": "*",
82
89
  "object": "*",
83
90
  "context": "*",
84
- "role": "CUSTOM_ROLE1",
85
- "policy": "deny",
91
+ "operation": "write",
86
92
  "moveUp": true,
87
93
  "moveDown": true
88
94
  };
89
- AclManagementSteps.checkRules([ACL[0], ACL[1], newRule, ACL[2], ACL[3], ACL[4]]);
95
+ AclManagementSteps.checkStatementRules([ACL_VIEW[0], ACL_VIEW[1], newRule, ACL_VIEW[2], ACL_VIEW[3], ACL_VIEW[4]]);
96
+
97
+ cy.intercept('PUT', '/rest/repositories/acl-management-*/acl').as('putCall');
98
+ // When I save the rules
99
+ AclManagementSteps.saveAcl();
100
+ // Then wait for the PUT call to occur and assert the request body
101
+ cy.wait('@putCall').then((interception) => {
102
+ const expected = [
103
+ {
104
+ "scope": "statement",
105
+ "policy": "allow",
106
+ "role": "!CUSTOM_ROLE2",
107
+ "operation": "write",
108
+ "subject": "<urn:Mary>",
109
+ "predicate": "*",
110
+ "object": "*",
111
+ "context": "*"
112
+ },
113
+ {
114
+ "scope": "statement",
115
+ "policy": "deny",
116
+ "role": "CUSTOM_ROLE1",
117
+ "operation": "read",
118
+ "subject": "*",
119
+ "predicate": "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>",
120
+ "object": "*",
121
+ "context": "*"
122
+ },
123
+ {
124
+ "scope": "statement",
125
+ "policy": "deny",
126
+ "role": "CUSTOM_ROLE1",
127
+ "operation": "write",
128
+ "subject": "<urn:John>",
129
+ "predicate": "*",
130
+ "object": "*",
131
+ "context": "*"
132
+ },
133
+ {
134
+ "scope": "statement",
135
+ "policy": "deny",
136
+ "role": "CUSTOM_ROLE3",
137
+ "operation": "read",
138
+ "subject": "<<<http://example.com/test> <http://www.w3.org/2000/01/rdf-schema#label> \"test aber auf Deutsch\"@de>>",
139
+ "predicate": "*",
140
+ "object": "\"test aber auf Deutsch\"@en",
141
+ "context": "<http://example.com/graph1>"
142
+ },
143
+ {
144
+ "scope": "statement",
145
+ "policy": "allow",
146
+ "role": "CUSTOM_ROLE3",
147
+ "operation": "write",
148
+ "subject": "*",
149
+ "predicate": "*",
150
+ "object": "\"15\"^^<http://www.w3.org/2001/XMLSchema#int>",
151
+ "context": "*"
152
+ },
153
+ {
154
+ "scope": "statement",
155
+ "policy": "deny",
156
+ "role": "CUSTOM_ROLE4",
157
+ "operation": "write",
158
+ "subject": "<urn:Cat>",
159
+ "predicate": "*",
160
+ "object": "<<<http://example.com/test> <http://www.w3.org/2000/01/rdf-schema#label> \"test aber auf Deutsch\"@de>>",
161
+ "context": "*"
162
+ }
163
+ ];
164
+ expect(interception.request.body).to.deep.eq(expected);
165
+ });
90
166
  });
91
167
 
92
168
  it('Should hide all unnecessary actions during rule creation', () => {
@@ -110,12 +186,13 @@ describe('ACL Management: create rule', () => {
110
186
  it('should not allow creating of a new rule if it is not unique', () => {
111
187
  // When I am on "ACL Management" page and create a rule that exist,
112
188
  AclManagementSteps.addRuleInBeginning();
189
+ AclManagementSteps.selectPolicy(0, 'allow');
190
+ AclManagementSteps.fillRole(0, '!ROLE2');
191
+ AclManagementSteps.selectOperation(0, 'write');
113
192
  AclManagementSteps.fillSubject(0, '<urn:Mary>');
114
193
  AclManagementSteps.fillPredicate(0, '*');
115
194
  AclManagementSteps.fillObject(0, '*');
116
195
  AclManagementSteps.fillContext(0, '*');
117
- AclManagementSteps.fillRole(0, '!CUSTOM_ROLE2');
118
- AclManagementSteps.selectPolicy(0, 'allow');
119
196
  // and try to save it.
120
197
  AclManagementSteps.saveRule(0);
121
198
 
@@ -1,6 +1,7 @@
1
1
  import {AclManagementSteps} from "../../../steps/setup/acl-management-steps";
2
- import {ACL} from "../../../steps/setup/acl-management-steps";
2
+ import {ACL_VIEW} from "../../../steps/setup/acl-management-steps";
3
3
  import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
4
+ import {ApplicationSteps} from "../../../steps/application-steps";
4
5
 
5
6
  describe('ACL Management: delete rule', () => {
6
7
 
@@ -18,6 +19,7 @@ describe('ACL Management: delete rule', () => {
18
19
  cy.enableAutocomplete(repositoryId);
19
20
  AclManagementSteps.importRules(repositoryId);
20
21
  AclManagementSteps.visit();
22
+ ApplicationSteps.geLoader().should('not.exist');
21
23
  // ensure rules are rendered
22
24
  AclManagementSteps.getAclRules().should('have.length.gt', 0);
23
25
  });
@@ -41,6 +43,6 @@ describe('ACL Management: delete rule', () => {
41
43
  // Then I expect the rule to be removed from the list
42
44
  ModalDialogSteps.getDialog().should('not.exist');
43
45
  AclManagementSteps.getAclRules().should('have.length', 4);
44
- AclManagementSteps.checkRules([ACL[0], ACL[1], ACL[2], ACL[3]]);
46
+ AclManagementSteps.checkStatementRules([ACL_VIEW[0], ACL_VIEW[1], ACL_VIEW[2], ACL_VIEW[3]]);
45
47
  });
46
48
  });
@@ -1,5 +1,6 @@
1
1
  import {AclManagementSteps} from "../../../steps/setup/acl-management-steps";
2
- import {ACL} from "../../../steps/setup/acl-management-steps";
2
+ import {ACL_VIEW} from "../../../steps/setup/acl-management-steps";
3
+ import {ApplicationSteps} from "../../../steps/application-steps";
3
4
 
4
5
  describe('ACL Management: edit rule', () => {
5
6
 
@@ -17,6 +18,7 @@ describe('ACL Management: edit rule', () => {
17
18
  cy.enableAutocomplete(repositoryId);
18
19
  AclManagementSteps.importRules(repositoryId);
19
20
  AclManagementSteps.visit();
21
+ ApplicationSteps.geLoader().should('not.exist');
20
22
  // ensure rules are rendered
21
23
  AclManagementSteps.getAclRules().should('have.length.gt', 0);
22
24
  });
@@ -50,7 +52,7 @@ describe('ACL Management: edit rule', () => {
50
52
  predicate: '*',
51
53
  object: '"test aber auf Deutsch"@en',
52
54
  context: '<http://example.com/graph1>',
53
- role: 'CUSTOM_ROLE3',
55
+ role: 'ROLE3',
54
56
  policy: 'deny'
55
57
  });
56
58
  AclManagementSteps.checkIfRuleSavingIsAllowed(2);
@@ -58,7 +60,7 @@ describe('ACL Management: edit rule', () => {
58
60
  AclManagementSteps.cancelRuleEditing(2);
59
61
  // Then I expect that the rule will be opened in preview mode again with the same values
60
62
  AclManagementSteps.getAclRules().should('have.length', 5);
61
- AclManagementSteps.checkRules(ACL);
63
+ AclManagementSteps.checkStatementRules(ACL_VIEW);
62
64
  // When I edit the rule again
63
65
  AclManagementSteps.editRule(2);
64
66
  AclManagementSteps.fillSubject(2, '<urn:Me>');
@@ -68,18 +70,21 @@ describe('ACL Management: edit rule', () => {
68
70
  AclManagementSteps.fillContext(2, '*');
69
71
  AclManagementSteps.fillRole(2, 'TEST');
70
72
  AclManagementSteps.selectPolicy(2, 'allow');
73
+ AclManagementSteps.selectOperation(2, 'write');
71
74
  // And I save the rule
72
75
  AclManagementSteps.saveRule(2);
73
76
  // Then I expect the rule to be saved with the new data
74
77
  const editedRule = {
78
+ scope: "statement",
79
+ policy: 'allow',
80
+ role: 'TEST',
81
+ operation: "write",
75
82
  subject: '<urn:Me>',
76
83
  predicate: '<http://www.w3.org/1999/02/22-rdf-syntax-ns#>',
77
84
  object: '*',
78
- context: '*',
79
- role: 'TEST',
80
- policy: 'allow'
85
+ context: '*'
81
86
  };
82
- AclManagementSteps.checkRules([ACL[0], ACL[1], editedRule, ACL[3], ACL[4]]);
87
+ AclManagementSteps.checkStatementRules([ACL_VIEW[0], ACL_VIEW[1], editedRule, ACL_VIEW[3], ACL_VIEW[4]]);
83
88
  });
84
89
  });
85
90
 
@@ -1,5 +1,6 @@
1
1
  import {AclManagementSteps} from "../../../steps/setup/acl-management-steps";
2
- import {ACL} from "../../../steps/setup/acl-management-steps";
2
+ import {ACL_VIEW} from "../../../steps/setup/acl-management-steps";
3
+ import {ApplicationSteps} from "../../../steps/application-steps";
3
4
 
4
5
  describe('ACL Management: render rules', () => {
5
6
 
@@ -16,6 +17,7 @@ describe('ACL Management: render rules', () => {
16
17
  cy.presetRepository(repositoryId);
17
18
  cy.initializeRepository(repositoryId);
18
19
  AclManagementSteps.visit();
20
+ ApplicationSteps.geLoader().should('not.exist');
19
21
  });
20
22
 
21
23
  it('Should render empty ACL rules table', () => {
@@ -42,7 +44,7 @@ describe('ACL Management: render rules', () => {
42
44
  it('Should render ACL rules in a table', () => {
43
45
  AclManagementSteps.getAclRules().should('have.length', 5);
44
46
  AclManagementSteps.getAddFirstRuleButton().should('be.visible');
45
- AclManagementSteps.checkRules(ACL);
47
+ AclManagementSteps.checkStatementRules(ACL_VIEW);
46
48
  });
47
49
  });
48
50
  });
@@ -1,5 +1,6 @@
1
1
  import {AclManagementSteps} from "../../../steps/setup/acl-management-steps";
2
- import {ACL} from "../../../steps/setup/acl-management-steps";
2
+ import {ACL_VIEW} from "../../../steps/setup/acl-management-steps";
3
+ import {ApplicationSteps} from "../../../steps/application-steps";
3
4
 
4
5
  describe('ACL Management: reorder rules', () => {
5
6
 
@@ -16,17 +17,18 @@ describe('ACL Management: reorder rules', () => {
16
17
  cy.initializeRepository(repositoryId);
17
18
  AclManagementSteps.importRules(repositoryId);
18
19
  AclManagementSteps.visit();
20
+ ApplicationSteps.geLoader().should('not.exist');
19
21
  // ensure rules are rendered
20
22
  AclManagementSteps.getAclRules().should('have.length.gt', 0);
21
23
  });
22
24
 
23
25
  it('Should move rule up', () => {
24
26
  AclManagementSteps.moveRuleUp(1);
25
- AclManagementSteps.checkRules([ACL[1], ACL[0], ACL[2], ACL[3], ACL[4]]);
27
+ AclManagementSteps.checkStatementRules([ACL_VIEW[1], ACL_VIEW[0], ACL_VIEW[2], ACL_VIEW[3], ACL_VIEW[4]]);
26
28
  });
27
29
 
28
30
  it('Should move rule down', () => {
29
31
  AclManagementSteps.moveRuleDown(1);
30
- AclManagementSteps.checkRules([ACL[0], ACL[2], ACL[1], ACL[3], ACL[4]]);
32
+ AclManagementSteps.checkStatementRules([ACL_VIEW[0], ACL_VIEW[2], ACL_VIEW[1], ACL_VIEW[3], ACL_VIEW[4]]);
31
33
  });
32
34
  });
@@ -1,4 +1,4 @@
1
- import {ACL, AclManagementSteps} from "../../../steps/setup/acl-management-steps";
1
+ import {ACL_VIEW, AclManagementSteps} from "../../../steps/setup/acl-management-steps";
2
2
  import {ApplicationSteps} from "../../../steps/application-steps";
3
3
  import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
4
4
 
@@ -18,13 +18,14 @@ describe('ACL Management: revert rules', () => {
18
18
  cy.enableAutocomplete(repositoryId);
19
19
  AclManagementSteps.importRules(repositoryId);
20
20
  AclManagementSteps.visit();
21
+ ApplicationSteps.geLoader().should('not.exist');
21
22
  // ensure rules are rendered
22
23
  AclManagementSteps.getAclRules().should('have.length.gt', 0);
23
24
  });
24
25
 
25
26
  it('Should be able to revert changes in the ACL', () => {
26
27
  // Given I have opened ACL management page
27
- AclManagementSteps.checkRules(ACL);
28
+ AclManagementSteps.checkStatementRules(ACL_VIEW);
28
29
  // When I add a new rule
29
30
  AclManagementSteps.addRule(1);
30
31
  AclManagementSteps.fillSubject(2, '<urn:John>');
@@ -52,7 +53,7 @@ describe('ACL Management: revert rules', () => {
52
53
  // Then I expect that all changes in the ACL should be reverted
53
54
  ApplicationSteps.getSuccessNotifications().should('be.visible');
54
55
  AclManagementSteps.getAclRules().should('have.length', 5);
55
- AclManagementSteps.checkRules(ACL);
56
+ AclManagementSteps.checkStatementRules(ACL_VIEW);
56
57
  // And the model should become pristine again after the revert
57
58
  // I should be able to navigate away from the page without any confirmation
58
59
  ApplicationSteps.openImportPage();
@@ -0,0 +1,220 @@
1
+ import {AclManagementSteps} from "../../../steps/setup/acl-management-steps";
2
+ import {ApplicationSteps} from "../../../steps/application-steps";
3
+
4
+ describe('ACL Management: rule scopes', () => {
5
+
6
+ let repositoryId;
7
+
8
+ afterEach(() => {
9
+ cy.deleteRepository(repositoryId);
10
+ });
11
+
12
+ beforeEach(() => {
13
+ repositoryId = 'acl-management-' + Date.now();
14
+ cy.createRepository({id: repositoryId});
15
+ cy.presetRepository(repositoryId);
16
+ cy.initializeRepository(repositoryId);
17
+ cy.enableAutocomplete(repositoryId);
18
+ AclManagementSteps.visit();
19
+ ApplicationSteps.geLoader().should('not.exist');
20
+ });
21
+
22
+
23
+ it('Should render empty tabs', () => {
24
+ // I expect 4 tabs
25
+ AclManagementSteps.getAclTabs().should('have.length', 4);
26
+ // I expect empty rules table
27
+ AclManagementSteps.getAclTable().should('be.visible');
28
+ AclManagementSteps.getAclTabs().should('be.visible');
29
+ AclManagementSteps.getNoDataMessage().should('be.visible');
30
+ AclManagementSteps.getActiveTab().should('have.text', 'Statement ');
31
+ // When I select Clear graph tab
32
+ AclManagementSteps.selectTab(1);
33
+ // I expect empty rules table
34
+ AclManagementSteps.getAclTabs().should('be.visible');
35
+ AclManagementSteps.getNoDataMessage().should('be.visible');
36
+ AclManagementSteps.getActiveTab().should('have.text', 'Clear graph ');
37
+ // When I select Plugins tab
38
+ AclManagementSteps.selectTab(2);
39
+ // I expect empty rules table
40
+ AclManagementSteps.getAclTabs().should('be.visible');
41
+ AclManagementSteps.getNoDataMessage().should('be.visible');
42
+ AclManagementSteps.getActiveTab().should('have.text', 'Plugin ');
43
+ // When I select System tab
44
+ AclManagementSteps.selectTab(3);
45
+ // I expect empty rules table
46
+ AclManagementSteps.getAclTabs().should('be.visible');
47
+ AclManagementSteps.getNoDataMessage().should('be.visible');
48
+ AclManagementSteps.getActiveTab().should('have.text', 'System ');
49
+ });
50
+
51
+ it('Should create rules', () => {
52
+ // I select Clear graph tab
53
+ AclManagementSteps.selectTab(1);
54
+ AclManagementSteps.getActiveTab().should('have.text', 'Clear graph ');
55
+ // I can create rule
56
+ AclManagementSteps.addRuleInBeginning();
57
+ // I fill the policy
58
+ AclManagementSteps.selectPolicy(0, 'deny');
59
+ // I fill in the role field
60
+ AclManagementSteps.fillRole(0, 'ROLE1');
61
+ // I fill in the context field
62
+ AclManagementSteps.fillContext(0, '*');
63
+ // I save the rule
64
+ AclManagementSteps.saveRule(0);
65
+ // Then the tab label is changed
66
+ AclManagementSteps.getActiveTab().should('contain', '*');
67
+
68
+ // I select Plugin tab
69
+ AclManagementSteps.selectTab(2);
70
+ AclManagementSteps.getActiveTab().should('have.text', 'Plugin ');
71
+ // I can create rule
72
+ AclManagementSteps.addRuleInBeginning();
73
+ // I fill the policy
74
+ AclManagementSteps.selectPolicy(0, 'deny');
75
+ // I fill in the role field
76
+ AclManagementSteps.fillRole(0, 'ROLE2');
77
+ // I select the operation
78
+ AclManagementSteps.selectOperation(0, 'write');
79
+ // I fill in the plugin field
80
+ AclManagementSteps.fillPlugin(0, '*');
81
+ // I save the rule
82
+ AclManagementSteps.saveRule(0);
83
+ // Then the tab label is changed
84
+ AclManagementSteps.getActiveTab().should('contain', '*');
85
+
86
+ // I select System tab
87
+ AclManagementSteps.selectTab(3);
88
+ AclManagementSteps.getActiveTab().should('have.text', 'System ');
89
+ // I can create rule
90
+ AclManagementSteps.addRuleInBeginning();
91
+ // I fill the policy
92
+ AclManagementSteps.selectPolicy(0, 'allow');
93
+ // I fill in the role field
94
+ AclManagementSteps.fillRole(0, 'ROLE3');
95
+ // I select the operation
96
+ AclManagementSteps.selectOperation(0, 'write');
97
+ // I save the rule
98
+ AclManagementSteps.saveRule(0);
99
+ // Then the tab label is changed
100
+ AclManagementSteps.getActiveTab().should('contain', '*');
101
+
102
+ // I select Statement tab
103
+ AclManagementSteps.selectTab(0);
104
+ AclManagementSteps.getActiveTab().should('have.text', 'Statement ');
105
+ // I can create rule
106
+ AclManagementSteps.addRuleInBeginning();
107
+ // I fill the policy
108
+ AclManagementSteps.selectPolicy(0, 'deny');
109
+ // I fill in the role field
110
+ AclManagementSteps.fillRole(0, 'ROLE4');
111
+ // I select the operation
112
+ AclManagementSteps.selectOperation(0, 'write');
113
+ // I fill in the subject field
114
+ AclManagementSteps.fillSubject(0, '*');
115
+ // I fill in the predicate field
116
+ AclManagementSteps.fillPredicate(0, '*');
117
+ // I fill in the object field
118
+ AclManagementSteps.fillObject(0, '*');
119
+ // I fill in the context field
120
+ AclManagementSteps.fillContext(0, '*');
121
+ // I save the rule
122
+ AclManagementSteps.saveRule(0);
123
+ // Then the tab label is changed
124
+ AclManagementSteps.getActiveTab().should('contain', '*');
125
+
126
+ cy.intercept('PUT', '/rest/repositories/acl-management-*/acl').as('putCall');
127
+
128
+ // And I save the ACL
129
+ AclManagementSteps.saveAcl();
130
+ // Then wait for the PUT call to occur and assert the request body
131
+ cy.wait('@putCall').then((interception) => {
132
+ const expectedPayload = [
133
+ {
134
+ "scope": "clear_graph",
135
+ "policy": "deny",
136
+ "role": "CUSTOM_ROLE1",
137
+ "context": "*"
138
+ },
139
+ {
140
+ "scope": "plugin",
141
+ "policy": "deny",
142
+ "role": "CUSTOM_ROLE2",
143
+ "operation": "write",
144
+ "plugin": "*"
145
+ },
146
+ {
147
+ "scope": "system",
148
+ "policy": "allow",
149
+ "role": "CUSTOM_ROLE3",
150
+ "operation": "write"
151
+ },
152
+ {
153
+ "scope": "statement",
154
+ "policy": "deny",
155
+ "role": "CUSTOM_ROLE4",
156
+ "operation": "write",
157
+ "subject": "*",
158
+ "predicate": "*",
159
+ "object": "*",
160
+ "context": "*"
161
+ }
162
+ ];
163
+ expect(interception.request.body).to.deep.eq(expectedPayload);
164
+ });
165
+
166
+ ApplicationSteps.geLoader().should('not.exist');
167
+ // Then I expect the ACL to be saved
168
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
169
+
170
+ // I expect to be on Statement tab
171
+ AclManagementSteps.getActiveTab().should('have.text', 'Statement ');
172
+ // I expect to have one statement rule
173
+ AclManagementSteps.getAclRules().should('have.length', 1);
174
+ const expectedStatementRule = {
175
+ "scope": "statement",
176
+ "policy": "deny",
177
+ "role": "ROLE4",
178
+ "operation": "write",
179
+ "subject": "*",
180
+ "predicate": "*",
181
+ "object": "*",
182
+ "context": "*"
183
+ };
184
+ AclManagementSteps.checkStatementRules([expectedStatementRule]);
185
+
186
+ // I visit Clear graph tab
187
+ AclManagementSteps.selectTab(1);
188
+ AclManagementSteps.getActiveTab().should('have.text', 'Clear graph ');
189
+ const expectedClearGraphRule = {
190
+ "scope": "clear_graph",
191
+ "policy": "deny",
192
+ "role": "ROLE1",
193
+ "context": "*"
194
+ };
195
+ AclManagementSteps.checkClearGraphRules([expectedClearGraphRule]);
196
+
197
+ // I visit Plugin tab
198
+ AclManagementSteps.selectTab(2);
199
+ AclManagementSteps.getActiveTab().should('have.text', 'Plugin ');
200
+ const expectedPluginRule = {
201
+ "scope": "plugin",
202
+ "policy": "deny",
203
+ "role": "ROLE2",
204
+ "operation": "write",
205
+ "plugin": "*"
206
+ };
207
+ AclManagementSteps.checkPluginRules([expectedPluginRule]);
208
+
209
+ // I visit System tab
210
+ AclManagementSteps.selectTab(3);
211
+ AclManagementSteps.getActiveTab().should('have.text', 'System ');
212
+ const expectedSystemRule = {
213
+ "scope": "system",
214
+ "policy": "allow",
215
+ "role": "ROLE3",
216
+ "operation": "write"
217
+ };
218
+ AclManagementSteps.checkSystemRules([expectedSystemRule]);
219
+ });
220
+ });
@@ -1,4 +1,4 @@
1
- import {ACL, AclManagementSteps} from "../../../steps/setup/acl-management-steps";
1
+ import {ACL_VIEW, AclManagementSteps} from "../../../steps/setup/acl-management-steps";
2
2
  import {ApplicationSteps} from "../../../steps/application-steps";
3
3
  import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
4
4
 
@@ -18,21 +18,23 @@ describe('ACL Management: update rules', () => {
18
18
  cy.enableAutocomplete(repositoryId);
19
19
  AclManagementSteps.importRules(repositoryId);
20
20
  AclManagementSteps.visit();
21
+ ApplicationSteps.geLoader().should('not.exist');
21
22
  // ensure rules are rendered
22
23
  AclManagementSteps.getAclRules().should('have.length.gt', 0);
23
24
  });
24
25
 
25
26
  it('Should be able to edit and save ACL', () => {
26
27
  // Given I have opened ACL management page
27
- AclManagementSteps.checkRules(ACL);
28
+ AclManagementSteps.checkStatementRules(ACL_VIEW);
28
29
  // When I add a new rule
29
30
  AclManagementSteps.addRule(1);
30
31
  AclManagementSteps.fillSubject(2, '<urn:John>');
31
32
  AclManagementSteps.fillPredicate(2, '*');
32
33
  AclManagementSteps.fillObject(2, '*');
33
34
  AclManagementSteps.fillContext(2, '*');
34
- AclManagementSteps.fillRole(2, 'CUSTOM_ROLE1');
35
+ AclManagementSteps.fillRole(2, 'ROLE1');
35
36
  AclManagementSteps.selectPolicy(2, 'deny');
37
+ AclManagementSteps.selectOperation(2, 'write');
36
38
  AclManagementSteps.saveRule(2);
37
39
  // And I edit an existing rule
38
40
  AclManagementSteps.editRule(1);
@@ -40,38 +42,44 @@ describe('ACL Management: update rules', () => {
40
42
  AclManagementSteps.fillPredicate(1, '*');
41
43
  AclManagementSteps.fillObject(1, '*');
42
44
  AclManagementSteps.fillContext(1, '*');
43
- AclManagementSteps.fillRole(1, 'CUSTOM_TEST');
45
+ AclManagementSteps.fillRole(1, 'TEST');
44
46
  AclManagementSteps.selectPolicy(1, 'allow');
47
+ AclManagementSteps.selectOperation(1, 'write');
45
48
  AclManagementSteps.saveRule(1);
46
49
  // And I delete an existing rule
47
50
  AclManagementSteps.deleteRule(5);
48
51
  ModalDialogSteps.clickOnConfirmButton();
49
52
  // And I save the ACL list
50
53
  AclManagementSteps.saveAcl();
54
+ ApplicationSteps.geLoader().should('not.exist');
51
55
  // Then I expect the ACL to be saved
52
56
  ApplicationSteps.getSuccessNotifications().should('be.visible');
53
57
  AclManagementSteps.getAclRules().should('have.length', 5);
54
58
  const editedRule = {
59
+ "scope": "statement",
60
+ "policy": "deny",
61
+ "role": "ROLE1",
62
+ "operation": "write",
55
63
  "subject": "<urn:John>",
56
64
  "predicate": "*",
57
65
  "object": "*",
58
66
  "context": "*",
59
- "role": "CUSTOM_ROLE1",
60
- "policy": "deny",
61
67
  "moveUp": true,
62
68
  "moveDown": true
63
69
  };
64
70
  const newRule = {
71
+ "scope": "statement",
72
+ "policy": "allow",
73
+ "role": "TEST",
74
+ "operation": "write",
65
75
  "subject": "<urn:Me>",
66
76
  "predicate": "*",
67
77
  "object": "*",
68
78
  "context": "*",
69
- "role": "CUSTOM_TEST",
70
- "policy": "allow",
71
79
  "moveUp": true,
72
80
  "moveDown": true
73
81
  };
74
- AclManagementSteps.checkRules([ACL[0], newRule, editedRule, ACL[2], ACL[3]]);
82
+ AclManagementSteps.checkStatementRules([ACL_VIEW[0], newRule, editedRule, ACL_VIEW[2], ACL_VIEW[3]]);
75
83
  });
76
84
 
77
85
  it('Should prevent leaving the page when there is new rule added', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.6.0-TR5",
3
+ "version": "2.6.0-TR6",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "start": "cypress open",
@@ -25,4 +25,8 @@ export class ApplicationSteps {
25
25
  static openImportPage() {
26
26
  cy.get('.main-menu .menu-element-root[href=import]').click();
27
27
  }
28
+
29
+ static geLoader() {
30
+ return cy.get('.ot-loader-new-content');
31
+ }
28
32
  }
@@ -57,6 +57,18 @@ export class AclManagementSteps {
57
57
  return this.getAclTable().find('.no-data');
58
58
  }
59
59
 
60
+ static getAclTabs() {
61
+ return cy.get('.nav-tabs.acl-tabs .nav-item');
62
+ }
63
+
64
+ static getActiveTab() {
65
+ return this.getAclTabs().find('.active');
66
+ }
67
+
68
+ static selectTab(index) {
69
+ return this.getAclTabs().eq(index).click();
70
+ }
71
+
60
72
  static addRuleInBeginning() {
61
73
  this.getAddFirstRuleButton().click();
62
74
  }
@@ -106,7 +118,7 @@ export class AclManagementSteps {
106
118
  }
107
119
 
108
120
  static getSubjectField(index) {
109
- return this.getRule(index).find('.subject-cell input');
121
+ return this.getRule(index).find('.subject-cell textarea');
110
122
  }
111
123
 
112
124
  static fillSubject(index, value) {
@@ -114,7 +126,7 @@ export class AclManagementSteps {
114
126
  }
115
127
 
116
128
  static getPredicateField(index) {
117
- return this.getRule(index).find('.predicate-cell input');
129
+ return this.getRule(index).find('.predicate-cell textarea');
118
130
  }
119
131
 
120
132
  static fillPredicate(index, value) {
@@ -122,7 +134,7 @@ export class AclManagementSteps {
122
134
  }
123
135
 
124
136
  static getObjectField(index) {
125
- return this.getRule(index).find('.object-cell input');
137
+ return this.getRule(index).find('.object-cell textarea');
126
138
  }
127
139
 
128
140
  static fillObject(index, value) {
@@ -130,7 +142,7 @@ export class AclManagementSteps {
130
142
  }
131
143
 
132
144
  static getContextField(index) {
133
- return this.getRule(index).find('.context-cell input');
145
+ return this.getRule(index).find('.context-cell textarea');
134
146
  }
135
147
 
136
148
  static fillContext(index, value) {
@@ -145,6 +157,14 @@ export class AclManagementSteps {
145
157
  this.getRoleField(index).clear().type(value);
146
158
  }
147
159
 
160
+ static getPluginField(index) {
161
+ return this.getRule(index).find('.plugin-cell textarea');
162
+ }
163
+
164
+ static fillPlugin(index, value) {
165
+ this.getPluginField(index).clear().type(value);
166
+ }
167
+
148
168
  static getPolicySelectorField(index) {
149
169
  return this.getRule(index).find('.policy-cell select');
150
170
  }
@@ -153,6 +173,14 @@ export class AclManagementSteps {
153
173
  this.getPolicySelectorField(index).select(value);
154
174
  }
155
175
 
176
+ static getOperationSelectorField(index) {
177
+ return this.getRule(index).find('.operation-cell select');
178
+ }
179
+
180
+ static selectOperation(index, value) {
181
+ this.getOperationSelectorField(index).select(value);
182
+ }
183
+
156
184
  static getMoveUpButtons() {
157
185
  return this.getAclTable().find('.move-up-btn');
158
186
  }
@@ -189,7 +217,29 @@ export class AclManagementSteps {
189
217
  this.getCancelAclSavingButton().click();
190
218
  }
191
219
 
192
- static checkRules(rules = []) {
220
+ static checkStatementRules(rules = []) {
221
+ rules.forEach((rule, index) => {
222
+ AclManagementSteps.getRule(index).within(() => {
223
+ cy.get('td:nth-child(1)').should('contain.text', index);
224
+ const moveUpVisibilityCommand = index > 0 ? 'be.visible' : 'not.exist';
225
+ cy.get('td:nth-child(2)').scrollIntoView().find('.move-up-btn').should(moveUpVisibilityCommand);
226
+ const moveDownVisibilityCommand = index < rules.length - 1 ? 'be.visible' : 'not.exist';
227
+ cy.get('td:nth-child(2)').scrollIntoView().find('.move-down-btn').should(moveDownVisibilityCommand);
228
+ cy.get('td:nth-child(3)').should('contain.text', rule.policy);
229
+ cy.get('td:nth-child(4)').should('contain.text', rule.role);
230
+ cy.get('td:nth-child(5)').should('contain.text', rule.operation);
231
+ cy.get('td:nth-child(6)').should('contain.text', rule.subject);
232
+ cy.get('td:nth-child(7)').should('contain.text', rule.predicate);
233
+ cy.get('td:nth-child(8)').should('contain.text', rule.object);
234
+ cy.get('td:nth-child(9)').should('contain.text', rule.context);
235
+ cy.get('td:nth-child(10)').scrollIntoView().find('.delete-rule-btn').should('be.visible');
236
+ cy.get('td:nth-child(10)').scrollIntoView().find('.edit-rule-btn').should('be.visible');
237
+ cy.get('td:nth-child(10)').scrollIntoView().find('.add-rule-btn').should('be.visible');
238
+ });
239
+ });
240
+ }
241
+
242
+ static checkClearGraphRules(rules = []) {
193
243
  rules.forEach((rule, index) => {
194
244
  AclManagementSteps.getRule(index).within(() => {
195
245
  cy.get('td:nth-child(1)').should('contain.text', index);
@@ -197,15 +247,49 @@ export class AclManagementSteps {
197
247
  cy.get('td:nth-child(2)').scrollIntoView().find('.move-up-btn').should(moveUpVisibilityCommand);
198
248
  const moveDownVisibilityCommand = index < rules.length - 1 ? 'be.visible' : 'not.exist';
199
249
  cy.get('td:nth-child(2)').scrollIntoView().find('.move-down-btn').should(moveDownVisibilityCommand);
200
- cy.get('td:nth-child(3)').should('contain.text', rule.subject);
201
- cy.get('td:nth-child(4)').should('contain.text', rule.predicate);
202
- cy.get('td:nth-child(5)').should('contain.text', rule.object);
203
- cy.get('td:nth-child(6)').should('contain.text', rule.context);
204
- cy.get('td:nth-child(7)').should('contain.text', rule.role);
205
- cy.get('td:nth-child(8)').should('contain.text', rule.policy);
206
- cy.get('td:nth-child(9)').scrollIntoView().find('.delete-rule-btn').should('be.visible');
207
- cy.get('td:nth-child(9)').scrollIntoView().find('.edit-rule-btn').should('be.visible');
208
- cy.get('td:nth-child(9)').scrollIntoView().find('.add-rule-btn').should('be.visible');
250
+ cy.get('td:nth-child(3)').should('contain.text', rule.policy);
251
+ cy.get('td:nth-child(4)').should('contain.text', rule.role);
252
+ cy.get('td:nth-child(5)').should('contain.text', rule.context);
253
+ cy.get('td:nth-child(6)').scrollIntoView().find('.delete-rule-btn').should('be.visible');
254
+ cy.get('td:nth-child(6)').scrollIntoView().find('.edit-rule-btn').should('be.visible');
255
+ cy.get('td:nth-child(6)').scrollIntoView().find('.add-rule-btn').should('be.visible');
256
+ });
257
+ });
258
+ }
259
+
260
+ static checkPluginRules(rules = []) {
261
+ rules.forEach((rule, index) => {
262
+ AclManagementSteps.getRule(index).within(() => {
263
+ cy.get('td:nth-child(1)').should('contain.text', index);
264
+ const moveUpVisibilityCommand = index > 0 ? 'be.visible' : 'not.exist';
265
+ cy.get('td:nth-child(2)').scrollIntoView().find('.move-up-btn').should(moveUpVisibilityCommand);
266
+ const moveDownVisibilityCommand = index < rules.length - 1 ? 'be.visible' : 'not.exist';
267
+ cy.get('td:nth-child(2)').scrollIntoView().find('.move-down-btn').should(moveDownVisibilityCommand);
268
+ cy.get('td:nth-child(3)').should('contain.text', rule.policy);
269
+ cy.get('td:nth-child(4)').should('contain.text', rule.role);
270
+ cy.get('td:nth-child(5)').should('contain.text', rule.operation);
271
+ cy.get('td:nth-child(6)').should('contain.text', rule.plugin);
272
+ cy.get('td:nth-child(7)').scrollIntoView().find('.delete-rule-btn').should('be.visible');
273
+ cy.get('td:nth-child(7)').scrollIntoView().find('.edit-rule-btn').should('be.visible');
274
+ cy.get('td:nth-child(7)').scrollIntoView().find('.add-rule-btn').should('be.visible');
275
+ });
276
+ });
277
+ }
278
+
279
+ static checkSystemRules(rules = []) {
280
+ rules.forEach((rule, index) => {
281
+ AclManagementSteps.getRule(index).within(() => {
282
+ cy.get('td:nth-child(1)').should('contain.text', index);
283
+ const moveUpVisibilityCommand = index > 0 ? 'be.visible' : 'not.exist';
284
+ cy.get('td:nth-child(2)').scrollIntoView().find('.move-up-btn').should(moveUpVisibilityCommand);
285
+ const moveDownVisibilityCommand = index < rules.length - 1 ? 'be.visible' : 'not.exist';
286
+ cy.get('td:nth-child(2)').scrollIntoView().find('.move-down-btn').should(moveDownVisibilityCommand);
287
+ cy.get('td:nth-child(3)').should('contain.text', rule.policy);
288
+ cy.get('td:nth-child(4)').should('contain.text', rule.role);
289
+ cy.get('td:nth-child(5)').should('contain.text', rule.operation);
290
+ cy.get('td:nth-child(6)').scrollIntoView().find('.delete-rule-btn').should('be.visible');
291
+ cy.get('td:nth-child(6)').scrollIntoView().find('.edit-rule-btn').should('be.visible');
292
+ cy.get('td:nth-child(6)').scrollIntoView().find('.add-rule-btn').should('be.visible');
209
293
  });
210
294
  });
211
295
  }
@@ -230,45 +314,107 @@ export class AclManagementSteps {
230
314
  }
231
315
  }
232
316
 
233
- export const ACL = [
317
+ export const ACL_VIEW = [
234
318
  {
319
+ "scope": "statement",
320
+ "policy": "allow",
321
+ "role": "!ROLE2",
322
+ "operation": "write",
235
323
  "subject": "<urn:Mary>",
236
324
  "predicate": "*",
237
325
  "object": "*",
238
- "context": "*",
239
- "role": "!CUSTOM_ROLE2",
240
- "policy": "allow"
326
+ "context": "*"
241
327
  },
242
328
  {
329
+ "scope": "statement",
330
+ "policy": "deny",
331
+ "role": "ROLE1",
332
+ "operation": "read",
243
333
  "subject": "*",
244
334
  "predicate": "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>",
245
335
  "object": "*",
246
- "context": "*",
247
- "role": "CUSTOM_ROLE1",
248
- "policy": "deny"
336
+ "context": "*"
249
337
  },
250
338
  {
339
+ "scope": "statement",
340
+ "policy": "deny",
341
+ "role": "ROLE3",
342
+ "operation": "read",
251
343
  "subject": "<<<http://example.com/test> <http://www.w3.org/2000/01/rdf-schema#label> \"test aber auf Deutsch\"@de>>",
252
344
  "predicate": "*",
253
345
  "object": "\"test aber auf Deutsch\"@en",
254
- "context": "<http://example.com/graph1>",
255
- "role": "CUSTOM_ROLE3",
256
- "policy": "deny"
346
+ "context": "<http://example.com/graph1>"
257
347
  },
258
348
  {
349
+ "scope": "statement",
350
+ "policy": "allow",
351
+ "role": "ROLE3",
352
+ "operation": "write",
259
353
  "subject": "*",
260
354
  "predicate": "*",
261
355
  "object": "\"15\"^^<http://www.w3.org/2001/XMLSchema#int>",
262
- "context": "*",
263
- "role": "CUSTOM_ROLE3",
264
- "policy": "allow"
356
+ "context": "*"
265
357
  },
266
358
  {
359
+ "scope": "statement",
360
+ "policy": "deny",
361
+ "role": "ROLE4",
362
+ "operation": "write",
267
363
  "subject": "<urn:Cat>",
268
364
  "predicate": "*",
269
365
  "object": "<<<http://example.com/test> <http://www.w3.org/2000/01/rdf-schema#label> \"test aber auf Deutsch\"@de>>",
270
- "context": "*",
366
+ "context": "*"
367
+ }
368
+ ];
369
+ export const ACL = [
370
+ {
371
+ "scope": "statement",
372
+ "policy": "allow",
373
+ "role": "!CUSTOM_ROLE2",
374
+ "operation": "write",
375
+ "subject": "<urn:Mary>",
376
+ "predicate": "*",
377
+ "object": "*",
378
+ "context": "*"
379
+ },
380
+ {
381
+ "scope": "statement",
382
+ "policy": "deny",
383
+ "role": "CUSTOM_ROLE1",
384
+ "operation": "read",
385
+ "subject": "*",
386
+ "predicate": "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>",
387
+ "object": "*",
388
+ "context": "*"
389
+ },
390
+ {
391
+ "scope": "statement",
392
+ "policy": "deny",
393
+ "role": "CUSTOM_ROLE3",
394
+ "operation": "read",
395
+ "subject": "<<<http://example.com/test> <http://www.w3.org/2000/01/rdf-schema#label> \"test aber auf Deutsch\"@de>>",
396
+ "predicate": "*",
397
+ "object": "\"test aber auf Deutsch\"@en",
398
+ "context": "<http://example.com/graph1>"
399
+ },
400
+ {
401
+ "scope": "statement",
402
+ "policy": "allow",
403
+ "role": "CUSTOM_ROLE3",
404
+ "operation": "write",
405
+ "subject": "*",
406
+ "predicate": "*",
407
+ "object": "\"15\"^^<http://www.w3.org/2001/XMLSchema#int>",
408
+ "context": "*"
409
+ },
410
+ {
411
+ "scope": "statement",
412
+ "policy": "deny",
271
413
  "role": "CUSTOM_ROLE4",
272
- "policy": "deny"
414
+ "operation": "write",
415
+ "subject": "<urn:Cat>",
416
+ "predicate": "*",
417
+ "object": "<<<http://example.com/test> <http://www.w3.org/2000/01/rdf-schema#label> \"test aber auf Deutsch\"@de>>",
418
+ "context": "*"
273
419
  }
274
420
  ];
@@ -71,12 +71,12 @@ Cypress.Commands.add('getNamespaces', (id) => {
71
71
  });
72
72
  });
73
73
 
74
- let toggleAutocomplete = (repositoryId, enable) => {
74
+ const toggleAutocomplete = (repositoryId, enable) => {
75
75
  cy.request({
76
76
  method: 'POST',
77
77
  url: `${AUTOCOMPLETE_URL}enabled?enabled=${enable}`,
78
78
  headers: {
79
- 'X-GraphDB-Repository': repositoryId,
79
+ 'X-GraphDB-Repository': repositoryId
80
80
  }
81
81
  }).then((response) => {
82
82
  cy.waitUntil(() => response && response.body === `Autocomplete was ${enable ? 'enabled' : 'disabled'}`);
@@ -84,13 +84,13 @@ let toggleAutocomplete = (repositoryId, enable) => {
84
84
  waitAutocomplete(repositoryId);
85
85
  };
86
86
 
87
- let waitAutocomplete = function (repositoryId) {
87
+ const waitAutocomplete = function (repositoryId) {
88
88
  cy.waitUntil(() =>
89
89
  cy.request({
90
90
  method: 'GET',
91
91
  url: AUTOCOMPLETE_URL + 'status',
92
92
  headers: {
93
93
  'X-GraphDB-Repository': repositoryId
94
- },
95
- }).then(response => response.status === 200 && (response.body === 'READY' || response.body === 'NONE')));
94
+ }
95
+ }).then((response) => response.status === 200 && (response.body === 'READY' || response.body === 'NONE')));
96
96
  };