graphdb-workbench-tests 2.4.0-RC1 → 2.4.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.
@@ -162,7 +162,8 @@
162
162
  "delete_rule_confirmation": "Are you sure you want to delete the selected rule #{{index}}?",
163
163
  "revert_acl_list": "This operation will revert all the changes done in the ACL. Are you sure you want to proceed?",
164
164
  "rules_updated": "ACL was updated successfully",
165
- "rules_reverted": "ACL was reverted successfully"
165
+ "rules_reverted": "ACL was reverted successfully",
166
+ "unsaved_changes_confirmation": "You have unsaved changes. Are you sure that you want to exit?"
166
167
  }
167
168
  },
168
169
  "errors": {
@@ -1,5 +1,7 @@
1
1
  import {AclManagementSteps} from "../../../steps/setup/acl-management-steps";
2
2
  import {ACL} from "../../../steps/setup/acl-management-steps";
3
+ import {ToasterSteps} from "../../../steps/toaster-steps";
4
+ import {ApplicationSteps} from "../../../steps/application-steps";
3
5
 
4
6
  describe('ACL Management: create rule', () => {
5
7
 
@@ -103,5 +105,21 @@ describe('ACL Management: create rule', () => {
103
105
  AclManagementSteps.editRuleButtons().should('have.length', 0);
104
106
  AclManagementSteps.createRuleButtons().should('have.length', 0);
105
107
  });
108
+
109
+ it('should not allow creating of a new rule if it is not unique', () => {
110
+ // When I am on "ACL Management" page and create a rule that exist,
111
+ AclManagementSteps.addRuleInBeginning();
112
+ AclManagementSteps.fillSubject(0, '<urn:Mary>');
113
+ AclManagementSteps.fillPredicate(0, '*');
114
+ AclManagementSteps.fillObject(0, '*');
115
+ AclManagementSteps.fillContext(0, '*');
116
+ AclManagementSteps.fillRole(0, '!CUSTOM_ROLE2');
117
+ AclManagementSteps.selectPolicy(0, 'allow');
118
+ // and try to save it.
119
+ AclManagementSteps.saveRule(0);
120
+
121
+ // Then I expect an error notification to be displayed that describe me that ACL have to be unique.
122
+ ApplicationSteps.getErrorNotifications().contains('Every ACL rule should be unique.');
123
+ });
106
124
  });
107
125
 
@@ -52,5 +52,9 @@ describe('ACL Management: revert rules', () => {
52
52
  ApplicationSteps.getSuccessNotifications().should('be.visible');
53
53
  AclManagementSteps.getAclRules().should('have.length', 5);
54
54
  AclManagementSteps.checkRules(ACL);
55
+ // And the model should become pristine again after the revert
56
+ // I should be able to navigate away from the page without any confirmation
57
+ ApplicationSteps.openImportPage();
58
+ cy.url().should('contain', '/import');
55
59
  });
56
60
  });
@@ -72,4 +72,61 @@ describe('ACL Management: update rules', () => {
72
72
  };
73
73
  AclManagementSteps.checkRules([ACL[0], newRule, editedRule, ACL[2], ACL[3]]);
74
74
  });
75
+
76
+ it('Should prevent leaving the page when there is new rule added', () => {
77
+ // Given I have opened ACL management page
78
+ // When I don't change anything and try to leave the page
79
+ ApplicationSteps.openImportPage();
80
+ // Then I expect to be redirected to the new page without confirmation
81
+ cy.url().should('contain', '/import');
82
+ // When I add a new rule
83
+ AclManagementSteps.visit();
84
+ AclManagementSteps.addRule(1);
85
+ ApplicationSteps.openImportPage();
86
+ // Then I expect a confirmation dialog
87
+ ModalDialogSteps.getDialog().should('be.visible');
88
+ // When I cancel confirmation
89
+ ModalDialogSteps.clickOnCancelButton();
90
+ // Then I expect dialog to be closed and to stay on the current page
91
+ ModalDialogSteps.getDialog().should('not.exist');
92
+ cy.url().should('contain', '/aclmanagement');
93
+ // When I try to leave the page and I confirm the operation
94
+ ApplicationSteps.openImportPage();
95
+ ModalDialogSteps.clickOnConfirmButton();
96
+ // Then I expect to be redirected to the new page
97
+ cy.url().should('contain', '/import');
98
+ });
99
+
100
+ it('Should prevent leaving the page when there is an edited rule', () => {
101
+ // Given I have opened ACL management page
102
+ // When I edit a rule
103
+ AclManagementSteps.editRule(1);
104
+ AclManagementSteps.fillSubject(1, '<urn:Me>');
105
+ AclManagementSteps.saveRule(1);
106
+ // And I try to leave the page
107
+ ApplicationSteps.openImportPage();
108
+ // Then I expect a confirmation dialog
109
+ ModalDialogSteps.getDialog().should('be.visible');
110
+ });
111
+
112
+ it('Should prevent leaving the page when there is a deleted rule', () => {
113
+ // Given I have opened ACL management page
114
+ // When I delete a rule
115
+ AclManagementSteps.deleteRule(1);
116
+ ModalDialogSteps.clickOnConfirmButton();
117
+ // And I try to leave the page
118
+ ApplicationSteps.openImportPage();
119
+ // Then I expect a confirmation dialog
120
+ ModalDialogSteps.getDialog().should('be.visible');
121
+ });
122
+
123
+ it('Should prevent leaving the page when there is a moved rule', () => {
124
+ // Given I have opened ACL management page
125
+ // When I move a rule
126
+ AclManagementSteps.moveRuleDown(1);
127
+ // And I try to leave the page
128
+ ApplicationSteps.openImportPage();
129
+ // Then I expect a confirmation dialog
130
+ ModalDialogSteps.getDialog().should('be.visible');
131
+ });
75
132
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.4.0-RC1",
3
+ "version": "2.4.0-RC2",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "start": "cypress open",
@@ -19,4 +19,9 @@ export class ApplicationSteps {
19
19
  static getWarningNotification() {
20
20
  return this.getNotifications().find('.toast-warning');
21
21
  }
22
+
23
+ // navigation via main menu
24
+ static openImportPage() {
25
+ cy.get('.main-menu .menu-element-root[href=import]').click();
26
+ }
22
27
  }