graphdb-workbench-tests 2.3.1 → 2.4.0-TR1

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 (88) 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/locale-en.json +18 -5
  4. package/fixtures/namespaces/ontotext-generated-namespace.json +22 -0
  5. package/fixtures/queries/empty-query-response.json +11 -0
  6. package/integration/explore/graphs.overview.spec.js +4 -2
  7. package/integration/explore/similariti-index-create.spec.js +315 -0
  8. package/integration/explore/similarity-index.spec.js +88 -0
  9. package/integration/explore/similarity.spec.js +156 -47
  10. package/integration/explore/visual-graph/graphs-config.spec.js +452 -0
  11. package/integration/explore/{visual.graph.spec.js → visual-graph/visual.graph.spec.js} +145 -348
  12. package/integration/home/language-change.spec.js +3 -3
  13. package/integration/import/import.user.data.spec.js +4 -4
  14. package/integration/resource/resource.spec.js +354 -0
  15. package/integration/setup/jdbc-create.spec.js +316 -0
  16. package/integration/setup/jdbc.spec.js +99 -178
  17. package/integration/setup/my-settings.spec.js +9 -41
  18. package/integration/setup/sparql-template-create.js +141 -0
  19. package/integration/setup/sparql-templates.spec.js +82 -146
  20. package/integration/sparql-editor/actions/execute-query.spec.js +44 -0
  21. package/integration/sparql-editor/actions/expand-results-over-sameas.spec.js +136 -0
  22. package/integration/sparql-editor/actions/include-inferred-statements.spec.js +100 -0
  23. package/integration/sparql-editor/actions/save-query.spec.js +70 -0
  24. package/integration/sparql-editor/actions/show-saved-queries.spec.js +61 -0
  25. package/integration/sparql-editor/internationalization.spec.js +41 -0
  26. package/integration/sparql-editor/saved-query/abort-query.spec.js +60 -0
  27. package/integration/sparql-editor/saved-query/delete-query.spec.js +56 -0
  28. package/integration/sparql-editor/saved-query/edit-query.spec.js +68 -0
  29. package/integration/sparql-editor/saved-query/share-query.spec.js +78 -0
  30. package/integration/sparql-editor/sparql-editor.spec.js +20 -0
  31. package/integration/sparql-editor/yasgui-tabs.spec.js +107 -0
  32. package/integration/sparql-editor/yasr/download-as.spec.js +62 -0
  33. package/integration/sparql-editor/yasr/pagination.spec.js +234 -0
  34. package/integration/sparql-editor/yasr/table-plugin.spec.js +191 -0
  35. package/integration/sparql-editor/yasr/toolbar/visual-button.spec.js +56 -0
  36. package/integration-flaky/setup/sparql-template-create.js +139 -0
  37. package/integration-flaky/sparql-editor/actions/execute-update-query.spec.js +89 -0
  38. package/integration-flaky/sparql-editor/actions/share-query.spec.js +84 -0
  39. package/integration-flaky/sparql-editor/lucene-connector.spec.js +62 -0
  40. package/package.json +3 -2
  41. package/steps/application-steps.js +23 -0
  42. package/steps/error-steps.js +9 -0
  43. package/steps/explore/graphs-overview-steps.js +24 -0
  44. package/steps/explore/similarity-index-create-steps.js +113 -0
  45. package/steps/explore/similarity-indexes-steps.js +18 -0
  46. package/steps/import-steps.js +8 -1
  47. package/steps/language-selector-steps.js +22 -0
  48. package/steps/loader-steps.js +10 -0
  49. package/steps/lucene-connector-steps.js +43 -0
  50. package/steps/main-menu-steps.js +39 -0
  51. package/steps/modal-dialog-steps.js +113 -0
  52. package/steps/repository-selector-steps.js +26 -0
  53. package/steps/resource/resource-edit-steps.js +111 -0
  54. package/steps/resource/resource-steps.js +145 -0
  55. package/steps/setup/jdbc-create-steps.js +97 -0
  56. package/steps/setup/jdbc-steps.js +42 -0
  57. package/steps/setup/sparql-create-update-steps.js +55 -0
  58. package/steps/setup/sparql-templates-steps.js +34 -0
  59. package/steps/sparql-editor-steps.js +20 -0
  60. package/steps/visual-graph-steps.js +340 -3
  61. package/steps/yasgui/confirmation-dialog-steps.js +13 -0
  62. package/steps/yasgui/pagination-steps.js +47 -0
  63. package/steps/yasgui/plugin/error-plugin-steps.js +10 -0
  64. package/steps/yasgui/save-query-dialog.js +61 -0
  65. package/steps/yasgui/saved-queries-dialog.js +29 -0
  66. package/steps/yasgui/saved-query.js +25 -0
  67. package/steps/yasgui/share-saved-query-dialog.js +25 -0
  68. package/steps/yasgui/table-plugin-steps.js +29 -0
  69. package/steps/yasgui/yasgui-steps.js +191 -0
  70. package/steps/yasgui/yasqe-steps.js +187 -0
  71. package/steps/yasgui/yasr-steps.js +105 -0
  72. package/stubs/namespace-stubs.js +10 -0
  73. package/stubs/security-stubs.js +69 -0
  74. package/stubs/yasgui/connectors-stubs.js +12 -0
  75. package/stubs/yasgui/query-stubs.js +258 -0
  76. package/support/index.js +2 -0
  77. package/support/repository-commands.js +6 -1
  78. package/support/sparql-commands.js +1 -1
  79. package/support/visual-graph-commands.js +25 -0
  80. package/integration/sparql/main.menu.spec.js +0 -196
  81. package/integration/sparql/sparql-error-handling.spec.js +0 -74
  82. package/integration/sparql/sparql-language-change.spec.js +0 -58
  83. package/integration/sparql/sparql-result-formating.spec.js +0 -84
  84. package/integration/sparql/sparql.menu.spec.js +0 -1244
  85. package/integration-flaky/setup/sparql-templates.spec.js +0 -125
  86. package/integration-flaky/sparql/sparql-language-change.spec.js +0 -45
  87. package/integration-flaky/sparql/sparql.menu.spec.js +0 -75
  88. package/steps/sparql-steps.js +0 -227
