graphdb-workbench-tests 2.5.1 → 2.6.0-RC2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/fixtures/graphdb-import/resource-test-data.ttl +99 -0
  2. package/fixtures/graphql-editor/default-query-response.json +517 -0
  3. package/fixtures/guides/guides.json +764 -0
  4. package/fixtures/guides/movies.ttl +629 -0
  5. package/fixtures/guides/starwars.ttl +4384 -0
  6. package/fixtures/locale-en.json +53 -12
  7. package/fixtures/namespaces/ontotext-generated-namespace.json +22 -0
  8. package/fixtures/queries/empty-query-response.json +11 -0
  9. package/integration/cluster/cluster-management.spec.js +1 -2
  10. package/integration/explore/graphs.overview.spec.js +4 -2
  11. package/integration/explore/similariti-index-create.spec.js +333 -0
  12. package/integration/explore/similarity-index.spec.js +88 -0
  13. package/integration/explore/similarity.spec.js +180 -56
  14. package/integration/explore/visual-graph/graphs-config.spec.js +453 -0
  15. package/integration/explore/{visual.graph.spec.js → visual-graph/visual.graph.spec.js} +146 -347
  16. package/integration/guides/movies-interactive-guide.spec.js +73 -0
  17. package/integration/guides/star-wars-interactive-guide.js +60 -0
  18. package/integration/home/language-change.spec.js +3 -3
  19. package/integration/import/import.user.data.spec.js +2 -0
  20. package/integration/resource/resource.spec.js +357 -0
  21. package/integration/setup/aclmanagement/create-rule.spec.js +88 -11
  22. package/integration/setup/aclmanagement/delete-rule.spec.js +6 -4
  23. package/integration/setup/aclmanagement/edit-rule.spec.js +13 -8
  24. package/integration/setup/aclmanagement/render-rules.spec.js +4 -2
  25. package/integration/setup/aclmanagement/reorder-rules.spec.js +5 -3
  26. package/integration/setup/aclmanagement/revert-rules.spec.js +4 -3
  27. package/integration/setup/aclmanagement/scopes.spec.js +228 -0
  28. package/integration/setup/aclmanagement/update-rules.spec.js +17 -9
  29. package/integration/setup/jdbc-create.spec.js +330 -0
  30. package/integration/setup/jdbc.spec.js +78 -154
  31. package/integration/setup/my-settings.spec.js +9 -41
  32. package/integration/setup/sparql-template-create.js +150 -0
  33. package/integration/setup/sparql-templates.spec.js +82 -146
  34. package/integration/sparql-editor/actions/execute-query.spec.js +44 -0
  35. package/integration/sparql-editor/actions/expand-results-over-sameas.spec.js +136 -0
  36. package/integration/sparql-editor/actions/include-inferred-statements.spec.js +100 -0
  37. package/integration/sparql-editor/actions/inferred-sameas.spec.js +47 -0
  38. package/integration/sparql-editor/actions/save-query.spec.js +70 -0
  39. package/integration/sparql-editor/actions/show-saved-queries.spec.js +61 -0
  40. package/integration/sparql-editor/internationalization.spec.js +41 -0
  41. package/integration/sparql-editor/saved-query/abort-query.spec.js +51 -0
  42. package/integration/sparql-editor/saved-query/delete-query.spec.js +56 -0
  43. package/integration/sparql-editor/saved-query/edit-query.spec.js +68 -0
  44. package/integration/sparql-editor/saved-query/share-query.spec.js +78 -0
  45. package/integration/sparql-editor/sparql-editor.spec.js +55 -0
  46. package/integration/sparql-editor/yasgui-tabs.spec.js +107 -0
  47. package/integration/sparql-editor/yasr/download-as.spec.js +54 -0
  48. package/integration/sparql-editor/yasr/pagination.spec.js +234 -0
  49. package/integration/sparql-editor/yasr/table-plugin.spec.js +39 -0
  50. package/integration/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +57 -0
  51. package/integration-flaky/explore/visual.graph.spec.js +3 -2
  52. package/integration-flaky/setup/sparql-template-create.js +139 -0
  53. package/integration-flaky/sparql-editor/actions/execute-update-query.spec.js +89 -0
  54. package/integration-flaky/sparql-editor/actions/share-query.spec.js +84 -0
  55. package/integration-flaky/sparql-editor/lucene-connector.spec.js +62 -0
  56. package/integration-flaky/sparql-editor/plugins/error-plugin.spec.js +83 -0
  57. package/integration-flaky/sparql-editor/yasr/table-plugin.spec.js +81 -0
  58. package/package.json +3 -1
  59. package/steps/application-steps.js +5 -0
  60. package/steps/autocomplete-steps.js +10 -0
  61. package/steps/error-steps.js +9 -0
  62. package/steps/explore/graphs-overview-steps.js +24 -0
  63. package/steps/explore/similarity-index-create-steps.js +113 -0
  64. package/steps/explore/similarity-indexes-steps.js +18 -0
  65. package/steps/guides/guide-dialog-steps.js +38 -0
  66. package/steps/guides/guide-steps.js +278 -0
  67. package/steps/guides/movies-guide-steps.js +241 -0
  68. package/steps/guides/star-wars-guide-steps.js +188 -0
  69. package/steps/import-steps.js +16 -0
  70. package/steps/language-selector-steps.js +22 -0
  71. package/steps/loader-steps.js +10 -0
  72. package/steps/lucene-connector-steps.js +43 -0
  73. package/steps/main-menu-steps.js +67 -0
  74. package/steps/repository-selector-steps.js +26 -0
  75. package/steps/repository-steps.js +4 -0
  76. package/steps/resource/resource-edit-steps.js +111 -0
  77. package/steps/resource/resource-steps.js +149 -0
  78. package/steps/setup/acl-management-steps.js +201 -39
  79. package/steps/setup/jdbc-create-steps.js +97 -0
  80. package/steps/setup/jdbc-steps.js +42 -0
  81. package/steps/setup/sparql-create-update-steps.js +55 -0
  82. package/steps/setup/sparql-templates-steps.js +38 -0
  83. package/steps/sparql-editor-steps.js +20 -0
  84. package/steps/sparql-steps.js +0 -6
  85. package/steps/visual-graph-steps.js +365 -6
  86. package/steps/yasgui/confirmation-dialog-steps.js +13 -0
  87. package/steps/yasgui/pagination-steps.js +47 -0
  88. package/steps/yasgui/plugin/error-plugin-steps.js +30 -0
  89. package/steps/yasgui/save-query-dialog.js +61 -0
  90. package/steps/yasgui/saved-queries-dialog.js +29 -0
  91. package/steps/yasgui/saved-query.js +25 -0
  92. package/steps/yasgui/share-saved-query-dialog.js +25 -0
  93. package/steps/yasgui/table-plugin-steps.js +29 -0
  94. package/steps/yasgui/yasgui-loader.js +10 -0
  95. package/steps/yasgui/yasgui-steps.js +191 -0
  96. package/steps/yasgui/yasqe-steps.js +187 -0
  97. package/steps/yasgui/yasr-steps.js +108 -0
  98. package/stubs/namespace-stubs.js +10 -0
  99. package/stubs/repositories-stub.js +58 -0
  100. package/stubs/security-stubs.js +69 -0
  101. package/stubs/yasgui/connectors-stubs.js +12 -0
  102. package/stubs/yasgui/query-stubs.js +253 -0
  103. package/support/index.js +3 -0
  104. package/support/repository-commands.js +5 -5
  105. package/support/sparql-commands.js +1 -1
  106. package/support/visual-graph-commands.js +25 -0
  107. package/integration/sparql/main.menu.spec.js +0 -232
  108. package/integration/sparql/sparql-error-handling.spec.js +0 -74
  109. package/integration/sparql/sparql-language-change.spec.js +0 -58
  110. package/integration/sparql/sparql-result-formating.spec.js +0 -84
  111. package/integration/sparql/sparql.menu.spec.js +0 -1253
  112. package/integration-flaky/setup/sparql-templates.spec.js +0 -125
  113. package/integration-flaky/sparql/sparql-language-change.spec.js +0 -45
  114. package/integration-flaky/sparql/sparql.menu.spec.js +0 -75
