graphdb-workbench-tests 2.5.1 → 2.6.0-RC1

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 +44 -10
  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 +220 -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 +193 -35
  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
@@ -0,0 +1,88 @@
1
+ import {SimilarityIndexCreateSteps} from "../../steps/explore/similarity-index-create-steps";
2
+ import {RepositorySelectorSteps} from "../../steps/repository-selector-steps";
3
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
4
+ import {ModalDialogSteps, VerifyConfirmationDialogOptions} from "../../steps/modal-dialog-steps";
5
+ import {SimilarityIndexesSteps} from "../../steps/explore/similarity-indexes-steps";
6
+
7
+ const FILE_TO_IMPORT = 'people.zip';
8
+
9
+ describe('Confirmations when try to change repository', () => {
10
+
11
+ let secondRepositoryId;
12
+ let repositoryId;
13
+
14
+ beforeEach(() => {
15
+ const repositoryId = 'similarity-index-' + Date.now();
16
+ cy.createRepository({id: repositoryId});
17
+ cy.presetRepository(repositoryId);
18
+ cy.importServerFile(repositoryId, FILE_TO_IMPORT);
19
+ secondRepositoryId = 'create-similarity-index-second-repo' + Date.now();
20
+ cy.createRepository({id: secondRepositoryId});
21
+ SimilarityIndexCreateSteps.visit();
22
+ });
23
+
24
+ afterEach(() => {
25
+ cy.deleteRepository(repositoryId);
26
+ cy.deleteRepository(secondRepositoryId);
27
+ });
28
+
29
+ it('should not display confirm message if create similarity form is dirty and try to change repository', () => {
30
+ // Given I opened the create similarity view,
31
+ // and create similarity form is dirty.
32
+ SimilarityIndexCreateSteps.typeSimilarityIndexName('index name');
33
+
34
+ // When I change the repository.
35
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
36
+ // Then I expect to not be redirected to similarity indexes view.
37
+ SimilarityIndexCreateSteps.verifyUrl();
38
+ });
39
+
40
+ it('should display confirm message if edit similarity create form is dirty (Search query changed) and try to change repository', () => {
41
+ const similarityIndexName = 'SimilarityIndex';
42
+ YasqeSteps.waitUntilQueryIsVisible();
43
+ SimilarityIndexCreateSteps.typeSimilarityIndexName(similarityIndexName);
44
+ SimilarityIndexCreateSteps.create();
45
+ SimilarityIndexesSteps.getEditButton(similarityIndexName).click();
46
+
47
+ // Given I opened the edit similarity view,
48
+ // During the initialization query is changed and this broke the test.
49
+ // Most the time the broken flow is:
50
+ // 1. cypress start to type 's';
51
+ // 2. query is changed
52
+ // 3. cypress continuous to type 'ome changes'.
53
+ // as result query is 'ome changes<data query>. YasqeSteps.writeInEditor function has check if parameter is filled, in our case 'some changes',
54
+ // and this broke the test. Add a little wait time to give chance yasqe query to be filled.
55
+ cy.wait(1000);
56
+ // and change "Search query".
57
+ YasqeSteps.writeInEditor('some changes');
58
+
59
+ // When I try to change repository.
60
+ // Then I expect to be asked for confirmation to be redirected to similarity indexes view.
61
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
62
+ });
63
+
64
+ it('should display confirm message if edit similarity create form is dirty (Analogical query changed) and try to change repository', () => {
65
+ // Given I opened the edit similarity view,
66
+ const similarityIndexName = 'SimilarityIndex';
67
+ YasqeSteps.waitUntilQueryIsVisible();
68
+ SimilarityIndexCreateSteps.typeSimilarityIndexName(similarityIndexName);
69
+ SimilarityIndexCreateSteps.switchToCreatePredictionIndexTab();
70
+ SimilarityIndexCreateSteps.create();
71
+ SimilarityIndexesSteps.getEditButton(similarityIndexName).click();
72
+ // and change "Analogical query".
73
+ SimilarityIndexCreateSteps.switchToAnalogicalQueryTab();
74
+ YasqeSteps.writeInEditor('some changes');
75
+
76
+ // When I try to change repository.
77
+ // Then I expect to be asked for confirmation to be redirected to similarity indexes view.
78
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
79
+ });
80
+
81
+ function createVerifyConfirmationDialogOptions() {
82
+ return new VerifyConfirmationDialogOptions()
83
+ .setChangePageFunction(() => RepositorySelectorSteps.selectRepository(secondRepositoryId))
84
+ .setConfirmationMessage('You have unsaved changes. Are you sure that you want to exit?')
85
+ .setVerifyCurrentUrl(() => cy.url().should('include', `${Cypress.config('baseUrl')}/similarity/index/create`))
86
+ .setVerifyRedirectedUrl(() => cy.url().should('eq', `${Cypress.config('baseUrl')}/similarity`));
87
+ }
88
+ });
@@ -1,3 +1,12 @@
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
+ import {ErrorSteps} from "../../steps/error-steps";
9
+
1
10
  const INDEX_NAME = 'index-' + Date.now();
