graphdb-workbench-tests 2.7.4-GA2 → 2.7.4-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.
@@ -53,7 +53,6 @@ describe('Repositories', () => {
53
53
  });
54
54
 
55
55
 
56
-
57
56
  it('create repository page should list available repository types options', () => {
58
57
  const expectedRepoTypes = ['GraphDB Repository', 'Ontop Virtual SPARQL', 'FedX Virtual SPARQL'];
59
58
  RepositorySteps.createRepository();
@@ -208,6 +207,33 @@ describe('Repositories', () => {
208
207
  // getRepositoryFtsCheckbox().should('be.checked');
209
208
  });
210
209
 
210
+ it('should create repository with selected ruleset file', () => {
211
+ interceptRulesetFileUpload();
212
+ // Given I create a repository
213
+ RepositorySteps.createRepository();
214
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
215
+ RepositorySteps.typeRepositoryId(repositoryId);
216
+ // When I select an invalid ruleset file
217
+ RepositorySteps.getRepositoryRulesetMenu().select('OWL-Horst (Optimized)').then(() => {
218
+ RepositorySteps.selectRulesetFile();
219
+ RepositorySteps.uploadRulesetFile('fixtures/repositories/invalid_builtin_Rules.pie');
220
+ // Then I see an error
221
+ ToasterSteps.verifyError('Error compiling ruleset: ');
222
+ // And I wait for it to disappear
223
+ ToasterSteps.getToast().should('not.exist');
224
+ });
225
+
226
+ // When I select a valid ruleset file
227
+ RepositorySteps.getRepositoryRulesetMenu().select('OWL-Horst (Optimized)').then(() => {
228
+ RepositorySteps.selectRulesetFile();
229
+ RepositorySteps.uploadRulesetFile('fixtures/repositories/builtin_Rules.pie');
230
+ // Then there should be no error
231
+ ToasterSteps.getToast().should('not.exist');
232
+ // And I should be able to save the repository
233
+ RepositorySteps.saveRepository();
234
+ });
235
+ });
236
+
211
237
  it('should allow to switch between repositories', () => {
212
238
  const secondRepoId = 'second-repo-' + Date.now();
213
239
  RepositorySteps.createRepository();
@@ -491,4 +517,38 @@ describe('Repositories', () => {
491
517
  .then(($el) => $el)
492
518
  .then(($el) => $el && $el.text() === status));
493
519
  }
520
+
521
+ function interceptRulesetFileUpload() {
522
+ cy.intercept(
523
+ {
524
+ method: 'POST',
525
+ url: 'rest/repositories/ruleset/upload'
526
+ },
527
+ (req) => {
528
+ const bodyString = req.body.toString();
529
+
530
+ if (bodyString.includes('filename="invalid_builtin_Rules.pie"')) {
531
+ req.reply({
532
+ statusCode: 200,
533
+ body: {
534
+ success: false,
535
+ errorMessage: 'Error compiling ruleset: invalid_builtin_Rulestmp1724942106843.pie',
536
+ fileLocation: ''
537
+ }
538
+ });
539
+ } else if (bodyString.includes('filename="builtin_Rules.pie"')) {
540
+ req.reply({
541
+ statusCode: 200,
542
+ body: {
543
+ success: true,
544
+ errorMessage: '',
545
+ fileLocation: 'builtin_Rulestmp1724944380374.pie'
546
+ }
547
+ });
548
+ } else {
549
+ throw new Error('Test failed: Request did not match stubbed headers.');
550
+ }
551
+ }
552
+ ).as('uploadRuleset');
553
+ }
494
554
  });
@@ -108,7 +108,8 @@ describe('ACL Management: create rule', () => {
108
108
  "subject": "<urn:Mary>",
109
109
  "predicate": "*",
110
110
  "object": "*",
111
- "context": "*"
111
+ "context": "*",
112
+ "warnForPrefix": false
112
113
  },
113
114
  {
114
115
  "scope": "statement",
@@ -118,7 +119,8 @@ describe('ACL Management: create rule', () => {
118
119
  "subject": "*",
119
120
  "predicate": "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>",
120
121
  "object": "*",
121
- "context": "*"
122
+ "context": "*",
123
+ "warnForPrefix": false
122
124
  },
123
125
  {
124
126
  "scope": "statement",
@@ -128,7 +130,8 @@ describe('ACL Management: create rule', () => {
128
130
  "subject": "<urn:John>",
129
131
  "predicate": "*",
130
132
  "object": "*",
131
- "context": "*"
133
+ "context": "*",
134
+ "warnForPrefix": false
132
135
  },
133
136
  {
134
137
  "scope": "statement",
@@ -138,7 +141,8 @@ describe('ACL Management: create rule', () => {
138
141
  "subject": "<<<http://example.com/test> <http://www.w3.org/2000/01/rdf-schema#label> \"test aber auf Deutsch\"@de>>",
139
142
  "predicate": "*",
140
143
  "object": "\"test aber auf Deutsch\"@en",
141
- "context": "<http://example.com/graph1>"
144
+ "context": "<http://example.com/graph1>",
145
+ "warnForPrefix": false
142
146
  },
143
147
  {
144
148
  "scope": "statement",
@@ -148,7 +152,8 @@ describe('ACL Management: create rule', () => {
148
152
  "subject": "*",
149
153
  "predicate": "*",
150
154
  "object": "\"15\"^^<http://www.w3.org/2001/XMLSchema#int>",
151
- "context": "*"
155
+ "context": "*",
156
+ "warnForPrefix": false
152
157
  },
153
158
  {
154
159
  "scope": "statement",
@@ -158,7 +163,8 @@ describe('ACL Management: create rule', () => {
158
163
  "subject": "<urn:Cat>",
159
164
  "predicate": "*",
160
165
  "object": "<<<http://example.com/test> <http://www.w3.org/2000/01/rdf-schema#label> \"test aber auf Deutsch\"@de>>",
161
- "context": "*"
166
+ "context": "*",
167
+ "warnForPrefix": false
162
168
  }
163
169
  ];
164
170
  expect(interception.request.body).to.deep.eq(expected);
@@ -222,17 +228,16 @@ describe('ACL Management: create rule', () => {
222
228
  AclManagementSteps.fillRole(0, 'CUSTOM_ROLE_FOO');
223
229
 
224
230
  // Then I expect the prefix warning to appear
225
- AclManagementSteps.getPrefixWarning().should('be.visible');
226
- AclManagementSteps.getPrefixWarning().should('contain.text', 'Custom roles should be entered without the "CUSTOM_" prefix in Workbench');
231
+ AclManagementSteps.getPrefixWarning(0).should('be.visible');
232
+ AclManagementSteps.getPrefixWarning(0).should('contain.text', 'Custom roles should be entered without the "CUSTOM_" prefix in Workbench');
227
233
  // When I save the rule
228
234
  AclManagementSteps.saveRule(0);
229
235
  // Then the text should be how the user typed it
230
236
  AclManagementSteps.getSavedRoleField(0).should('contain', 'CUSTOM_ROLE_FOO');
231
237
  // And I expect a warning icon to appear
232
- AclManagementSteps.getWarningIcon().should('be.visible');
233
- AclManagementSteps.mouseoverWarningIcon();
238
+ AclManagementSteps.getWarningIcon(0).should('be.visible');
234
239
  // And the icon should have the same tooltip text as the warning
235
- AclManagementSteps.getWarningIconTooltipText().should('be.visible').and('contain.text', 'Custom roles should be entered without the "CUSTOM_" prefix in Workbench');
240
+ AclManagementSteps.getWarningIconTooltipText(0).should('be.visible').and('contain.text', 'Custom roles should be entered without the "CUSTOM_" prefix in Workbench');
236
241
  });
237
242
  });
238
243
 
@@ -138,20 +138,23 @@ describe('ACL Management: rule scopes', () => {
138
138
  "scope": "clear_graph",
139
139
  "policy": "deny",
140
140
  "role": "CUSTOM_ROLE1",
141
- "context": "all"
141
+ "context": "all",
142
+ "warnForPrefix": false
142
143
  },
143
144
  {
144
145
  "scope": "plugin",
145
146
  "policy": "deny",
146
147
  "role": "CUSTOM_ROLE2",
147
148
  "operation": "write",
148
- "plugin": "*"
149
+ "plugin": "*",
150
+ "warnForPrefix": false
149
151
  },
150
152
  {
151
153
  "scope": "system",
152
154
  "policy": "allow",
153
155
  "role": "CUSTOM_ROLE3",
154
- "operation": "write"
156
+ "operation": "write",
157
+ "warnForPrefix": false
155
158
  },
156
159
  {
157
160
  "scope": "statement",
@@ -161,7 +164,8 @@ describe('ACL Management: rule scopes', () => {
161
164
  "subject": "*",
162
165
  "predicate": "*",
163
166
  "object": "*",
164
- "context": "*"
167
+ "context": "*",
168
+ "warnForPrefix": false
165
169
  }
166
170
  ];
167
171
  expect(interception.request.body).to.deep.eq(expectedPayload);
@@ -109,9 +109,9 @@ describe('User and Access', () => {
109
109
  // When I create a user
110
110
  UserAndAccessSteps.clickCreateNewUserButton();
111
111
  // And I add a custom role tag with prefix CUSTOM_
112
- UserAndAccessSteps.addTextToCustomRoleField('CUSTOM_USER');
112
+ UserAndAccessSteps.addTextToCustomRoleField('CUSTOM_USER{Enter}');
113
113
  // There should be a warning text
114
- UserAndAccessSteps.getPrefixWarning().should('contain', 'Custom roles should be entered without the "CUSTOM_" prefix in Workbench');
114
+ UserAndAccessSteps.getPrefixWarning(0).should('contain', 'Custom roles should be entered without the "CUSTOM_" prefix in Workbench');
115
115
  });
116
116
 
117
117
  it('Warn users when setting no password when creating new user admin', () => {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.7.4-GA2",
3
+ "version": "2.7.4-RC2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "2.7.4-GA2",
9
+ "version": "2.7.4-RC2",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "cypress": "^13.3.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.7.4-GA2",
3
+ "version": "2.7.4-RC2",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
@@ -206,4 +206,40 @@ export class RepositorySteps {
206
206
  .and('contain', 'Repositories from: ')
207
207
  .and('contain', 'Local');
208
208
  }
209
+
210
+ static getOntopicTable() {
211
+ return cy.get('#wb-repositories-ontopic-repositoryInGetRepositories');
212
+ }
213
+
214
+ static getDeleteOntopicInstanceBtn(url) {
215
+ return RepositorySteps.getOntopicTable().find('tr').contains(url).parent().find('.delete-ontopic-location');
216
+ }
217
+
218
+ static deleteOntopicInstance(url) {
219
+ RepositorySteps.getDeleteOntopicInstanceBtn(url).click();
220
+ }
221
+
222
+ static getEditOntopicInstanceBtn(url) {
223
+ return RepositorySteps.getOntopicTable().find('tr').contains(url).parent().find('.edit-ontopic-location');
224
+ }
225
+
226
+ static editOntopicInstance(url) {
227
+ RepositorySteps.getEditOntopicInstanceBtn(url).click();
228
+ }
229
+
230
+ static getRemoteGraphDBTable() {
231
+ return cy.get('#wb-locations-locationInGetRemoteLocations');
232
+ }
233
+
234
+ static getLocalGraphDBTable() {
235
+ return cy.get('#wb-locations-locationInGetLocations');
236
+ }
237
+
238
+ static selectRulesetFile() {
239
+ cy.get('#additionalParams .form-group .selectFiles').click();
240
+ }
241
+
242
+ static uploadRulesetFile(file) {
243
+ cy.get('input[type=file]').eq(1).selectFile(file, {force: true});
244
+ }
209
245
  }
@@ -169,22 +169,19 @@ export class AclManagementSteps {
169
169
  return cy.get('div.small');
170
170
  }
171
171
 
172
- static getPrefixWarning() {
173
- return cy.get('.prefix-warning-text');
172
+ static getPrefixWarning(index) {
173
+ return this.getSavedRoleField(index).find('.prefix-warning-text');
174
174
  }
175
175
 
176
- static getWarningIcon() {
177
- return cy.get('.icon-warning');
176
+ static getWarningIcon(index) {
177
+ return this.getSavedRoleField(index).get('.icon-warning');
178
178
  }
179
179
 
180
- static getWarningIconTooltipText() {
180
+ static getWarningIconTooltipText(index) {
181
+ this.getWarningIcon(index).trigger('mouseover');
181
182
  return cy.get('.angular-tooltip');
182
183
  }
183
184
 
184
- static mouseoverWarningIcon() {
185
- cy.get('.icon-warning').first().trigger('mouseover');
186
- }
187
-
188
185
  static getPluginField(index) {
189
186
  return this.getRule(index).find('.plugin-cell textarea');
190
187
  }