@@ -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', () => {
@@ -96,7 +172,7 @@ describe('ACL Management: create rule', () => {
96
172
  AclManagementSteps.getMoveDownButtons().should('have.length', 4);
97
173
  AclManagementSteps.deleteRuleButtons().should('have.length', 5);
98
174
  AclManagementSteps.editRuleButtons().should('have.length', 5);
99
- AclManagementSteps.createRuleButtons().should('have.length', 6);
175
+ AclManagementSteps.createRuleButtons().should('have.length', 5);
100
176
  // When a rule is in edit mode
101
177
  AclManagementSteps.addRule(1);
102
178
  // Then I expect that move up, move down, edit rule, create rule, delete rule buttons to be hidden
@@ -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
  });
@@ -28,7 +30,7 @@ describe('ACL Management: delete rule', () => {
28
30
  AclManagementSteps.deleteRule(0);
29
31
  // Then I expect a confirmation dialog
30
32
  ModalDialogSteps.getDialog().should('be.visible');
31
- ModalDialogSteps.getDialogBody().should('contain', 'Are you sure you want to delete the selected rule #0?');
33
+ ModalDialogSteps.getDialogBody().should('contain', 'Are you sure you want to delete the selected rule #1?');
32
34
  // When I cancel operation
33
35
  ModalDialogSteps.clickOnCancelButton();
34
36
  // Then I expect the rule to remain in the list
@@ -36,11 +38,11 @@ describe('ACL Management: delete rule', () => {
36
38
  AclManagementSteps.getAclRules().should('have.length', 5);
37
39
  // When I try remove it again and confirm the operation
38
40
  AclManagementSteps.deleteRule(4);
39
- ModalDialogSteps.getDialogBody().should('contain', 'Are you sure you want to delete the selected rule #4?');
41
+ ModalDialogSteps.getDialogBody().should('contain', 'Are you sure you want to delete the selected rule #5?');
40
42
  ModalDialogSteps.clickOnConfirmButton();
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
  });
@@ -28,7 +30,7 @@ describe('ACL Management: edit rule', () => {
28
30
  AclManagementSteps.getMoveDownButtons().should('have.length', 4);
29
31
  AclManagementSteps.deleteRuleButtons().should('have.length', 5);
30
32
  AclManagementSteps.editRuleButtons().should('have.length', 5);
31
- AclManagementSteps.createRuleButtons().should('have.length', 6);
33
+ AclManagementSteps.createRuleButtons().should('have.length', 5);
32
34
  // When a rule is in edit mode
33
35
  AclManagementSteps.editRule(1);
34
36
  // Then I expect that move up, move down, edit rule, create rule, delete rule buttons to be hidden
@@ -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,228 @@
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
+ AclManagementSteps.getActiveTabDirtyIcon().should('not.exist');
56
+ // I can create rule
57
+ AclManagementSteps.addRuleInBeginning();
58
+ // I fill the policy
59
+ AclManagementSteps.selectPolicy(0, 'deny');
60
+ // I fill in the role field
61
+ AclManagementSteps.fillRole(0, 'ROLE1');
62
+ // I fill in the context field
63
+ AclManagementSteps.fillContext(0, 'all');
64
+ // I save the rule
65
+ AclManagementSteps.saveRule(0);
66
+ // Then the tab label is changed
67
+ AclManagementSteps.getActiveTabDirtyIcon().should('be.visible');
68
+
69
+ // I select Plugin tab
70
+ AclManagementSteps.selectTab(2);
71
+ AclManagementSteps.getActiveTab().should('have.text', 'Plugin');
72
+ AclManagementSteps.getActiveTabDirtyIcon().should('not.exist');
73
+ // I can create rule
74
+ AclManagementSteps.addRuleInBeginning();
75
+ // I fill the policy
76
+ AclManagementSteps.selectPolicy(0, 'deny');
77
+ // I fill in the role field
78
+ AclManagementSteps.fillRole(0, 'ROLE2');
79
+ // I select the operation
80
+ AclManagementSteps.selectOperation(0, 'write');
81
+ // I fill in the plugin field
82
+ AclManagementSteps.fillPlugin(0, '*');
83
+ // I save the rule
84
+ AclManagementSteps.saveRule(0);
85
+ // Then the tab label is changed
86
+ AclManagementSteps.getActiveTabDirtyIcon().should('be.visible');
87
+
88
+ // I select System tab
89
+ AclManagementSteps.selectTab(3);
90
+ AclManagementSteps.getActiveTab().should('have.text', 'System');
91
+ AclManagementSteps.getActiveTabDirtyIcon().should('not.exist');
92
+ // I can create rule
93
+ AclManagementSteps.addRuleInBeginning();
94
+ // I fill the policy
95
+ AclManagementSteps.selectPolicy(0, 'allow');
96
+ // I fill in the role field
97
+ AclManagementSteps.fillRole(0, 'ROLE3');
98
+ // I select the operation
99
+ AclManagementSteps.selectOperation(0, 'write');
100
+ // I save the rule
101
+ AclManagementSteps.saveRule(0);
102
+ // Then the tab label is changed
103
+ AclManagementSteps.getActiveTabDirtyIcon().should('be.visible');
104
+
105
+ // I select Statement tab
106
+ AclManagementSteps.selectTab(0);
107
+ AclManagementSteps.getActiveTab().should('have.text', 'Statement');
108
+ AclManagementSteps.getActiveTabDirtyIcon().should('not.exist');
109
+ // I can create rule
110
+ AclManagementSteps.addRuleInBeginning();
111
+ // I fill the policy
112
+ AclManagementSteps.selectPolicy(0, 'deny');
113
+ // I fill in the role field
114
+ AclManagementSteps.fillRole(0, 'ROLE4');
115
+ // I select the operation
116
+ AclManagementSteps.selectOperation(0, 'write');
117
+ // I fill in the subject field
118
+ AclManagementSteps.fillSubject(0, '*');
119
+ // I fill in the predicate field
120
+ AclManagementSteps.fillPredicate(0, '*');
121
+ // I fill in the object field
122
+ AclManagementSteps.fillObject(0, '*');
123
+ // I fill in the context field
124
+ AclManagementSteps.fillContext(0, '*');
125
+ // I save the rule
126
+ AclManagementSteps.saveRule(0);
127
+ // Then the tab label is changed
128
+ AclManagementSteps.getActiveTabDirtyIcon().should('be.visible');
129
+
130
+ cy.intercept('PUT', '/rest/repositories/acl-management-*/acl').as('putCall');
131
+
132
+ // And I save the ACL
133
+ AclManagementSteps.saveAcl();
134
+ // Then wait for the PUT call to occur and assert the request body
135
+ cy.wait('@putCall').then((interception) => {
136
+ const expectedPayload = [
137
+ {
138
+ "scope": "clear_graph",
139
+ "policy": "deny",
140
+ "role": "CUSTOM_ROLE1",
141
+ "context": "all"
142
+ },
143
+ {
144
+ "scope": "plugin",
145
+ "policy": "deny",
146
+ "role": "CUSTOM_ROLE2",
147
+ "operation": "write",
148
+ "plugin": "*"
149
+ },
150
+ {
151
+ "scope": "system",
152
+ "policy": "allow",
153
+ "role": "CUSTOM_ROLE3",
154
+ "operation": "write"
155
+ },
156
+ {
157
+ "scope": "statement",
158
+ "policy": "deny",
159
+ "role": "CUSTOM_ROLE4",
160
+ "operation": "write",
161
+ "subject": "*",
162
+ "predicate": "*",
163
+ "object": "*",
164
+ "context": "*"
165
+ }
166
+ ];
167
+ expect(interception.request.body).to.deep.eq(expectedPayload);
168
+ });
169
+
170
+ ApplicationSteps.geLoader().should('not.exist');
171
+ // Then I expect the ACL to be saved
172
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
173
+
174
+ // I expect to be on Statement tab
175
+ AclManagementSteps.getActiveTab().should('have.text', 'Statement');
176
+ AclManagementSteps.getActiveTabDirtyIcon().should('not.exist');
177
+ // I expect to have one statement rule
178
+ AclManagementSteps.getAclRules().should('have.length', 1);
179
+ const expectedStatementRule = {
180
+ "scope": "statement",
181
+ "policy": "deny",
182
+ "role": "ROLE4",
183
+ "operation": "write",
184
+ "subject": "*",
185
+ "predicate": "*",
186
+ "object": "*",
187
+ "context": "*"
188
+ };
189
+ AclManagementSteps.checkStatementRules([expectedStatementRule]);
190
+
191
+ // I visit Clear graph tab
192
+ AclManagementSteps.selectTab(1);
193
+ AclManagementSteps.getActiveTab().should('have.text', 'Clear graph');
194
+ AclManagementSteps.getActiveTabDirtyIcon().should('not.exist');
195
+ const expectedClearGraphRule = {
196
+ "scope": "clear_graph",
197
+ "policy": "deny",
198
+ "role": "ROLE1",
199
+ "context": "all"
200
+ };
201
+ AclManagementSteps.checkClearGraphRules([expectedClearGraphRule]);
202
+
203
+ // I visit Plugin tab
204
+ AclManagementSteps.selectTab(2);
205
+ AclManagementSteps.getActiveTab().should('have.text', 'Plugin');
206
+ AclManagementSteps.getActiveTabDirtyIcon().should('not.exist');
207
+ const expectedPluginRule = {
208
+ "scope": "plugin",
209
+ "policy": "deny",
210
+ "role": "ROLE2",
211
+ "operation": "write",
212
+ "plugin": "*"
213
+ };
214
+ AclManagementSteps.checkPluginRules([expectedPluginRule]);
215
+
216
+ // I visit System tab
217
+ AclManagementSteps.selectTab(3);
218
+ AclManagementSteps.getActiveTab().should('have.text', 'System');
219
+ AclManagementSteps.getActiveTabDirtyIcon().should('not.exist');
220
+ const expectedSystemRule = {
221
+ "scope": "system",
222
+ "policy": "allow",
223
+ "role": "ROLE3",
224
+ "operation": "write"
225
+ };
226
+ AclManagementSteps.checkSystemRules([expectedSystemRule]);
227
+ });
228
+ });