2
11
  const FILE_TO_IMPORT = 'people.zip';
3
12
  const INDEX_CREATE_URL = '/similarity/index/create';
@@ -27,6 +36,10 @@ const MODIFIED_ANALOGICAL_QUERY = 'PREFIX :<http://www.ontotext.com/graphdb/simi
27
36
  ' ?result :value ?resultValue;\n' +
28
37
  ' :score ?score .\n' +
29
38
  'OPTIONAL { ?result <http://dbpedia.org/ontology/birthPlace> ?birthDate . }}';
39
+ const MODIFIED_DATA_QUERY = 'SELECT ?documentID ?documentText { \n' +
40
+ '?documentID <http://dbpedia.org/ontology/birthDate> ?documentText . \n' +
41
+ 'filter(isLiteral(?documentText)) \n' +
42
+ '}order by asc(str(?documentID))';
30
43
 
31
44
  describe('Similarity screen validation', () => {
32
45
 
@@ -89,6 +102,20 @@ describe('Similarity screen validation', () => {
89
102
  checkLiteralIndex();
90
103
  createSimilarityIndex();
91
104
  });
105
+
106
+ it('Should not allow create similarity index with name that already exist', () => {
107
+ // If we have a similarity index.
108
+ openCreateNewIndexForm();
109
+ setIndexName();
110
+ createSimilarityIndex();
111
+
112
+ // When I try to create a similarity index with same name.
113
+ openCreateNewIndexForm();
114
+ setIndexName();
115
+ getCreateIndexButton().click();
116
+ // Then I expect an error message to be displayed that describes me, that name is mandatory.
117
+ ErrorSteps.verifyError('Index with this name already exists.');
118
+ });
92
119
  });
93
120
 
94
121
  context('Index operations', () => {
@@ -182,34 +209,35 @@ describe('Similarity screen validation', () => {
182
209
  searchIndex('Neal');
183
210
 
184
211
  // Then I expect search results to be displayed
185
- cy.get('.search-results').should('be.visible');
186
212
  // And showing 20 results
187
- cy.get('.resultsTable tbody tr').should('have.length', 20);
213
+ YasrSteps.getResults().should('have.length', 20);
188
214
  });
189
215
  });
190
216
 