@@ -1,3 +1,11 @@
1
+ import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
2
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
3
+ import {YasrSteps} from "../../steps/yasgui/yasr-steps";
4
+ import {SimilarityIndexCreateSteps} from "../../steps/explore/similarity-index-create-steps";
5
+ import {SimilarityIndexesSteps} from "../../steps/explore/similarity-indexes-steps";
6
+ import {ModalDialogSteps, VerifyConfirmationDialogOptions} from "../../steps/modal-dialog-steps";
7
+ import {RepositorySelectorSteps} from "../../steps/repository-selector-steps";
8
+
1
9
  const INDEX_NAME = 'index-' + Date.now();
2
10
  const FILE_TO_IMPORT = 'people.zip';
3
11
  const INDEX_CREATE_URL = '/similarity/index/create';
@@ -27,6 +35,10 @@ const MODIFIED_ANALOGICAL_QUERY = 'PREFIX :<http://www.ontotext.com/graphdb/simi
27
35
  ' ?result :value ?resultValue;\n' +
28
36
  ' :score ?score .\n' +
29
37
  'OPTIONAL { ?result <http://dbpedia.org/ontology/birthPlace> ?birthDate . }}';
38
+ const MODIFIED_DATA_QUERY = 'SELECT ?documentID ?documentText { \n' +
39
+ '?documentID <http://dbpedia.org/ontology/birthDate> ?documentText . \n' +
40
+ 'filter(isLiteral(?documentText)) \n' +
41
+ '}order by asc(str(?documentID))';
30
42
 
31
43
  describe('Similarity screen validation', () => {
32
44
 
@@ -182,34 +194,30 @@ describe('Similarity screen validation', () => {
182
194
  searchIndex('Neal');
183
195
 
184
196
  // Then I expect search results to be displayed
185
- cy.get('.search-results').should('be.visible');
186
197
  // And showing 20 results
187
- cy.get('.resultsTable tbody tr').should('have.length', 20);
198
+ YasrSteps.getResults().should('have.length', 20);
188
199
  });
189
200
  });
190
201
 
