graphdb-workbench-tests 2.2.3 → 2.3.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.
@@ -1,5 +1,7 @@
1
1
  import HomeSteps from "../../steps/home-steps";
2
2
  import ImportSteps from "../../steps/import-steps";
3
+ import {RepositorySteps} from "../../steps/repository-steps";
4
+ import {ToasterSteps} from "../../steps/toaster-steps";
3
5
 
4
6
  describe('Repositories', () => {
5
7
 
@@ -37,36 +39,21 @@ describe('Repositories', () => {
37
39
  ".";
38
40
 
39
41
  const GDB_REPOSITORY_TYPE = 'gdb';
40
- const REPO_LIST_ID = '#wb-repositories-repositoryInGetRepositories';
41
42
 
42
43
  beforeEach(() => {
43
44
  repositoryId = 'repo-' + Date.now();
44
- cy.intercept('/rest/locations?filterClusterLocations=true').as('getLocations');
45
- cy.intercept('/rest/repositories/all').as('getRepositories');
46
-
47
- cy.visit('/repository');
48
- waitLoader();
49
- cy.wait('@getLocations');
50
- cy.window();
51
-
52
- waitUntilRepositoriesPageIsLoaded();
45
+ RepositorySteps.visit();
53
46
  });
54
47
 
55
48
  afterEach(() => {
56
49
  cy.deleteRepository(repositoryId);
57
50
  });
58
51
 
59
- function waitUntilRepositoriesPageIsLoaded() {
60
- // Workbench loading screen should not be visible
61
- cy.get('.ot-splash').should('not.be.visible');
62
52
 
63
- getRepositoriesDropdown().should('not.be.disabled');
64
- getCreateRepositoryButton().should('be.visible').and('not.be.disabled');
65
- }
66
53
 
67
54
  it('create repository page should list available repository types options', () => {
68
- let expectedRepoTypes = ['GraphDB Repository', 'Ontop Virtual SPARQL', 'FedX Virtual SPARQL'];
69
- createRepository();
55
+ const expectedRepoTypes = ['GraphDB Repository', 'Ontop Virtual SPARQL', 'FedX Virtual SPARQL'];
56
+ RepositorySteps.createRepository();
70
57
  cy.url().should('include', '/repository/create');
71
58
 
72
59
  cy.get('.create-buttons')
@@ -81,22 +68,22 @@ describe('Repositories', () => {
81
68
 
82
69
  it('should allow creation of repositories with default settings', () => {
83
70
  // There should be a default repository location
84
- getLocationsList();
71
+ RepositorySteps.getLocationsList();
85
72
 
86
- createRepository();
73
+ RepositorySteps.createRepository();
87
74
  cy.url().should('include', '/repository/create');
88
75
 
89
- chooseRepositoryType(GDB_REPOSITORY_TYPE);
76
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
90
77
  cy.url().should('include', '/repository/create/');
91
78
 
92
79
  // Create a repository by supplying only an identifier
93
- getRepositoryCreateForm();
94
- getRepositoryIdField()
80
+ RepositorySteps.getRepositoryCreateForm();
81
+ RepositorySteps.getRepositoryIdField()
95
82
  .should('have.value', '')
96
83
  .type(repositoryId)
97
84
  .should('have.value', repositoryId);
98
85
 
99
- saveRepository();
86
+ RepositorySteps.saveRepository();
100
87
 
101
88
  // Verify we are back at the setup page after saving
102
89
  cy.url().should((url) => {
@@ -104,19 +91,19 @@ describe('Repositories', () => {
104
91
  });
105
92
 
106
93
  // Check the repo is present in the list of repos and we are not yet connected to it
107
- getRepositoryFromList(repositoryId)
94
+ RepositorySteps.getRepositoryFromList(repositoryId)
108
95
  .should('be.visible')
109
96
  .find('.icon-connection-off')
110
97
  .should('be.visible');
111
98
 
112
99
  // Verify it's configuration can be downloaded
113
- getRepositoryFromList(repositoryId)
100
+ RepositorySteps.getRepositoryFromList(repositoryId)
114
101
  .find('.repository-actions .download-repository-config-btn')
115
102
  .should('be.visible')
116
103
  .and('not.be.disabled');
117
104
 
118
105
  // Connect to the repository via the menu
119
- getRepositoriesDropdown().click().within(() => {
106
+ RepositorySteps.getRepositoriesDropdown().click().within(() => {
120
107
  // It should have not selected the new repo
121
108
 
122
109
  // Note: The better test here should verify for .no-selected-repository presence but in Travis it seems there is a selected
@@ -143,10 +130,10 @@ describe('Repositories', () => {
143
130
  });
144
131
 
145
132
  // The repo should be connected after selecting it from the menu
146
- getRepositoryConnectionOnBtn(repositoryId).should('be.visible');
133
+ RepositorySteps.getRepositoryConnectionOnBtn(repositoryId).should('be.visible');
147
134
 
148
135
  // And it should not be present in the dropdown items
149
- getRepositoriesDropdown()
136
+ RepositorySteps.getRepositoriesDropdown()
150
137
  .click()
151
138
  .then(() => {
152
139
  cy.get('.dropdown-menu-right')
@@ -155,67 +142,64 @@ describe('Repositories', () => {
155
142
  });
156
143
 
157
144
  it('should disallow creation of repositories without mandatory settings', () => {
158
- createRepository();
159
- chooseRepositoryType(GDB_REPOSITORY_TYPE);
145
+ RepositorySteps.createRepository();
146
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
160
147
  cy.url().should('include', '/repository/create/');
161
148
 
162
- saveRepository();
149
+ RepositorySteps.saveRepository();
163
150
 
164
- getRepositoryCreateForm();
165
- getRepositoryIdField().should('have.attr', 'placeholder', 'This field is required');
151
+ RepositorySteps.getRepositoryCreateForm();
152
+ RepositorySteps.getRepositoryIdField().should('have.attr', 'placeholder', 'This field is required');
166
153
 
167
- getToast()
168
- .find('.toast-error')
169
- .should('be.visible')
170
- .and('contain', 'Repository ID cannot be empty');
154
+ ToasterSteps.verifyError('Repository ID cannot be empty');
171
155
  });
172
156
 
173
157
  it('should allow creation of repositories with custom settings', () => {
174
158
  const repoTitle = 'Repo title for ' + repositoryId;
175
159
 
176
- createRepository();
177
- chooseRepositoryType(GDB_REPOSITORY_TYPE);
160
+ RepositorySteps.createRepository();
161
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
178
162
  cy.url().should('include', '/repository/create/');
179
163
 
180
- getRepositoryIdField().type(repositoryId);
181
- getRepositoryTitleField()
164
+ RepositorySteps.getRepositoryIdField().type(repositoryId);
165
+ RepositorySteps.getRepositoryTitleField()
182
166
  .should('have.value', '')
183
167
  .type(repoTitle)
184
168
  .should('have.value', repoTitle);
185
169
 
186
170
  // Should be disabled before changing the rule set
187
- getRepositoryDisableSameAsCheckbox()
171
+ RepositorySteps.getRepositoryDisableSameAsCheckbox()
188
172
  .should('be.checked');
189
173
 
190
174
  // RDFS-Plus (Optimized) -> OWL-Horst (Optimized)
191
- getRepositoryRulesetMenu()
175
+ RepositorySteps.getRepositoryRulesetMenu()
192
176
  .should('have.value', '3')
193
177
  .select('4')
194
178
  .should('have.value', '4');
195
179
 
196
180
  // Should be automatically enabled when the rule set is changed to one of the OWL rule set
197
- getRepositoryDisableSameAsCheckbox()
181
+ RepositorySteps.getRepositoryDisableSameAsCheckbox()
198
182
  .should('not.be.checked');
199
183
 
200
- getRepositoryContextIndexCheckbox()
184
+ RepositorySteps.getRepositoryContextIndexCheckbox()
201
185
  .should('not.be.checked')
202
186
  .check()
203
187
  .should('be.checked');
204
188
 
205
- saveRepository();
189
+ RepositorySteps.saveRepository();
206
190
 
207
191
  // Go to edit and check if everything is properly saved
208
- editRepository(repositoryId);
192
+ RepositorySteps.editRepository(repositoryId);
209
193
 
210
194
  cy.url().should('include', '/repository/edit/' + repositoryId);
211
195
 
212
- getRepositoryCreateForm();
213
- getRepositoryIdField().should('have.value', repositoryId);
214
- getRepositoryTitleField().should('have.value', repoTitle);
196
+ RepositorySteps.getRepositoryCreateForm();
197
+ RepositorySteps.getRepositoryIdField().should('have.value', repositoryId);
198
+ RepositorySteps.getRepositoryTitleField().should('have.value', repoTitle);
215
199
  // OWL-Horst (Optimized) has become 4
216
- getRepositoryRulesetMenu().should('have.value', '4');
217
- getRepositoryDisableSameAsCheckbox().should('not.be.checked');
218
- getRepositoryContextIndexCheckbox().should('be.checked');
200
+ RepositorySteps.getRepositoryRulesetMenu().should('have.value', '4');
201
+ RepositorySteps.getRepositoryDisableSameAsCheckbox().should('not.be.checked');
202
+ RepositorySteps.getRepositoryContextIndexCheckbox().should('be.checked');
219
203
 
220
204
  // TODO uncomment and refactor when FTS configuration is with clear ON or OFF status
221
205
  // getRepositoryFtsCheckbox().should('be.checked');
@@ -223,28 +207,28 @@ describe('Repositories', () => {
223
207
 
224
208
  it('should allow to switch between repositories', () => {
225
209
  const secondRepoId = 'second-repo-' + Date.now();
226
- createRepository();
227
- chooseRepositoryType(GDB_REPOSITORY_TYPE);
210
+ RepositorySteps.createRepository();
211
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
228
212
  cy.url().should('include', '/repository/create/');
229
213
 
230
- typeRepositoryId(repositoryId);
231
- saveRepository();
214
+ RepositorySteps.typeRepositoryId(repositoryId);
215
+ RepositorySteps.saveRepository();
232
216
 
233
- createRepository();
234
- chooseRepositoryType(GDB_REPOSITORY_TYPE);
217
+ RepositorySteps.createRepository();
218
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
235
219
  cy.url().should('include', '/repository/create/');
236
220
 
237
- typeRepositoryId(secondRepoId);
238
- saveRepository();
221
+ RepositorySteps.typeRepositoryId(secondRepoId);
222
+ RepositorySteps.saveRepository();
239
223
  cy.wait('@getRepositories');
240
224
 
241
225
  // Wait for redirection to previous '/repository'
242
226
  cy.waitUntil(() =>
243
- cy.url().then(url => url === (Cypress.config('baseUrl') + '/repository')));
227
+ cy.url().then((url) => url === (Cypress.config('baseUrl') + '/repository')));
244
228
 
245
229
  // Connect to the first repo via the connection icon
246
230
  // Note: Not using within() because the whole row will be re-rendered & detached
247
- getRepositoryConnectionOffBtn(repositoryId)
231
+ RepositorySteps.getRepositoryConnectionOffBtn(repositoryId)
248
232
  .should('be.visible')
249
233
  .and('not.be.disabled')
250
234
  // Forcefully clicking it due to https://github.com/cypress-io/cypress/issues/695
@@ -252,34 +236,34 @@ describe('Repositories', () => {
252
236
  .should('not.exist');
253
237
 
254
238
  // See it is connected and the second is not
255
- getRepositoryConnectionOnBtn(repositoryId).should('be.visible');
256
- getRepositoryConnectionOffBtn(secondRepoId).should('be.visible');
257
- getRepositoriesDropdown()
239
+ RepositorySteps.getRepositoryConnectionOnBtn(repositoryId).should('be.visible');
240
+ RepositorySteps.getRepositoryConnectionOffBtn(secondRepoId).should('be.visible');
241
+ RepositorySteps.getRepositoriesDropdown()
258
242
  .find('.active-repository')
259
243
  .should('contain', repositoryId);
260
244
 
261
245
  // Choose the second from the dropdown
262
- selectRepoFromDropdown(secondRepoId);
246
+ RepositorySteps.selectRepoFromDropdown(secondRepoId);
263
247
 
264
248
  // See it is connected and the first is disconnected
265
- getRepositoryConnectionOffBtn(repositoryId).should('be.visible');
266
- getRepositoryConnectionOnBtn(secondRepoId).should('be.visible');
267
- getRepositoriesDropdown()
249
+ RepositorySteps.getRepositoryConnectionOffBtn(repositoryId).should('be.visible');
250
+ RepositorySteps.getRepositoryConnectionOnBtn(secondRepoId).should('be.visible');
251
+ RepositorySteps.getRepositoriesDropdown()
268
252
  .find('.active-repository')
269
253
  .should('contain', secondRepoId);
270
254
  // The first should return back to the dropdown items
271
- getRepositoriesDropdown()
255
+ RepositorySteps.getRepositoriesDropdown()
272
256
  .click()
273
257
  .find('.dropdown-menu-right .dropdown-item')
274
258
  .should('contain', repositoryId);
275
259
  // Hide the menu
276
- getRepositoriesDropdown().click();
260
+ RepositorySteps.getRepositoriesDropdown().click();
277
261
 
278
262
  // Make the first one default, clear the cookies and reload the page
279
263
  // Note: the first one should be cleared in afterEach() preventing other tests to select it by default
280
- selectRepoFromDropdown(repositoryId);
264
+ RepositorySteps.selectRepoFromDropdown(repositoryId);
281
265
 
282
- getRepositoryFromList(repositoryId)
266
+ RepositorySteps.getRepositoryFromList(repositoryId)
283
267
  .find('.pin-repository-btn')
284
268
  .should('not.have.class', 'active')
285
269
  .click({force:true})
@@ -289,7 +273,7 @@ describe('Repositories', () => {
289
273
  cy.window();
290
274
 
291
275
  // Should automatically select the default repository
292
- getRepositoriesDropdown()
276
+ RepositorySteps.getRepositoriesDropdown()
293
277
  .find('.active-repository')
294
278
  .should('contain', repositoryId)
295
279
  .then(() => {
@@ -302,340 +286,83 @@ describe('Repositories', () => {
302
286
  it('should allow to edit existing repository', () => {
303
287
  const newTitle = 'Title edit';
304
288
 
305
- createRepository();
306
- chooseRepositoryType(GDB_REPOSITORY_TYPE);
289
+ RepositorySteps.createRepository();
290
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
307
291
  cy.url().should('include', '/repository/create/');
308
292
 
309
- typeRepositoryId(repositoryId);
310
- typeRepositoryTitle('Title');
311
- saveRepository();
312
- editRepository(repositoryId);
293
+ RepositorySteps.typeRepositoryId(repositoryId);
294
+ RepositorySteps.typeRepositoryTitle('Title');
295
+ RepositorySteps.saveRepository();
296
+ RepositorySteps.editRepository(repositoryId);
313
297
 
314
298
  // Some fields should be disabled
315
- getRepositoryRulesetMenu().should('be.disabled');
316
- getRepositoryDisableSameAsCheckbox().should('be.disabled');
299
+ RepositorySteps.getRepositoryRulesetMenu().should('be.disabled');
300
+ RepositorySteps.getRepositoryDisableSameAsCheckbox().should('be.disabled');
317
301
 
318
- typeRepositoryTitle(newTitle);
319
- getRepositoryContextIndexCheckbox().check();
302
+ RepositorySteps.typeRepositoryTitle(newTitle);
303
+ RepositorySteps.getRepositoryContextIndexCheckbox().check();
320
304
 
321
305
  // TODO uncomment and refactor when FTS configuration is with clear ON or OFF status
322
306
  // getRepositoryFtsCheckbox().check();
323
307
 
324
- getSaveRepositoryButton()
308
+ RepositorySteps.getSaveRepositoryButton()
325
309
  .click()
326
310
  .then(() => {
327
- confirmModal();
328
- waitLoader();
311
+ RepositorySteps.confirmModal();
312
+ RepositorySteps.waitLoader();
329
313
  });
330
314
  cy.wait('@getLocations');
331
315
  // See the title is rendered in the repositories list
332
- getRepositoryFromList(repositoryId).should('contain', newTitle);
316
+ RepositorySteps.getRepositoryFromList(repositoryId).should('contain', newTitle);
333
317
 
334
318
  // Go to edit again to verify changes
335
- editRepository(repositoryId);
319
+ RepositorySteps.editRepository(repositoryId);
336
320
 
337
- getRepositoryTitleField().should('have.value', newTitle);
338
- getRepositoryContextIndexCheckbox().should('be.checked');
321
+ RepositorySteps.getRepositoryTitleField().should('have.value', newTitle);
322
+ RepositorySteps.getRepositoryContextIndexCheckbox().should('be.checked');
339
323
 
340
324
  // TODO uncomment and refactor when FTS configuration is with clear ON or OFF status
341
325
  // getRepositoryFtsCheckbox().should('be.checked');
342
326
  });
343
327
 
344
328
  it('should allow to delete existing repository', () => {
345
- createRepository();
346
- chooseRepositoryType(GDB_REPOSITORY_TYPE);
329
+ RepositorySteps.createRepository();
330
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
347
331
  cy.url().should('include', '/repository/create/');
348
332
 
349
- typeRepositoryId(repositoryId);
350
- saveRepository();
351
- selectRepoFromDropdown(repositoryId);
333
+ RepositorySteps.typeRepositoryId(repositoryId);
334
+ RepositorySteps.saveRepository();
335
+ RepositorySteps.selectRepoFromDropdown(repositoryId);
352
336
 
353
- getRepositoryFromList(repositoryId)
337
+ RepositorySteps.getRepositoryFromList(repositoryId)
354
338
  .find('.repository-actions .delete-repository-btn')
355
339
  // Forcefully clicking it due to https://github.com/cypress-io/cypress/issues/695
356
340
  .should('be.visible')
357
341
  .and('not.be.disabled')
358
342
  .click({force: true});
359
343
 
360
- confirmModal();
344
+ RepositorySteps.confirmModal();
361
345
 
362
346
  // Check the repo has been deselected and is not present in the repo dropdown menu
363
- getRepositoriesDropdown().click().within(() => {
347
+ RepositorySteps.getRepositoriesDropdown().click().within(() => {
364
348
  cy.get('#btnReposGroup').should('not.contain', repositoryId);
365
349
  });
366
350
  });
367
351
 
368
- //Check that 'Ontop' type repository is available and that the configuration fields are present and active.
369
- it('should check if Ontop repository type is available', () => {
370
- getCreateRepositoryButton().click();
371
- getRepositoryTypeButton('ontop').should('be.visible');
372
- chooseRepositoryType('ontop');
373
- cy.url().should('include', '/repository/create/ontop');
374
-
375
- getOBDAFileField().should('be.visible');
376
- getOntologyFileField().should('be.visible');
377
- getPropertiesFileField().should('be.visible');
378
- getConstraintFileField().should('be.visible');
379
- getOBDAUploadButton().scrollIntoView().should('be.visible').and('not.be.disabled');
380
- getOntologyUploadButton().scrollIntoView().should('be.visible').and('not.be.disabled');
381
- getPropertiesUploadButton().scrollIntoView().should('be.visible').and('not.be.disabled');
382
- getConstraintUploadButton().scrollIntoView().should('be.visible').and('not.be.disabled');
383
- });
384
-
385
- // Remove skip, when https://gitlab.ontotext.com/graphdb-team/graphdb/-/merge_requests/1584 is merged
386
- //Create Ontop repository and test ontop functionality
387
- it.skip('should create an Ontop repository', () => {
388
- let obdaFileUpload = '';
389
- let ontologyFileUpload = '';
390
- let propertiesFileUpload = '';
391
- const url = 'http://localhost:9000/rest/repositories/file/upload';
392
- const fileType = '';
393
- const virtualRepoName = 'virtual-repo-' + Date.now();
394
-
395
- // upload obda file
396
- cy.fixture('ontop/university-complete.obda', 'binary').then((file) => {
397
- Cypress.Blob.binaryStringToBlob(file, fileType).then((blob) => {
398
- const formData = new FormData();
399
- formData.set('file', blob, 'university-complete.obda');
400
-
401
- cy.form_request(url, formData).then(response => {
402
- return obdaFileUpload = response.response.body.fileLocation;
403
- });
404
- });
405
- }).then(() => {
406
- // upload ontology file
407
- cy.fixture('ontop/university-complete.ttl', 'binary').then((file) => {
408
- Cypress.Blob.binaryStringToBlob(file, fileType).then((blob) => {
409
- const formData = new FormData();
410
- formData.set('file', blob, 'university-complete.ttl');
411
-
412
- cy.form_request(url, formData).then(response => {
413
- return ontologyFileUpload = response.response.body.fileLocation;
414
- });
415
- });
416
- }).then(() => {
417
- // upload property file
418
- cy.fixture('ontop/university-complete.properties', 'binary').then((file) => {
419
- Cypress.Blob.binaryStringToBlob(file, fileType).then((blob) => {
420
- const formData = new FormData();
421
- formData.set('file', blob, 'university-complete.properties');
422
-
423
- cy.form_request(url, formData).then(response => {
424
- return propertiesFileUpload = response.response.body.fileLocation;
425
- });
426
- });
427
- });
428
- }).then(() => {
429
- const body = {
430
- id: virtualRepoName,
431
- title: '',
432
- type: 'ontop',
433
- params: {
434
- propertiesFile: {
435
- label: 'JDBC properties file',
436
- name: 'propertiesFile',
437
- value: propertiesFileUpload
438
- },
439
- isShacl: {
440
- label: 'Supports SHACL validation',
441
- name: 'isShacle',
442
- value: false
443
- },
444
- owlFile: {
445
- label: 'Ontology file',
446
- name: 'owlFile',
447
- value: ontologyFileUpload
448
- },
449
- constraintFile: {
450
- label: 'Constraint file',
451
- name: 'constraintFile',
452
- value: ''
453
- },
454
- id: {
455
- label: 'Repository ID',
456
- name: 'id',
457
- value: 'ontop-repo'
458
- },
459
- title: {
460
- label: "Repository title",
461
- name: "title",
462
- value: "Ontop virtual store"
463
- },
464
- obdaFile: {
465
- label: "OBDA or R2RML file",
466
- name: "obdaFile",
467
- value: obdaFileUpload
468
- }
469
- }
470
- };
471
-
472
- cy.request({
473
- method: 'POST',
474
- url: 'http://localhost:9000/rest/repositories',
475
- body,
476
- headers: {'Content-Type': 'application/json;charset=UTF-8'}
477
- }).then(response => {
478
- console.log(response);
479
- });
480
- });
481
- });
482
-
483
- cy.reload(); //refresh page as the virtual repo is not visible in the UI when created with the request
484
-
485
- //Check workbench restricted sections when connected to an Ontop repository
486
- selectRepoFromDropdown(virtualRepoName);
487
- cy.visit("/import");
488
- getOntopFunctionalityDisabledMessage();
489
- cy.visit("/monitor/queries");
490
- getOntopFunctionalityDisabledMessage();
491
- cy.visit("/connectors");
492
- getOntopFunctionalityDisabledMessage();
493
- cy.visit("/autocomplete");
494
- getOntopFunctionalityDisabledMessage();
495
- cy.visit("/rdfrank");
496
- getOntopFunctionalityDisabledMessage();
497
- cy.visit("/jdbc");
498
- getOntopFunctionalityDisabledMessage();
499
-
500
- //TODO - uncomment following when org.h2.Driver is added to the class path of the instance
501
- //
502
- // //Check that Inference and SameAs are disabled also that explain plan is not supported.
503
- // cy.visit("/sparql");
504
- // cy.get('.ot-splash').should('not.exist'); //wait until SPARQL page is loaded completely
505
- //
506
- // //check that Inference and SameAs buttons are disabled.
507
- // cy.get('#inference').should('be', 'visible').and('be', 'disabled');
508
- // cy.get('#sameAs').should('be', 'visible').and('be', 'disabled');
509
- cy.deleteRepository(virtualRepoName);
510
- });
511
-
512
- it('should verify different virtual repository RDBMS provider elements', () => {
513
- // There should be a default repository location
514
- getLocationsList();
515
-
516
- createRepository();
517
- cy.url().should('include', '/repository/create');
518
-
519
- chooseRepositoryType("ontop");
520
- cy.url().should('include', '/repository/create/ontop');
521
-
522
- // Create a repository by supplying only an identifier
523
- getRepositoryCreateForm();
524
- getRepositoryIdField()
525
- .should('have.value', '')
526
- .type(repositoryId)
527
- .should('have.value', repositoryId);
528
-
529
- //Select Generic JDBC Driver driver type and verify elements and download url (if available)
530
- selectDatabaseDriver('Generic JDBC Driver');
531
- getDatabaseDriver().should('contain', 'Generic JDBC Driver');
532
-
533
- testOntopConfigurationElementsVisibility('Database driver', '#driverType');
534
- testOntopConfigurationElementsVisibility('JDBC properties file*', '#propertiesFile');
535
- testOntopConfigurationElementsVisibility('OBDA or R2RML file*', '#obdaFile');
536
- testOntopConfigurationElementsVisibility('Constraint file', '#constraintFile');
537
- testOntopConfigurationElementsVisibility('Ontology file', '#owlFile');
538
-
539
- //Select MySQL driver type and verify elements and download url (if available)
540
- selectDatabaseDriver('MySQL');
541
- getDatabaseDriver().should('contain', 'MySQL');
542
-
543
- testOntopConfigurationElementsVisibility('Hostname*', '#hostName');
544
- testOntopConfigurationElementsVisibility('Port', '#port');
545
- testOntopConfigurationElementsVisibility('Database name*', '#databaseName');
546
- testOntopConfigurationElementsVisibility('Username*', '#userName');
547
- testOntopConfigurationElementsVisibility('Password', '#password');
548
- testOntopConfigurationElementsVisibility('Driver class', '#driverClass');
549
- testOntopConfigurationElementsVisibility('URL', '#url');
550
- testOntopConfigurationElementsVisibility('OBDA or R2RML file*', '#obdaFile');
551
- testOntopConfigurationElementsVisibility('Constraint file', '#constraintFile');
552
- testOntopConfigurationElementsVisibility('Ontology file', '#owlFile');
553
- //verify driver download url
554
- compareDriverDownloadUrl('https://dev.mysql.com/downloads/connector/j/');
555
-
556
- //Select postgreSQL driver type and verify elements and download url (if available)
557
- selectDatabaseDriver('PostgreSQL');
558
- getDatabaseDriver().should('contain', 'PostgreSQL');
559
-
560
- testOntopConfigurationElementsVisibility('Hostname*', '#hostName');
561
- testOntopConfigurationElementsVisibility('Port', '#port');
562
- testOntopConfigurationElementsVisibility('Database name*', '#databaseName');
563
- testOntopConfigurationElementsVisibility('Username*', '#userName');
564
- testOntopConfigurationElementsVisibility('Password', '#password');
565
- testOntopConfigurationElementsVisibility('Driver class', '#driverClass');
566
- testOntopConfigurationElementsVisibility('URL', '#url');
567
- testOntopConfigurationElementsVisibility('OBDA or R2RML file*', '#obdaFile');
568
- testOntopConfigurationElementsVisibility('Constraint file', '#constraintFile');
569
- testOntopConfigurationElementsVisibility('Ontology file', '#owlFile');
570
- //verify driver download url
571
- compareDriverDownloadUrl('https://jdbc.postgresql.org/download');
572
-
573
- //Select Oracle driver type and verify elements and download url (if available)
574
- selectDatabaseDriver('Oracle');
575
- getDatabaseDriver().should('contain', 'Oracle');
576
-
577
- testOntopConfigurationElementsVisibility('Hostname*', '#hostName');
578
- testOntopConfigurationElementsVisibility('Port', '#port');
579
- testOntopConfigurationElementsVisibility('Database name*', '#databaseName');
580
- testOntopConfigurationElementsVisibility('Username*', '#userName');
581
- testOntopConfigurationElementsVisibility('Password', '#password');
582
- testOntopConfigurationElementsVisibility('Driver class', '#driverClass');
583
- testOntopConfigurationElementsVisibility('URL', '#url');
584
- testOntopConfigurationElementsVisibility('OBDA or R2RML file*', '#obdaFile');
585
- testOntopConfigurationElementsVisibility('Constraint file', '#constraintFile');
586
- testOntopConfigurationElementsVisibility('Ontology file', '#owlFile');
587
- //verify driver download url
588
- compareDriverDownloadUrl('https://www.cdata.com/drivers/oracledb/jdbc/');
589
-
590
- //Select MS SQL Server driver type and verify elements and download url (if available)
591
- selectDatabaseDriver('MS SQL Server');
592
- getDatabaseDriver().should('contain', 'MS SQL Server');
593
-
594
- testOntopConfigurationElementsVisibility('Hostname*', '#hostName');
595
- testOntopConfigurationElementsVisibility('Port', '#port');
596
- testOntopConfigurationElementsVisibility('Database name*', '#databaseName');
597
- testOntopConfigurationElementsVisibility('Username*', '#userName');
598
- testOntopConfigurationElementsVisibility('Password', '#password');
599
- testOntopConfigurationElementsVisibility('Driver class', '#driverClass');
600
- testOntopConfigurationElementsVisibility('URL', '#url');
601
- testOntopConfigurationElementsVisibility('OBDA or R2RML file*', '#obdaFile');
602
- testOntopConfigurationElementsVisibility('Constraint file', '#constraintFile');
603
- testOntopConfigurationElementsVisibility('Ontology file', '#owlFile');
604
- //verify driver download url
605
- compareDriverDownloadUrl('https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server');
606
-
607
- //Select DB2 driver type and verify elements and download url (if available)
608
- selectDatabaseDriver('DB2');
609
- getDatabaseDriver().should('contain', 'DB2');
610
-
611
- testOntopConfigurationElementsVisibility('Hostname*', '#hostName');
612
- testOntopConfigurationElementsVisibility('Port', '#port');
613
- testOntopConfigurationElementsVisibility('Database name*', '#databaseName');
614
- testOntopConfigurationElementsVisibility('Username*', '#userName');
615
- testOntopConfigurationElementsVisibility('Password', '#password');
616
- testOntopConfigurationElementsVisibility('Driver class', '#driverClass');
617
- testOntopConfigurationElementsVisibility('URL', '#url');
618
- testOntopConfigurationElementsVisibility('OBDA or R2RML file*', '#obdaFile');
619
- testOntopConfigurationElementsVisibility('Constraint file', '#constraintFile');
620
- testOntopConfigurationElementsVisibility('Ontology file', '#owlFile');
621
- //verify driver download url
622
- compareDriverDownloadUrl('https://www.ibm.com/support/pages/db2-jdbc-driver-versions-and-downloads');
623
- });
624
-
625
352
  it('should restart an existing repository', () => {
626
353
 
627
- createRepository();
628
- chooseRepositoryType(GDB_REPOSITORY_TYPE);
354
+ RepositorySteps.createRepository();
355
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
629
356
 
630
357
  cy.url().should('include', '/repository/create');
631
358
 
632
359
  // Create a repository by supplying only an identifier
633
- getRepositoryCreateForm();
634
- getRepositoryIdField()
360
+ RepositorySteps.getRepositoryCreateForm();
361
+ RepositorySteps.getRepositoryIdField()
635
362
  .should('have.value', '')
636
363
  .type(repositoryId)
637
364
  .should('have.value', repositoryId);
638
- saveRepository();
365
+ RepositorySteps.saveRepository();
639
366
 
640
367
  // Verify we are back at the setup page after saving
641
368
  cy.url().should((url) => {
@@ -645,7 +372,7 @@ describe('Repositories', () => {
645
372
  //Make sure that repository is in status INACTIVE
646
373
  assertRepositoryStatus(repositoryId, "INACTIVE");
647
374
 
648
- getRepositoriesDropdown().click().within(() => {
375
+ RepositorySteps.getRepositoriesDropdown().click().within(() => {
649
376
 
650
377
  // Wait about the menu to become visible due to a strange behavior of elements having size 0x0px thus treated as invisible.
651
378
  // Alternative is to have the click forced, which might lead to false positive result.
@@ -673,30 +400,27 @@ describe('Repositories', () => {
673
400
  });
674
401
 
675
402
  //Restart the repository
676
- restartRepository(repositoryId);
677
- confirmModal();
403
+ RepositorySteps.restartRepository(repositoryId);
404
+ RepositorySteps.confirmModal();
678
405
  //Check toast for RESTARTING status and repo row for RUNNING status
679
- getToast()
680
- .find('.toast-success')
681
- .should('be.visible')
682
- .and('contain', "Restarting repository " + repositoryId);
406
+ ToasterSteps.verifySuccess('Restarting repository ' + repositoryId);
683
407
 
684
408
  assertRepositoryStatus(repositoryId, "RESTARTING");
685
409
 
686
- getToast().should('not.exist');
410
+ ToasterSteps.getToast().should('not.exist');
687
411
 
688
412
  assertRepositoryStatus(repositoryId, "RUNNING");
689
413
  });
690
414
 
691
415
  it('should create SHACL repo and test shapes validation', () => {
692
416
  //Prepare repository by enabling SHACL
693
- createRepository();
694
- chooseRepositoryType(GDB_REPOSITORY_TYPE);
417
+ RepositorySteps.createRepository();
418
+ RepositorySteps.chooseRepositoryType(GDB_REPOSITORY_TYPE);
695
419
  cy.url().should('include', '/repository/create/');
696
- typeRepositoryId(repositoryId);
697
- getSHACLRepositoryCheckbox().check();
698
- saveRepository();
699
- selectRepoFromDropdown(repositoryId);
420
+ RepositorySteps.typeRepositoryId(repositoryId);
421
+ RepositorySteps.getSHACLRepositoryCheckbox().check();
422
+ RepositorySteps.saveRepository();
423
+ RepositorySteps.selectRepoFromDropdown(repositoryId);
700
424
 
701
425
  //Import a shape in the SHACL graph
702
426
  ImportSteps.visitUserImport(repositoryId);
@@ -727,239 +451,10 @@ describe('Repositories', () => {
727
451
 
728
452
  function assertRepositoryStatus(repositoryId, status) {
729
453
  cy.waitUntil(() =>
730
- getRepositoryFromList(repositoryId)
454
+ RepositorySteps.getRepositoryFromList(repositoryId)
731
455
  .should('be.visible')
732
456
  .find('.repository-status .text-secondary')
733
- .then($el => $el)
734
- .then($el => $el && $el.text() === status));
735
- }
736
-
737
- function getRepositoriesList() {
738
- return cy.get(REPO_LIST_ID);
739
- }
740
-
741
- function getLocationsList() {
742
- return cy.get('#wb-locations-locationInGetLocations')
743
- .find('tr.location')
744
- .should('have.length', 1)
745
- .and('contain', 'Repositories from: ')
746
- .and('contain', 'Local');
747
- }
748
-
749
- function getRepositoryFromList(repository) {
750
- waitLoader();
751
- return getRepositoriesList()
752
- .find('.repository')
753
- .contains(repository)
754
- // Return the whole repo row
755
- .closest('.repository');
756
- }
757
-
758
- function getRepositoryConnectionOffBtn(id) {
759
- return getRepositoryFromList(id).find('.icon-connection-off');
760
- }
761
-
762
- function getRepositoryConnectionOnBtn(id) {
763
- return getRepositoryFromList(id).find('.icon-connection-on');
764
- }
765
-
766
- function editRepository(repositoryId) {
767
- clickRepositoryIcon(repositoryId, '.repository-actions .edit-repository-btn');
768
- }
769
-
770
- function restartRepository(repositoryId) {
771
- clickRepositoryIcon(repositoryId, '.repository-actions .restart-repository-btn');
772
- }
773
-
774
- function clickRepositoryIcon(repositoryId, selector) {
775
- getRepositoryFromList(repositoryId)
776
- .should('be.visible')
777
- .find(selector)
778
- // Forcefully clicking it due to https://github.com/cypress-io/cypress/issues/695
779
- .should('be.visible')
780
- .and('not.be.disabled')
781
- .click({force: true});
782
- }
783
-
784
- function getCreateRepositoryButton() {
785
- return cy.get('#wb-repositories-addRepositoryLink');
786
- }
787
-
788
- function createRepository() {
789
- getCreateRepositoryButton().click();
790
- }
791
-
792
- function getRepositoryTypeButton(type) {
793
- if (type) {
794
- return cy.get('#repository-type-' + type + '-btn');
795
- } else {
796
- return cy.get('.create-repo-btn').first();
797
- }
798
- }
799
-
800
- function chooseRepositoryType(type) {
801
- getRepositoryTypeButton(type).click();
802
- }
803
-
804
- function getRepositoriesDropdown() {
805
- return cy.get('#repositorySelectDropdown')
806
- .scrollIntoView()
807
- .should('be.visible');
808
- }
809
-
810
- function getRepositoryCreateForm() {
811
- return cy.get('#newRepoForm').should('be.visible');
812
- }
813
-
814
- function getRepositoryIdField() {
815
- return getRepositoryCreateForm().find('#id');
816
- }
817
-
818
- function typeRepositoryId(id) {
819
- getRepositoryIdField().type(id);
820
- }
821
-
822
- function getRepositoryTitleField() {
823
- return getRepositoryCreateForm().find('#title');
824
- }
825
-
826
- function typeRepositoryTitle(title) {
827
- getRepositoryTitleField().clear().type(title);
828
- }
829
-
830
- function getRepositoryRulesetMenu() {
831
- return getRepositoryCreateForm().find('#ruleset');
832
- }
833
-
834
- function getRepositoryDisableSameAsCheckbox() {
835
- return getRepositoryCreateForm().find('#disableSameAs');
836
- }
837
-
838
- function getRepositoryBaseURLField() {
839
- return getRepositoryCreateForm().find('#baseURL');
840
- }
841
-
842
- function typeRepositoryBaseURL(baseURL) {
843
- return getRepositoryBaseURLField().clear().type(baseURL);
844
- }
845
-
846
- function getRepositoryContextIndexCheckbox() {
847
- return getRepositoryCreateForm().find('#enableContextIndex');
848
- }
849
-
850
- function getRepositoryFtsCheckbox() {
851
- return getRepositoryCreateForm().find('#enableFtsIndex');
852
- }
853
-
854
- function getSaveRepositoryButton() {
855
- return cy.get('#addSaveRepository');
856
- }
857
-
858
- function saveRepository() {
859
- getSaveRepositoryButton().click();
860
- waitLoader();
861
- }
862
-
863
- function waitLoader() {
864
- cy.get('.ot-loader').should('not.be.visible');
865
- }
866
-
867
- function selectRepoFromDropdown(repositoryId) {
868
- getRepositoriesDropdown()
869
- .click()
870
- .find('.dropdown-menu-right .dropdown-item')
871
- .contains(repositoryId)
872
- .closest('a')
873
- // Force the click because Cypress sometimes determines that the item has 0x0 dimensions
874
- .click({force: true});
875
- }
876
-
877
- function confirmModal() {
878
- cy.get('.modal')
879
- .should('be.visible')
880
- .and('not.have.class', 'ng-animate')
881
- .find('.modal-footer .btn-primary')
882
- .click();
883
- }
884
-
885
- function getToast() {
886
- return cy.get('#toast-container');
887
- }
888
-
889
- function getRepositoryTypeDropdown() {
890
- return cy.get('#type');
891
- }
892
-
893
- function getOBDAFileField() {
894
- return cy.get('div').contains("OBDA or R2RML file*");
895
- }
896
-
897
- function getOntologyFileField() {
898
- return cy.get('div').contains("Ontology file");
899
- }
900
-
901
- function getPropertiesFileField() {
902
- return cy.get('div').contains("JDBC properties file*");
903
- }
904
-
905
- function getConstraintFileField() {
906
- return cy.get('div').contains("Constraint file");
907
- }
908
-
909
- function getOBDAUploadButton() {
910
- return cy.get('span[for="obdaFile"]').contains("Upload file...");
911
- }
912
-
913
- function getOntologyUploadButton() {
914
- return cy.get('span[for="owlFile"]').contains("Upload file...");
915
- }
916
-
917
- function getPropertiesUploadButton() {
918
- return cy.get('span[for="propertiesFile"]').contains("Upload file...");
919
- }
920
-
921
- function getConstraintUploadButton() {
922
- return cy.get('span[for="constraintFile"]').contains("Upload file...");
923
- }
924
-
925
- function getOntopFunctionalityDisabledMessage() {
926
- return cy.get('.repository-errors div.alert')
927
- .should('be', 'visible')
928
- .and('contain', 'Some functionalities are not available because')
929
- .and('contain', ' is read-only Virtual Repository');
930
- }
931
-
932
- function getOntopContentConfiguration() {
933
- return cy.get('#ontop-content');
934
- }
935
-
936
- function getDatabaseDriver(){
937
- return cy.get('#driverType');
938
- }
939
-
940
- function selectDatabaseDriver(driverType) {
941
- getDatabaseDriver()
942
- .select(driverType);
943
- }
944
-
945
- function testOntopConfigurationElementsVisibility(param, idValue) {
946
- getOntopContentConfiguration()
947
- .find('.row.indented-div label')
948
- .contains(param)
949
- .next()
950
- .within(() => {
951
- cy.get(idValue)
952
- .should('be.visible');
953
- });
954
- }
955
-
956
- function compareDriverDownloadUrl(expectedUrl){
957
- cy.get('.uri')
958
- .should('be.visible')
959
- .and('have.attr', 'href', expectedUrl);
960
- }
961
-
962
- function getSHACLRepositoryCheckbox(){
963
- return cy.get('#isShacl');
457
+ .then(($el) => $el)
458
+ .then(($el) => $el && $el.text() === status));
964
459
  }
965
460
  });