191
- it('Disable and enable similarity plugin', () => {
217
+ it('Disable and enable similarity plugin', {
218
+ retries: {
219
+ openMode: 0,
220
+ runMode: 2
221
+ }
222
+ }, () => {
223
+ const disableSimilarityPlugin = 'INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#stopplugin> \'similarity\' . }';
192
224
  initRepository();
225
+ cy.presetRepository(repositoryId);
193
226
 
194
- cy.visit('/sparql', {
195
- onBeforeLoad: (win) => {
196
- win.localStorage.setItem('ls.repository-id', repositoryId);
197
- }
198
- });
199
- cy.window();
200
- waitUntilSparqlPageIsLoaded();
227
+ SparqlEditorSteps.visitSparqlEditorPage();
201
228
 
202
229
  // When I disable the plugin.
203
- disableSimilarityPlugin();
230
+ YasqeSteps.pasteQuery(disableSimilarityPlugin);
231
+ YasqeSteps.executeQuery();
204
232
 
205
233
  // 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.');
234
+ YasrSteps.getResponseInfo().should('be.visible').and('contain', 'The number of statements did not change.');
207
235
 
208
236
  // When I try to disable it while it's disabled.
209
- disableSimilarityPlugin();
237
+ YasqeSteps.executeErrorQuery();
210
238
 
211
239
  // 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');
240
+ YasrSteps.getErrorBody().should('be.visible').and('contain', 'Plugin similarity has been already disabled');
213
241
 
214
242
  // When I visit similarity view while the plugin is disabled.
215
243
  cy.visit('/similarity');
@@ -217,7 +245,7 @@ describe('Similarity screen validation', () => {
217
245
 
218
246
  // Then I expect a message to be displayed informing me that the plugin is disabled.
219
247
  cy.get('.plugin-not-active-warning').should('be.visible').and('contain', 'Similarity Plugin is not active for this repository.');
220
-
248
+ // cy.pause()
221
249
  // When I enable the plugin
222
250
  cy.get('.confirm-btn')
223
251
  .should('be.visible')
@@ -229,11 +257,125 @@ describe('Similarity screen validation', () => {
229
257
  .click()
230
258
  .then(() => {
231
259
  // Then I expect default similarity view with no indexes available
260
+ // cy.pause()
232
261
  checkSimilarityPageDefaultState();
233
262
  });
234
263
  });
235
264
  });
236
265
 
266
+ context('Confirmations when try to change location', () => {
267
+
268
+ beforeEach(() => {
269
+ initRepositoryAndVisitSimilarityView();
270
+ openCreateNewIndexForm();
271
+ });
272
+
273
+ it('should not display confirm message when there are not changes', () => {
274
+ // Given I opened the create similarity view.
275
+ // When I click on cancel button.
276
+ SimilarityIndexCreateSteps.cancel();
277
+
278
+ // Then I expect to be redirected to similarity indexes view.
279
+ SimilarityIndexesSteps.verifyUrl();
280
+
281
+ });
282
+
283
+ it('should display confirm message if index name is filled', () => {
284
+ // Given I opened the create similarity view,
285
+ // and similarity index name is filled.
286
+ SimilarityIndexCreateSteps.typeSimilarityIndexName('index');
287
+
288
+ // When click on cancel button.
289
+ // Then I expect to be redirected to similarity indexes view.
290
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
291
+ });
292
+
293
+ it('should display confirm message if data query is changed', () => {
294
+ // Given I opened the create similarity view,
295
+ // and data query is changed.
296
+ // During the initialization query is changed and this broke the test.
297
+ // Most the time the broken flow is:
298
+ // 1. cypress start to type 's';
299
+ // 2. query is changed
300
+ // 3. cypress continuous to type 'ome changes'.
301
+ // as result query is 'ome changes<data query>. YasqeSteps.writeInEditor function has check if parameter is filled, in our case 'some changes',
302
+ // and this broke the test. Add a little wait time to give chance yasqe query to be filled.
303
+ cy.wait(1000);
304
+ YasqeSteps.writeInEditor('some changes');
305
+
306
+ // When click on cancel button.
307
+ // Then I expect to be redirected to similarity indexes view.
308
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
309
+ });
310
+
311
+ it('should display confirm message if "Semantic Vectors create index parameters" is changed', () => {
312
+ // Given I opened the create similarity view,
313
+ // and "Semantic Vectors create index parameters" is changed.
314
+ SimilarityIndexCreateSteps.showMoreOptions();
315
+ SimilarityIndexCreateSteps.getSemanticVectorsInput().type('semantic vector');
316
+
317
+ // When click on cancel button.
318
+ // Then I expect to be redirected to similarity indexes view.
319
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
320
+ });
321
+
322
+ it('should display confirm message if "Stop words" is changed', () => {
323
+ // Given I opened the create similarity view,
324
+ // and "Stop words" is changed.
325
+ SimilarityIndexCreateSteps.showMoreOptions();
326
+ SimilarityIndexCreateSteps.getStopWordsInput().type('stop words');
327
+
328
+ // When click on cancel button.
329
+ // Then I expect to be redirected to similarity indexes view.
330
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
331
+ });
332
+
333
+ it('should display confirm message if "Analyzer Class" is changed', () => {
334
+ // Given I opened the create similarity view,
335
+ // and "Analyzer Class" is changed.
336
+ SimilarityIndexCreateSteps.showMoreOptions();
337
+ SimilarityIndexCreateSteps.getAnalyzerClassInput().type('BulgarianAnalyzer');
338
+
339
+ // When click on cancel button.
340
+ // Then I expect to be redirected to similarity indexes view.
341
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
342
+ });
343
+
344
+ it('should display confirm message if "Literal index" is changed', () => {
345
+ // Given I opened the create similarity view,
346
+ // and "Literal index" is changed.
347
+ SimilarityIndexCreateSteps.showMoreOptions();
348
+ SimilarityIndexCreateSteps.checkLiteralIndex();
349
+
350
+ // When click on cancel button.
351
+ // Then I expect to be redirected to similarity indexes view.
352
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
353
+ });
354
+
355
+ it('should display confirm message if "Search query" is changed', () => {
356
+ // Given I opened the create similarity view,
357
+ // and "Search query" is changed.
358
+ SimilarityIndexCreateSteps.switchToSearchQueryTab();
359
+ YasqeSteps.writeInEditor('some changes');
360
+
361
+ // When click on cancel button.
362
+ // Then I expect to be redirected to similarity indexes view.
363
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
364
+ });
365
+
366
+ it('should display confirm message if "Analogical query" is changed', () => {
367
+ // Given I opened the create similarity view,
368
+ // and "Analogical query" is changed.
369
+ SimilarityIndexCreateSteps.switchToCreatePredictionIndexTab();
370
+ SimilarityIndexCreateSteps.switchToAnalogicalQueryTab();
371
+ YasqeSteps.writeInEditor('some changes');
372
+
373
+ // When click on cancel button.
374
+ // Then I expect to be redirected to similarity indexes view.
375
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
376
+ });
377
+ });
378
+
237
379
  function initRepository() {
238
380
  repositoryId = 'similarity-repo-' + Date.now();
239
381
  cy.createRepository({id: repositoryId});
@@ -267,23 +409,6 @@ describe('Similarity screen validation', () => {
267
409
  getSearchIndexInput().closest('.input-group').find('.autocomplete-visual-btn').click();
268
410
  }
269
411
 
270
- function disableSimilarityPlugin() {
271
- const disableSimilarityPluginQuery = 'INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#stopplugin> \'similarity\' . }';
272
- cy.waitUntilQueryIsVisible();
273
- cy.pasteQuery(disableSimilarityPluginQuery);
274
- cy.executeQuery();
275
- }
276
-
277
- function waitUntilSparqlPageIsLoaded() {
278
- // Workbench loading screen should not be visible
279
- cy.get('.ot-splash').should('not.be.visible');
280
-
281
- cy.waitUntilQueryIsVisible();
282
-
283
- // No active loader
284
- cy.get('.ot-loader-new-content').should('not.exist');
285
- }
286
-
287
412
  function checkSimilarityPageDefaultState() {
288
413
  //TODO: Should change the 'contain' method to 'eq' once GDB-3699 is fixed.
289
414
  cy.url().should('contain', Cypress.config('baseUrl') + '/similarity');
@@ -298,7 +423,7 @@ describe('Similarity screen validation', () => {
298
423
  cy.url().should('contain', `${Cypress.config('baseUrl')}/similarity/index/create`);
299
424
  // Wait for query editor to become ready because consecutive command for index creation might
300
425
  // fail because the query may not be submitted with the request.
301
- cy.waitUntilQueryIsVisible();
426
+ YasqeSteps.waitUntilQueryIsVisible();
302
427
  }
303
428
 
304
429
  function setIndexName() {
@@ -359,7 +484,7 @@ describe('Similarity screen validation', () => {
359
484
  cy.get('#create-predication-index').click();
360
485
  // Wait for query editor to become ready because consecutive command for index creation might
361
486
  // fail because the query may not be submitted with the request.
362
- cy.waitUntilQueryIsVisible();
487
+ YasqeSteps.waitUntilQueryIsVisible();
363
488
  }
364
489
 
365
490
  function cloneExistingIndex() {
@@ -368,7 +493,7 @@ describe('Similarity screen validation', () => {
368
493
  .then(() => cy.url().should('contain', `${Cypress.config('baseUrl')}/similarity/index/create`));
369
494
 
370
495
  // Makes sure YASQE has loaded before we click the Create button
371
- cy.waitUntilQueryIsVisible();
496
+ YasqeSteps.waitUntilQueryIsVisible();
372
497
  getCreateIndexButton().should('be.visible').click();
373
498
 
374
499
  getExistingIndexesPanel();
@@ -409,32 +534,25 @@ describe('Similarity screen validation', () => {
409
534
  // Verify that 'similarity-index-name' input field is disabled
410
535
  getSimilarity().should('be.disabled');
411
536
  getSearchQueryTab().should('be.visible');
412
- let shouldAnalogicalTabBeVisible = (isPredication ? '' : 'not.') + 'be.visible';
537
+ YasqeSteps.waitUntilQueryIsVisible();
538
+ const shouldAnalogicalTabBeVisible = (isPredication ? '' : 'not.') + 'exist';
413
539
  getAnalogicalQueryTab().should(shouldAnalogicalTabBeVisible);
414
540
  if (isPredication) {
415
- cy.waitUntilQueryIsVisible();
416
- cy.verifyQueryAreaContains('SELECT ?entity ?score {');
541
+ YasqeSteps.verifyQueryContains('SELECT ?entity ?score {');
417
542
  }
418
543
  }
419
544
 
420
545
  function changeDataQuery() {
421
- const MODIFIED_DATA_QUERY = 'SELECT ?documentID ?documentText { \n' +
422
- '?documentID <http://dbpedia.org/ontology/birthDate> ?documentText . \n' +
423
- 'filter(isLiteral(?documentText)) \n' +
424
- '}order by asc(str(?documentID))';
425
-
426
- cy.waitUntilQueryIsVisible();
427
- cy.pasteQuery(MODIFIED_DATA_QUERY);
428
- cy.get('.test-query-btn').click();
546
+ YasqeSteps.pasteQuery(MODIFIED_DATA_QUERY);
547
+ cy.get('.test-query-btn', {force: true}).click();
429
548
  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');
549
+ YasrSteps.getResults().its('length').should('be.gt', 1);
550
+ YasrSteps.getResults().contains('http://dbpedia.org/resource/Aaron_Jay_Kernis');
432
551
  }
433
552
 
434
553
  function changeSearchQuery() {
435
- getSearchQueryTab().scrollIntoView().should('be.visible').click();
436
- cy.waitUntilQueryIsVisible();
437
- cy.pasteQuery(MODIFIED_SEARCH_QUERY);
554
+ SimilarityIndexCreateSteps.switchToSearchQueryTab();
555
+ YasqeSteps.pasteQuery(MODIFIED_SEARCH_QUERY);
438
556
  }
439
557
 
440
558
  function changeAnalogicalQuery() {
@@ -442,8 +560,7 @@ describe('Similarity screen validation', () => {
442
560
  .scrollIntoView()
443
561
  .should('be.visible').click()
444
562
  .then(() => {
445
- cy.waitUntilQueryIsVisible();
446
- cy.pasteQuery(MODIFIED_ANALOGICAL_QUERY);
563
+ YasqeSteps.pasteQuery(MODIFIED_ANALOGICAL_QUERY);
447
564
  });
448
565
  }
449
566
 
@@ -476,12 +593,19 @@ describe('Similarity screen validation', () => {
476
593
  }
477
594
 
478
595
  function waitForIndexBuildingIndicatorToHide() {
479
- cy.get('.similarity-index-building-loader').should('not.be.visible');
596
+ cy.get('.similarity-index-building-loader').should('not.exist');
480
597
  }
481
598
 
482
599
  function verifyQueryIsChanged() {
483
600
  const query = 'OPTIONAL { ?result <http://dbpedia.org/ontology/birthPlace> ?birthDate .';
484
- cy.waitUntilQueryIsVisible();
485
- cy.verifyQueryAreaContains(query);
601
+ YasqeSteps.verifyQueryContains(query);
602
+ }
603
+
604
+ function createVerifyConfirmationDialogOptions() {
605
+ return new VerifyConfirmationDialogOptions()
606
+ .setChangePageFunction(() => SimilarityIndexCreateSteps.getCancelButton().click())
607
+ .setConfirmationMessage('You have unsaved changes. Are you sure that you want to exit?')
608
+ .setVerifyCurrentUrl(() => cy.url().should('include', `${Cypress.config('baseUrl')}/similarity/index/create`))
609
+ .setVerifyRedirectedUrl(() => cy.url().should('eq', `${Cypress.config('baseUrl')}/similarity`));
486
610
  }
487
611
  });