191
202
  it('Disable and enable similarity plugin', () => {
203
+ const disableSimilarityPlugin = 'INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#stopplugin> \'similarity\' . }';
192
204
  initRepository();
205
+ cy.presetRepository(repositoryId);
193
206
 
194
- cy.visit('/sparql', {
195
- onBeforeLoad: (win) => {
196
- win.localStorage.setItem('com.ontotext.graphdb.repository', repositoryId);
197
- }
198
- });
199
- cy.window();
200
- waitUntilSparqlPageIsLoaded();
207
+ SparqlEditorSteps.visitSparqlEditorPage();
201
208
 
202
209
  // When I disable the plugin.
203
- disableSimilarityPlugin();
210
+ YasqeSteps.pasteQuery(disableSimilarityPlugin);
211
+ YasqeSteps.executeQuery();
204
212
 
205
213
  // Then I expect a message to be displayed confirming that operation is complete.
206
- cy.get('.update-info.alert-info').should('be.visible').and('contain', 'The number of statements did not change.');
214
+ YasrSteps.getResponseInfo().should('be.visible').and('contain', 'The number of statements did not change.');
207
215
 
208
216
  // When I try to disable it while it's disabled.
209
- disableSimilarityPlugin();
217
+ YasqeSteps.executeQuery();
210
218
 
211
219
  // Then I expect an error message to be displayed informing me that the plugin has been already disabled.
212
- cy.get('.update-info.alert-danger .plaintext').should('be.visible').and('contain', 'Plugin similarity has been already disabled');
220
+ YasrSteps.getErrorBody().should('be.visible').and('contain', 'Plugin similarity has been already disabled');
213
221
 
214
222
  // When I visit similarity view while the plugin is disabled.
215
223
  cy.visit('/similarity');
@@ -234,6 +242,119 @@ describe('Similarity screen validation', () => {
234
242
  });
235
243
  });
236
244
 
245
+ context('Confirmations when try to change location', () => {
246
+
247
+ beforeEach(() => {
248
+ initRepositoryAndVisitSimilarityView();
249
+ openCreateNewIndexForm();
250
+ });
251
+
252
+ it('should not display confirm message when there are not changes', () => {
253
+ // Given I opened the create similarity view.
254
+ // When I click on cancel button.
255
+ SimilarityIndexCreateSteps.cancel();
256
+
257
+ // Then I expect to be redirected to similarity indexes view.
258
+ SimilarityIndexesSteps.verifyUrl();
259
+
260
+ });
261
+
262
+ it('should display confirm message if index name is filled', () => {
263
+ // Given I opened the create similarity view,
264
+ // and similarity index name is filled.
265
+ SimilarityIndexCreateSteps.typeSimilarityIndexName('index');
266
+
267
+ // When click on cancel button.
268
+ // Then I expect to be redirected to similarity indexes view.
269
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
270
+ });
271
+
272
+ it('should display confirm message if data query is changed', () => {
273
+ // Given I opened the create similarity view,
274
+ // and data query is changed.
275
+ // During the initialization query is changed and this broke the test.
276
+ // Most the time the broken flow is:
277
+ // 1. cypress start to type 's';
278
+ // 2. query is changed
279
+ // 3. cypress continuous to type 'ome changes'.
280
+ // as result query is 'ome changes<data query>. YasqeSteps.writeInEditor function has check if parameter is filled, in our case 'some changes',
281
+ // and this broke the test. Add a little wait time to give chance yasqe query to be filled.
282
+ cy.wait(1000);
283
+ YasqeSteps.writeInEditor('some changes');
284
+
285
+ // When click on cancel button.
286
+ // Then I expect to be redirected to similarity indexes view.
287
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
288
+ });
289
+
290
+ it('should display confirm message if "Semantic Vectors create index parameters" is changed', () => {
291
+ // Given I opened the create similarity view,
292
+ // and "Semantic Vectors create index parameters" is changed.
293
+ SimilarityIndexCreateSteps.showMoreOptions();
294
+ SimilarityIndexCreateSteps.getSemanticVectorsInput().type('semantic vector');
295
+
296
+ // When click on cancel button.
297
+ // Then I expect to be redirected to similarity indexes view.
298
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
299
+ });
300
+
301
+ it('should display confirm message if "Stop words" is changed', () => {
302
+ // Given I opened the create similarity view,
303
+ // and "Stop words" is changed.
304
+ SimilarityIndexCreateSteps.showMoreOptions();
305
+ SimilarityIndexCreateSteps.getStopWordsInput().type('stop words');
306
+
307
+ // When click on cancel button.
308
+ // Then I expect to be redirected to similarity indexes view.
309
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
310
+ });
311
+
312
+ it('should display confirm message if "Analyzer Class" is changed', () => {
313
+ // Given I opened the create similarity view,
314
+ // and "Analyzer Class" is changed.
315
+ SimilarityIndexCreateSteps.showMoreOptions();
316
+ SimilarityIndexCreateSteps.getAnalyzerClassInput().type('BulgarianAnalyzer');
317
+
318
+ // When click on cancel button.
319
+ // Then I expect to be redirected to similarity indexes view.
320
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
321
+ });
322
+
323
+ it('should display confirm message if "Literal index" is changed', () => {
324
+ // Given I opened the create similarity view,
325
+ // and "Literal index" is changed.
326
+ SimilarityIndexCreateSteps.showMoreOptions();
327
+ SimilarityIndexCreateSteps.checkLiteralIndex();
328
+
329
+ // When click on cancel button.
330
+ // Then I expect to be redirected to similarity indexes view.
331
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
332
+ });
333
+
334
+ it('should display confirm message if "Search query" is changed', () => {
335
+ // Given I opened the create similarity view,
336
+ // and "Search query" is changed.
337
+ SimilarityIndexCreateSteps.switchToSearchQueryTab();
338
+ YasqeSteps.writeInEditor('some changes');
339
+
340
+ // When click on cancel button.
341
+ // Then I expect to be redirected to similarity indexes view.
342
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
343
+ });
344
+
345
+ it('should display confirm message if "Analogical query" is changed', () => {
346
+ // Given I opened the create similarity view,
347
+ // and "Analogical query" is changed.
348
+ SimilarityIndexCreateSteps.switchToCreatePredictionIndexTab();
349
+ SimilarityIndexCreateSteps.switchToAnalogicalQueryTab();
350
+ YasqeSteps.writeInEditor('some changes');
351
+
352
+ // When click on cancel button.
353
+ // Then I expect to be redirected to similarity indexes view.
354
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
355
+ });
356
+ });
357
+
237
358
  function initRepository() {
238
359
  repositoryId = 'similarity-repo-' + Date.now();
239
360
  cy.createRepository({id: repositoryId});
@@ -267,22 +388,6 @@ describe('Similarity screen validation', () => {
267
388
  getSearchIndexInput().closest('.input-group').find('.autocomplete-visual-btn').click();
268
389
  }
269
390
 
270
- function disableSimilarityPlugin() {
271
- const disableSimilarityPluginQuery = 'INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#stopplugin> \'similarity\' . }';
272
- cy.pasteQuery(disableSimilarityPluginQuery);
273
- cy.executeQuery();
274
- }
275
-
276
- function waitUntilSparqlPageIsLoaded() {
277
- // Workbench loading screen should not be visible
278
- cy.get('.ot-splash').should('not.be.visible');
279
-
280
- cy.waitUntilQueryIsVisible();
281
-
282
- // No active loader
283
- cy.get('.ot-loader-new-content').should('not.exist');
284
- }
285
-
286
391
  function checkSimilarityPageDefaultState() {
287
392
  //TODO: Should change the 'contain' method to 'eq' once GDB-3699 is fixed.
288
393
  cy.url().should('contain', Cypress.config('baseUrl') + '/similarity');
@@ -297,7 +402,7 @@ describe('Similarity screen validation', () => {
297
402
  cy.url().should('contain', `${Cypress.config('baseUrl')}/similarity/index/create`);
298
403
  // Wait for query editor to become ready because consecutive command for index creation might
299
404
  // fail because the query may not be submitted with the request.
300
- cy.waitUntilQueryIsVisible();
405
+ YasqeSteps.waitUntilQueryIsVisible();
301
406
  }
302
407
 
303
408
  function setIndexName() {
@@ -358,7 +463,7 @@ describe('Similarity screen validation', () => {
358
463
  cy.get('#create-predication-index').click();
359
464
  // Wait for query editor to become ready because consecutive command for index creation might
360
465
  // fail because the query may not be submitted with the request.
361
- cy.waitUntilQueryIsVisible();
466
+ YasqeSteps.waitUntilQueryIsVisible();
362
467
  }
363
468
 
364
469
  function cloneExistingIndex() {
@@ -411,29 +516,25 @@ describe('Similarity screen validation', () => {
411
516
  // Verify that 'similarity-index-name' input field is disabled
412
517
  getSimilarity().should('be.disabled');
413
518
  getSearchQueryTab().should('be.visible');
414
- let shouldAnalogicalTabBeVisible = (isPredication ? '' : 'not.') + 'be.visible';
519
+ YasqeSteps.waitUntilQueryIsVisible();
520
+ const shouldAnalogicalTabBeVisible = (isPredication ? '' : 'not.') + 'exist';
415
521
  getAnalogicalQueryTab().should(shouldAnalogicalTabBeVisible);
416
522
  if (isPredication) {
417
- cy.verifyQueryAreaContains('SELECT ?entity ?score {');
523
+ YasqeSteps.verifyQueryContains('SELECT ?entity ?score {');
418
524
  }
419
525
  }
420
526
 
421
527
  function changeDataQuery() {
422
- const MODIFIED_DATA_QUERY = 'SELECT ?documentID ?documentText { \n' +
423
- '?documentID <http://dbpedia.org/ontology/birthDate> ?documentText . \n' +
424
- 'filter(isLiteral(?documentText)) \n' +
425
- '}order by asc(str(?documentID))';
426
-
427
- cy.pasteQuery(MODIFIED_DATA_QUERY);
428
- cy.get('.test-query-btn').click();
528
+ YasqeSteps.pasteQuery(MODIFIED_DATA_QUERY);
529
+ cy.get('.test-query-btn', {force: true}).click();
429
530
  cy.get('.sparql-loader').should('not.exist');
430
- cy.get('.resultsTable').should('be.visible').find('tbody tr').its('length').should('be.gt', 1);
431
- cy.get('.uri-cell').eq(0).should('contain', 'http://dbpedia.org/resource/Aaron_Jay_Kernis');
531
+ YasrSteps.getResults().its('length').should('be.gt', 1);
532
+ YasrSteps.getResults().contains('http://dbpedia.org/resource/Aaron_Jay_Kernis');
432
533
  }
433
534
 
434
535
  function changeSearchQuery() {
435
- getSearchQueryTab().scrollIntoView().should('be.visible').click();
436
- cy.pasteQuery(MODIFIED_SEARCH_QUERY);
536
+ SimilarityIndexCreateSteps.switchToSearchQueryTab();
537
+ YasqeSteps.pasteQuery(MODIFIED_SEARCH_QUERY);
437
538
  }
438
539
 
439
540
  function changeAnalogicalQuery() {
@@ -441,7 +542,7 @@ describe('Similarity screen validation', () => {
441
542
  .scrollIntoView()
442
543
  .should('be.visible').click()
443
544
  .then(() => {
444
- cy.pasteQuery(MODIFIED_ANALOGICAL_QUERY);
545
+ YasqeSteps.pasteQuery(MODIFIED_ANALOGICAL_QUERY);
445
546
  });
446
547
  }
447
548
 
@@ -474,11 +575,19 @@ describe('Similarity screen validation', () => {
474
575
  }
475
576
 
476
577
  function waitForIndexBuildingIndicatorToHide() {
477
- cy.get('.similarity-index-building-loader').should('not.be.visible');
578
+ cy.get('.similarity-index-building-loader').should('not.exist');
478
579
  }
479
580
 
480
581
  function verifyQueryIsChanged() {
481
582
  const query = 'OPTIONAL { ?result <http://dbpedia.org/ontology/birthPlace> ?birthDate .';
482
- cy.verifyQueryAreaContains(query);
583
+ YasqeSteps.verifyQueryContains(query);
584
+ }
585
+
586
+ function createVerifyConfirmationDialogOptions() {
587
+ return new VerifyConfirmationDialogOptions()
588
+ .setChangePageFunction(() => SimilarityIndexCreateSteps.getCancelButton().click())
589
+ .setConfirmationMessage('You have unsaved changes. Are you sure that you want to exit?')
590
+ .setVerifyCurrentUrl(() => cy.url().should('include', `${Cypress.config('baseUrl')}/similarity/index/create`))
591
+ .setVerifyRedirectedUrl(() => cy.url().should('eq', `${Cypress.config('baseUrl')}/similarity`));
483
592
  }
484
593
  });