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
@@ -1,1253 +0,0 @@
1
- import ImportSteps from '../../steps/import-steps';
2
- import SparqlSteps from '../../steps/sparql-steps';
3
-
4
- const FILE_TO_IMPORT = 'wine.rdf';
5
- const RDF_STAR_FILE_TO_IMPORT = 'turtlestar-data.ttls';
6
-
7
- describe('SPARQL screen validation', () => {
8
- let repositoryId;
9
-
10
- const EDIT_SAVED_QUERY_COMMAND = '.icon-edit';
11
- const DELETE_SAVED_QUERY_COMMAND = '.icon-trash';
12
- const OPEN_SAVED_QUERY_COMMAND = '.icon-link';
13
-
14
- const DEFAULT_QUERY = 'select * where { \n' +
15
- '\t?s ?p ?o .\n' +
16
- '} limit 100';
17
-
18
- const DEFAULT_QUERY_MODIFIED = 'prefix spif: <http://spinrdf.org/spif#> select * {?x spif:for (1 2000)} limit 1001';
19
-
20
- const SPARQL_STAR_QUERY = 'select (<<?s ?p ?o>> as ?t) {?s ?p ?o}';
21
-
22
- const GATE_CLIENT_CREATE_QUERY = 'PREFIX : <http://www.ontotext.com/textmining#>\n' +
23
- 'PREFIX inst: <http://www.ontotext.com/textmining/instance#>\n' +
24
- 'INSERT DATA {\n' +
25
- ' inst:gateService :connect :Gate;\n' +
26
- ' :service "https://cloud-api.gate.ac.uk/process-document/annie-named-entity-recognizer?annotations=:Address&annotations=:Date&annotations=:Location&annotations=:Organization&annotations=:Person&annotations=:Money&annotations=:Percent&annotations=:Sentence" .\n' +
27
- '}';
28
-
29
- const GATE_CLIENT_SEARCH_QUERY = 'PREFIX : <http://www.ontotext.com/textmining#>\n' +
30
- 'PREFIX inst: <http://www.ontotext.com/textmining/instance#>\n' +
31
- 'SELECT ?annotationText ?annotationType ?annotationStart ?annotationEnd ?feature ?value\n' +
32
- 'WHERE {\n' +
33
- ' ?searchDocument a inst:gateService;\n' +
34
- ' :text \'\'\'Dyson Ltd. plans to hire 450 people globally, with more than half the recruits in its headquarters in Singapore.\n' +
35
- 'The company best known for its vacuum cleaners and hand dryers will add 250 engineers in the city-state. This comes short before the founder James Dyson announced he is moving back to the UK after moving residency to Singapore. Dyson, a prominent Brexit supporter who is worth US$29 billion, faced criticism from British lawmakers for relocating his company\'\'\' .\n' +
36
- '\n' +
37
- ' graph inst:gateService {\n' +
38
- ' ?annotatedDocument :annotations ?annotation .\n' +
39
- '\n' +
40
- ' ?annotation :annotationText ?annotationText ;\n' +
41
- ' :annotationType ?annotationType ;\n' +
42
- ' :annotationStart ?annotationStart ;\n' +
43
- ' :annotationEnd ?annotationEnd ;\n' +
44
- ' optional { ?annotation :features ?item . ?item ?feature ?value }\n' +
45
- ' }\n' +
46
- '}';
47
-
48
- const LIST_TEXT_MINING_SERVICES = 'PREFIX : <http://www.ontotext.com/textmining#>\n' +
49
- 'PREFIX inst: <http://www.ontotext.com/textmining/instance#>\n' +
50
- 'SELECT * where {\n' +
51
- ' ?instance a :Service .\n' +
52
- '}';
53
-
54
- const LIST_TEXT_MINING_INSTANCE_CONFIG = 'PREFIX : <http://www.ontotext.com/textmining#>\n' +
55
- 'PREFIX inst: <http://www.ontotext.com/textmining/instance#>\n' +
56
- 'SELECT * WHERE {\n' +
57
- ' inst:gateService ?p ?o .\n' +
58
- '}';
59
-
60
- const DROP_TEXT_MINING_INSTANCE = 'PREFIX : <http://www.ontotext.com/textmining#>\n' +
61
- 'PREFIX inst: <http://www.ontotext.com/textmining/instance#>\n' +
62
- 'INSERT DATA {\n' +
63
- ' inst:gateService :dropService "".\n' +
64
- '}';
65
-
66
- afterEach(() => {
67
- cy.deleteRepository(repositoryId);
68
- });
69
-
70
- context('SPARQL queries & filtering', () => {
71
- beforeEach(() => {
72
- repositoryId = 'sparql-' + Date.now();
73
- SparqlSteps.createRepoAndVisit(repositoryId)
74
- });
75
-
76
- it('Test execute default query', () => {
77
- SparqlSteps.getTabs().should('have.length', 1);
78
-
79
- verifyQueryAreaEquals(DEFAULT_QUERY);
80
-
81
- // No queries should have been run for this tab
82
- SparqlSteps.getNoQueryRunInfo().should('be.visible');
83
-
84
- SparqlSteps.executeQuery();
85
-
86
- verifyResultsPageLength(70);
87
- });
88
-
89
- it('Test modify default query', () => {
90
- // Run custom query returning 1001 results
91
- SparqlSteps.typeQuery(DEFAULT_QUERY_MODIFIED);
92
-
93
- verifyQueryAreaEquals(DEFAULT_QUERY_MODIFIED);
94
-
95
- // Verify pasting also works
96
- cy.pasteQuery(DEFAULT_QUERY_MODIFIED);
97
-
98
- SparqlSteps.executeQuery();
99
-
100
- getResultPages().should('have.length', 2);
101
-
102
- verifyResultsPageLength(1000);
103
-
104
- goToPage(2);
105
-
106
- verifyResultsPageLength(1);
107
- });
108
-
109
- it('Test execute sparqlstar query', () => {
110
- cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
111
-
112
- SparqlSteps.typeQuery(SPARQL_STAR_QUERY);
113
-
114
- verifyQueryAreaEquals(SPARQL_STAR_QUERY);
115
-
116
- SparqlSteps.executeQuery();
117
-
118
- getResultPages().should('have.length', 1);
119
-
120
- verifyResultsPageLength(104);
121
-
122
- SparqlSteps.getTableResultRows().should('contain', '<<');
123
-
124
- SparqlSteps.getTableResultRows().should('contain', 'http://bigdata.com/RDF#bob');
125
- });
126
-
127
- it('Test execute sparqlstar select with bind query', () => {
128
- cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
129
-
130
- let selectQuery = 'select * {bind (<<?s ?p ?o>> as ?t) .}';
131
-
132
- SparqlSteps.typeQuery(selectQuery);
133
-
134
- verifyQueryAreaEquals(selectQuery);
135
-
136
- SparqlSteps.executeQuery();
137
-
138
- getResultPages().should('have.length', 1);
139
-
140
- verifyResultsPageLength(3);
141
-
142
- SparqlSteps.getTableResultRows().should('contain', '<<');
143
-
144
- SparqlSteps.getTableResultRows().should('contain', 'http://bigdata.com/RDF#bob');
145
- });
146
-
147
- it('Test execute sparqlstar insert query', () => {
148
- cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
149
-
150
- let insertQuery = 'insert data {<<<urn:a> <urn:p> 1>> <urn:x> 2}';
151
-
152
- SparqlSteps.typeQuery(insertQuery);
153
-
154
- verifyQueryAreaEquals(insertQuery);
155
-
156
- SparqlSteps.executeQuery();
157
-
158
- getUpdateMessage()
159
- .should('be.visible')
160
- .and('contain', 'Added 1 statements');
161
-
162
- getResultPages().should('have.length', 1);
163
- });
164
-
165
- it('Test execute sparqlstar select searching for inserted results', () => {
166
- cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
167
-
168
- let selectQuery = "PREFIX bd: <http://bigdata.com/RDF#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
169
- "select * where {<<bd:bob foaf:mbox <mailto:bob@home>>> ?p ?o .}";
170
-
171
- SparqlSteps.typeQuery(selectQuery);
172
-
173
- verifyQueryAreaEquals(selectQuery);
174
-
175
- SparqlSteps.executeQuery();
176
-
177
- getResultPages().should('have.length', 1);
178
-
179
- verifyResultsPageLength(4);
180
-
181
- SparqlSteps.getTableResultRows().should('contain', 'http://hr.example.com/employees/bob');
182
- });
183
-
184
- it('Test execute sparqlstar delete query and search for deleted triple', () => {
185
- cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
186
-
187
- let deleteQuery = "PREFIX bd: <http://bigdata.com/RDF#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
188
- "PREFIX dc: <http://purl.org/dc/terms/>\nPREFIX re: <http://reasoner.example.com/engines#>\n" +
189
- "delete data {<<bd:alice foaf:knows bd:bob>> dc:source re:engine_1.}";
190
-
191
- SparqlSteps.typeQuery(deleteQuery);
192
-
193
- verifyQueryAreaEquals(deleteQuery);
194
-
195
- SparqlSteps.executeQuery();
196
-
197
- getUpdateMessage()
198
- .should('be.visible')
199
- .and('contain', 'Removed 1 statements');
200
-
201
- getResultPages().should('have.length', 1);
202
-
203
- let selectQuery = "PREFIX bd: <http://bigdata.com/RDF#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
204
- "PREFIX dc: <http://purl.org/dc/terms/>\nPREFIX re: <http://reasoner.example.com/engines#>\n" +
205
- "select * where {<<bd:alice foaf:knows bd:bob>> dc:source re:engine_1.}";
206
-
207
- SparqlSteps.typeQuery(selectQuery);
208
-
209
- verifyQueryAreaEquals(selectQuery);
210
-
211
- SparqlSteps.executeQuery();
212
-
213
- getResultPages().should('have.length', 1);
214
-
215
- //verifyResultsPageLength(1);
216
-
217
- cy.get('.results-info .results-description')
218
- .should('be.visible')
219
- .and('contain', 'No results');
220
-
221
- });
222
-
223
- it('Test execute (Describe with bind) sparqlstar query', () => {
224
- cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
225
-
226
- let describeQuery = 'describe ?t {bind (<<?s ?p ?o>> as ?t) .}';
227
-
228
- cy.waitUntilQueryIsVisible();
229
- cy.pasteQuery(describeQuery);
230
-
231
- SparqlSteps.executeQuery();
232
-
233
- cy.verifyResultsMessage('Showing results');
234
- cy.verifyResultsMessage('Query took');
235
-
236
- SparqlSteps.getResultsWrapper()
237
- .should('be.visible');
238
-
239
- getResultPages().should('have.length', 1);
240
- verifyResultsPageLength(9);
241
-
242
- SparqlSteps.getTableResultRows().should('contain', '<<');
243
-
244
- SparqlSteps.getTableResultRows().should('contain', 'http://bigdata.com/RDF#bob');
245
-
246
- // Confirm that all tabs Raw Response, Pivot Table, Google chart are enabled
247
- getTableResponseButton().should('be.visible').and('not.be.disabled');
248
- getRawResponseButton().should('be.visible').and('not.be.disabled');
249
- getPivotTableButton().should('be.visible').and('not.be.disabled');
250
- getGoogleChartButton().should('be.visible').and('not.be.disabled');
251
- });
252
-
253
- it('Should check for XML star download format', () => {
254
- cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
255
-
256
- SparqlSteps.typeQuery(SPARQL_STAR_QUERY);
257
-
258
- verifyQueryAreaEquals(SPARQL_STAR_QUERY);
259
-
260
- SparqlSteps.executeQuery();
261
-
262
- getResultPages().should('have.length', 1);
263
-
264
- cy.get('.saveAsDropDown').click().within(() => {
265
- cy.get('.dropdown-menu')
266
- .should('be.visible')
267
- .and('contain', 'XML*');
268
- });
269
- });
270
-
271
-
272
- it('Test filter query results', () => {
273
- cy.importServerFile(repositoryId, FILE_TO_IMPORT);
274
-
275
- SparqlSteps.executeQuery();
276
-
277
- // In the search field below the SPARQL editor enter 'White'
278
- getResultFilterField()
279
- .should('have.value', '')
280
- .type('White')
281
- .should('have.value', 'White');
282
-
283
- // Verify that 6 results containing ''White'' are displayed
284
- verifyResultsPageLength(6);
285
- });
286
-
287
- it('Test execute queries with prefixes', () => {
288
- cy.fixture('queries/prefix-query.sparql').then(prefixQuery => {
289
- // Yasqe blows when inserting prefixes for some reason....
290
- disableExceptions();
291
-
292
- SparqlSteps.typeQuery(prefixQuery);
293
- });
294
-
295
- // Should have inserted the prefixes
296
- verifyQueryAreaContains('PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>');
297
- verifyQueryAreaContains('PREFIX owl: <http://www.w3.org/2002/07/owl#>');
298
-
299
- SparqlSteps.executeQuery();
300
-
301
- cy.getResultsMessage();
302
- SparqlSteps.getResultsWrapper()
303
- .should('be.visible');
304
- });
305
-
306
- it('Test execute (Describe) query', () => {
307
- let describeQuery = 'DESCRIBE <http://www.ontotext.com/SYSINFO> FROM <http://www.ontotext.com/SYSINFO>';
308
-
309
- cy.waitUntilQueryIsVisible();
310
- cy.pasteQuery(describeQuery);
311
-
312
- SparqlSteps.executeQuery();
313
-
314
- cy.verifyResultsMessage('Showing results')
315
- cy.verifyResultsMessage('Query took');
316
- SparqlSteps.getResultsWrapper()
317
- .should('be.visible');
318
-
319
- // Confirm that all tabs Raw Response, Pivot Table, Google chart are enabled
320
- getTableResponseButton().should('be.visible').and('not.be.disabled');
321
- getRawResponseButton().should('be.visible').and('not.be.disabled');
322
- getPivotTableButton().should('be.visible').and('not.be.disabled');
323
- getGoogleChartButton().should('be.visible').and('not.be.disabled');
324
-
325
- openDownloadAsMenu();
326
-
327
- getDownloadAsFormatButtons()
328
- .should('have.length', 13)
329
- .contains('JSON-LD')
330
- .should('have.attr', 'data-accepts')
331
- .and('include', 'application/ld+json')
332
- });
333
-
334
- it('Test execute (ASK) query', () => {
335
- let askQuery = 'ASK WHERE { ?s ?p ?o .FILTER (regex(?o, "ontotext.com")) }';
336
-
337
- cy.waitUntilQueryIsVisible();
338
- cy.pasteQuery(askQuery);
339
- SparqlSteps.executeQuery();
340
-
341
- // Confirm that all tabs (Table, Pivot Table, Google chart) are disabled
342
- getTableResponseButton().should('not.be.visible');
343
- getRawResponseButton().should('not.be.visible');
344
- getPivotTableButton().should('not.be.visible');
345
- getGoogleChartButton().should('not.be.visible');
346
-
347
- getBooleanResult().should('be.visible').and('contain', 'NO');
348
- });
349
-
350
- // This test depends on external service http://factforge.net/repositories/ff-news which can occasionally fail.
351
- it.skip('Test execute (CONSTRUCT) query', () => {
352
- cy.fixture('queries/construct-query.sparql').then(constructQuery => {
353
- cy.waitUntilQueryIsVisible();
354
- cy.pasteQuery(constructQuery);
355
- });
356
-
357
- SparqlSteps.executeQuery();
358
-
359
- cy.getResultsMessage();
360
- SparqlSteps.getResultsWrapper()
361
- .should('be.visible');
362
-
363
- // Confirm that all tabs (Table, Pivot Table, Google chart) are disabled
364
- getTableResponseButton().should('be.visible').and('not.be.disabled');
365
- getRawResponseButton().should('be.visible').and('not.be.disabled');
366
- getPivotTableButton().should('be.visible').and('not.be.disabled');
367
- getGoogleChartButton().should('be.visible').and('not.be.disabled');
368
-
369
- openRawResponse();
370
- getResultsDownloadButton().should('be.visible').and('not.be.disabled');
371
- });
372
-
373
- it('should test text mining plugin', () => {
374
- cy.waitUntilQueryIsVisible();
375
- cy.pasteQuery(GATE_CLIENT_CREATE_QUERY);
376
- cy.executeQuery();
377
- cy.pasteQuery(GATE_CLIENT_SEARCH_QUERY);
378
- cy.executeQuery();
379
- getResultPages().should('have.length', 1);
380
- verifyResultsPageLength(44);
381
- cy.pasteQuery(LIST_TEXT_MINING_SERVICES);
382
- cy.executeQuery();
383
- SparqlSteps.getTableResultRows().should('contain', 'http://www.ontotext.com/textmining/instance#gateService');
384
- cy.pasteQuery(LIST_TEXT_MINING_INSTANCE_CONFIG);
385
- cy.executeQuery();
386
- SparqlSteps.getTableResultRows().should('contain', 'http://www.ontotext.com/textmining#Gate');
387
- SparqlSteps.getTableResultRows().should('contain', 'http://www.ontotext.com/textmining#connect');
388
- SparqlSteps.getTableResultRows().should('contain', 'https://cloud-api.gate.ac.uk');
389
- cy.pasteQuery(DROP_TEXT_MINING_INSTANCE);
390
- cy.executeQuery();
391
- cy.pasteQuery(LIST_TEXT_MINING_SERVICES);
392
- cy.executeQuery();
393
- getResultPages().should('have.length', 1);
394
- SparqlSteps.getTableResultRows().should('contain', 'No data available in table');
395
- });
396
- });
397
-
398
- context('SPARQL queries with OWL-Horst Optimized', () => {
399
- beforeEach(() => {
400
- repositoryId = 'sparql-' + Date.now();
401
- SparqlSteps.createRepoAndVisit(repositoryId, {
402
- params: {
403
- ruleset: {
404
- value: 'owl-horst-optimized'
405
- },
406
- disableSameAs: {
407
- value: false
408
- }
409
- }
410
- })
411
- });
412
-
413
- it('Test execute query including inferred with ruleset "OWL-Horst (Optimized)"', () => {
414
- cy.importServerFile(repositoryId, FILE_TO_IMPORT);
415
-
416
- let defaultQueryWithoutLimit = 'select * where { \n' +
417
- '\t?s ?p ?o .\n' +
418
- '}';
419
-
420
- cy.waitUntilQueryIsVisible();
421
- cy.pasteQuery(defaultQueryWithoutLimit);
422
- SparqlSteps.executeQuery();
423
-
424
- cy.verifyResultsMessage('1,000 of 7,065');
425
- SparqlSteps.getResultsWrapper()
426
- .should('be.visible');
427
- verifyResultsPageLength(1000);
428
-
429
- // Disable the inference from the ">>" icon on the right of the SPARQL editor.
430
- cy.waitUntil(() =>
431
- getInferenceButton().find('.icon-inferred-on')
432
- .then(infBtn => infBtn && cy.wrap(infBtn).click()))
433
- .then(() =>
434
- cy.get('.icon-inferred-off').should('be.visible'));
435
- SparqlSteps.executeQuery();
436
-
437
- // Verify that there are 1,839 results
438
- cy.verifyResultsMessage('1,000 of 1,839');
439
- });
440
-
441
- it('Test execute query including inferred with ruleset "OWL-Horst (Optimized)" enabled sameAs functionality', () => {
442
- let updateToExecute = 'PREFIX : <http://test.com/>\n' +
443
- 'PREFIX owl: <http://www.w3.org/2002/07/owl#>\n' +
444
- '\n' +
445
- 'INSERT DATA {\n' +
446
- ' :a owl:sameAs :b .\n' +
447
- '}';
448
-
449
- const selectQuery = 'PREFIX : <http://test.com/>\n' +
450
- '\n' +
451
- 'select * where { \n' +
452
- ' :a ?p ?o .\n' +
453
- '}';
454
-
455
- cy.waitUntilQueryIsVisible();
456
- cy.pasteQuery(updateToExecute);
457
- SparqlSteps.executeQuery();
458
- getUpdateMessage()
459
- .should('be.visible')
460
- .and('contain', 'Added 1 statements');
461
-
462
- // Should be enabled by default
463
- getSameAsButton()
464
- .find('.icon-sameas-on')
465
- .should('be.visible');
466
-
467
- cy.pasteQuery(selectQuery);
468
- SparqlSteps.executeQuery();
469
- verifyResultsPageLength(2);
470
-
471
- getSameAsButton()
472
- .click()
473
- .find('.icon-sameas-off')
474
- .should('be.visible');
475
-
476
- SparqlSteps.executeQuery();
477
- verifyResultsPageLength(1);
478
- });
479
- });
480
-
481
- context('SPARQL view & download', () => {
482
- beforeEach(() => {
483
- repositoryId = 'sparql-' + Date.now();
484
- SparqlSteps.createRepoAndVisit(repositoryId)
485
- });
486
-
487
- it('Test open a new tab', () => {
488
- getNewTabButton().click();
489
-
490
- // Verify that as result of clicking addNewTab button we've opened one more tab
491
- SparqlSteps.getTabs().should('have.length', 2);
492
-
493
- getLastTab()
494
- .should('have.class', 'active')
495
- .find('.nav-link')
496
- .should('have.text', 'Unnamed');
497
-
498
- verifyQueryAreaContains(DEFAULT_QUERY);
499
-
500
- // No queries for new tab
501
- SparqlSteps.getNoQueryRunInfo().should('be.visible');
502
- });
503
-
504
- it('Test rename a tab', () => {
505
- let firstTabName = 'Select query';
506
- let secondTabName = 'Update query';
507
-
508
- renameTab(1, firstTabName);
509
-
510
- // Still one after renaming
511
- SparqlSteps.getTabs().should('have.length', 1);
512
-
513
- addTab();
514
-
515
- renameTab(2, secondTabName);
516
-
517
- // TODO: Add spec/steps for cancelling rename
518
-
519
- // Still two after renaming
520
- SparqlSteps.getTabs().should('have.length', 2);
521
- verifyTabName(1, firstTabName);
522
- verifyTabName(2, secondTabName);
523
-
524
- // Go to a different workbench section and then back
525
- ImportSteps.visitUserImport();
526
-
527
- cy.visit("/sparql");
528
- SparqlSteps.waitUntilSparqlPageIsLoaded();
529
-
530
- // Still two after navigation
531
- SparqlSteps.getTabs().should('have.length', 2);
532
- verifyTabName(1, firstTabName);
533
- verifyTabName(2, secondTabName);
534
- });
535
-
536
- it('Test close a tab', () => {
537
- addTab();
538
- addTab();
539
- addTab();
540
-
541
- renameTab(1, 'Tab 1');
542
- renameTab(2, 'Tab 2');
543
- renameTab(3, 'Tab 3');
544
- renameTab(4, 'Tab 4');
545
-
546
- closeTab(2);
547
- confirmModal();
548
- getModal().should('not.exist');
549
-
550
- closeTab(3);
551
- confirmModal();
552
- getModal().should('not.exist');
553
-
554
- SparqlSteps.getTabs().should('have.length', 2);
555
-
556
- verifyTabName(1, 'Tab 1');
557
- verifyTabName(2, 'Tab 3');
558
- });
559
-
560
- it('Test close all tabs except the selected one', () => {
561
- addTab();
562
- addTab();
563
- addTab();
564
-
565
- renameTab(1, 'Tab 1');
566
- renameTab(2, 'Tab 2');
567
- renameTab(3, 'Tab 3');
568
- renameTab(4, 'Tab 4');
569
-
570
- // Holding the shift down until the next command
571
- cy.get('body').type('{shift}', {release: false});
572
- closeTab(3);
573
- confirmModal();
574
- getModal().should('not.exist');
575
-
576
- SparqlSteps.getTabs().should('have.length', 1);
577
- verifyTabName(1, 'Tab 3');
578
- });
579
-
580
- it('Test download query results in Supported formats', () => {
581
- SparqlSteps.executeQuery();
582
-
583
- // Wait until results are visible before verifying the download menu
584
- SparqlSteps.getResultsWrapper().should('be.visible');
585
- verifyResultsPageLength(70);
586
-
587
- openDownloadAsMenu();
588
-
589
- getDownloadAsFormatButtons()
590
- .should('have.length', 8);
591
-
592
- verifyDownloadMenuFormat('JSON', 'application/sparql-results+json');
593
- verifyDownloadMenuFormat('XML', 'application/sparql-results+xml');
594
- verifyDownloadMenuFormat('CSV', 'text/csv');
595
- verifyDownloadMenuFormat('TSV', 'text/tab-separated-values');
596
- verifyDownloadMenuFormat('Binary RDF Results', 'application/x-binary-rdf-results-table');
597
- });
598
-
599
- it('Test switch result format tabs', () => {
600
- SparqlSteps.executeQuery();
601
-
602
- openRawResponse();
603
- SparqlSteps.getResultsWrapper()
604
- .find('.CodeMirror-code')
605
- .should('be.visible');
606
-
607
- openPivotTable();
608
- SparqlSteps.getResultsWrapper()
609
- .find('.pivotTable table.pvtUi')
610
- .should('be.visible');
611
-
612
- // GCharts blows sometimes and breaks the test
613
- disableExceptions();
614
-
615
- openGoogleChart();
616
- SparqlSteps.getResultsWrapper()
617
- .find('#yasr-inner_gchartWrapper .google-visualization-table')
618
- .should('be.visible');
619
- });
620
-
621
- it('Test change views', () => {
622
- viewEditorOnly();
623
-
624
- // Verify that only Editor tab is displayed
625
- cy.get(EDITOR_SELECTOR).should('be.visible');
626
- cy.get(YASR_INNER_SELECTOR).should('not.be.visible');
627
-
628
- viewEditorAndResults();
629
-
630
- // Verify that both Editor and Results tabs are displayed
631
- cy.get(EDITOR_SELECTOR).should('be.visible');
632
- cy.get(YASR_INNER_SELECTOR).should('be.visible');
633
-
634
- viewResultsOnly();
635
-
636
- // Verify that only Results tab is displayed
637
- cy.get(EDITOR_SELECTOR).should('not.be.visible');
638
- cy.get(YASR_INNER_SELECTOR).should('be.visible');
639
-
640
- viewEditorAndResults();
641
-
642
- // Check that they are horizontal
643
- cy.get('#sparql-content > div').should('have.class', 'row');
644
- cy.get(YASR_SELECTOR).should('not.have.class', 'vertical');
645
-
646
- // Change the orientation to vertical
647
- changeViewOrientation();
648
-
649
- // Verify that all elements are visible and properly displayed.
650
- cy.get(EDITOR_SELECTOR).should('be.visible');
651
- cy.get(YASR_INNER_SELECTOR).should('be.visible');
652
-
653
- // Check that they are vertical
654
- cy.get('#sparql-content > div').should('not.have.class', 'row');
655
- cy.get(YASR_SELECTOR).should('have.class', 'vertical');
656
-
657
- // Run the default query on vertical mode
658
- SparqlSteps.executeQuery();
659
- // Verify that all results are properly scaled/displayed
660
- verifyResultsPageLength(70);
661
-
662
- // Return the orientation to horizontal
663
- changeViewOrientation();
664
-
665
- cy.get('#sparql-content > div').should('have.class', 'row');
666
- cy.get(YASR_SELECTOR).should('not.have.class', 'vertical');
667
- });
668
- });
669
-
670
- context('Saved queries & links', () => {
671
- beforeEach(() => {
672
- repositoryId = 'sparql-' + Date.now();
673
- SparqlSteps.createRepoAndVisit(repositoryId)
674
- });
675
-
676
- const QUERY_FOR_SAVING = 'select (count (*) as ?cnt)\n' +
677
- 'where {\n' +
678
- ' ?s ?p ?o .\n' +
679
- '}';
680
-
681
- const QUERY_FOR_SAVING_MODIFIED = 'select (count (*) as ?cnt)\n' +
682
- 'where {\n' +
683
- ' ?s1 ?p1 ?o1 .\n' +
684
- '}';
685
-
686
- function waitUntilSavedQueryModalIsVisible() {
687
- getModal().should('not.have.class', 'ng-animate').and('be.visible');
688
- getSavedQueryForm().should('be.visible');
689
- getSubmitSavedQueryBtn()
690
- .should('be.visible')
691
- .and('not.be.disabled');
692
- }
693
-
694
- it('Test create, edit and delete saved query', () => {
695
- let savedQueryName = 'Saved query - ' + Date.now();
696
-
697
- cy.waitUntilQueryIsVisible();
698
- cy.pasteQuery(QUERY_FOR_SAVING);
699
-
700
- saveQuery();
701
- waitUntilSavedQueryModalIsVisible();
702
-
703
- getSavedQueryNameField()
704
- .type(savedQueryName)
705
- .should('have.value', savedQueryName);
706
- submitSavedQuery();
707
-
708
- getSavedQueryForm().should('not.exist');
709
-
710
- // Verify that the query is saved
711
- SparqlSteps.openSavedQueriesPopup();
712
- SparqlSteps.getPopover()
713
- .should('be.visible')
714
- .and('contain', savedQueryName);
715
-
716
- // Press the pen icon to edit the custom query created earlier
717
- executeSavedQueryCommand(savedQueryName, EDIT_SAVED_QUERY_COMMAND);
718
-
719
- // Note that popover fades away, which in newer versions of cypress
720
- // is considered that does not exist. All other checks will fail
721
- cy.get('.popover').should('not.exist');
722
- waitUntilSavedQueryModalIsVisible();
723
-
724
- getSavedQueryNameField().should('have.value', savedQueryName);
725
- getSavedQueryField()
726
- .should('have.value', QUERY_FOR_SAVING)
727
- .clear()
728
- .type(QUERY_FOR_SAVING_MODIFIED)
729
- .should('have.value', QUERY_FOR_SAVING_MODIFIED);
730
- submitSavedQuery();
731
-
732
- getSavedQueryForm().should('not.exist');
733
-
734
- // Verify that the query is edited.
735
- // Select the query from the saved queries again
736
- SparqlSteps.openSavedQueriesPopup();
737
- SparqlSteps.getPopover()
738
- .should('be.visible')
739
- .and('contain', savedQueryName);
740
-
741
- executeSavedQueryCommand(savedQueryName, EDIT_SAVED_QUERY_COMMAND);
742
-
743
- waitUntilSavedQueryModalIsVisible();
744
-
745
- getSavedQueryNameField().should('have.value', savedQueryName);
746
- getSavedQueryField().should('have.value', QUERY_FOR_SAVING_MODIFIED);
747
-
748
- // Close edit saved query dialog
749
- submitSavedQuery();
750
-
751
- // Click on the saved queries icon
752
- SparqlSteps.openSavedQueriesPopup();
753
- SparqlSteps.getPopover()
754
- .should('be.visible')
755
- .and('contain', savedQueryName);
756
-
757
- // Press the trash bin to delete the custom query created earlier
758
- executeSavedQueryCommand(savedQueryName, DELETE_SAVED_QUERY_COMMAND);
759
-
760
- // Confirm dialog
761
- confirmModal();
762
- getModal().should('not.exist');
763
- cy.get('.popover').should('not.exist');
764
-
765
- // Verify that the query is deleted
766
- SparqlSteps.openSavedQueriesPopup();
767
- SparqlSteps.getPopover()
768
- .should('be.visible')
769
- .and('not.contain', savedQueryName);
770
- });
771
-
772
- it('Test save invalid Sample Queries', () => {
773
- // Try to save Sample Queries without specifying query name
774
- saveQuery().then(() => waitUntilSavedQueryModalIsVisible());
775
-
776
- submitSavedQuery();
777
- getSavedQueryErrors()
778
- .find('.empty-query-name-err')
779
- .should('be.visible')
780
- .and('contain', 'Name cannot be empty!');
781
-
782
- // Type query name, remove content add try to save the query
783
- getSavedQueryNameField()
784
- .type('My query')
785
- .should('have.value', 'My query');
786
- getSavedQueryField()
787
- .clear()
788
- .should('not.have.value');
789
-
790
- submitSavedQuery();
791
- getSavedQueryErrors()
792
- .find('.empty-query-err')
793
- .should('be.visible')
794
- .and('contain', 'Query cannot be empty!');
795
-
796
- // Try to save a query with name that already exists -> Add statements
797
- getSavedQueryNameField()
798
- .clear()
799
- .type('Add statements')
800
- .should('have.value', 'Add statements');
801
- getSavedQueryField()
802
- .type(QUERY_FOR_SAVING);
803
-
804
- // The form is valid, the modal should disappear and then reappear with an error
805
- getSubmitSavedQueryBtn()
806
- .click()
807
- .should('not.exist')
808
- waitUntilSavedQueryModalIsVisible();
809
-
810
- getSavedQueryErrors()
811
- .find('.query-exists-error')
812
- .should('be.visible')
813
- .and('contain', 'Query with name \'Add statements\' already exists!');
814
- });
815
-
816
- it('Test run saved queries', () => {
817
- // Execute all default saved queries
818
-
819
- // Execute the default sample Add Statements
820
- SparqlSteps.selectSavedQuery('Add statements');
821
- SparqlSteps.getTabs().should('have.length', 2);
822
- getActiveTabLink().should('have.text', 'Add statements');
823
- SparqlSteps.getQueryArea().should('contain', 'INSERT DATA');
824
- SparqlSteps.executeQuery();
825
- // Verify query information: “Added 2 statements”
826
- getUpdateMessage()
827
- .should('contain', 'Added 2 statements.')
828
- .and('contain', 'Update took');
829
-
830
- // Execute the default sample Remove statements
831
- SparqlSteps.selectSavedQuery('Remove statements');
832
- SparqlSteps.getTabs().should('have.length', 3);
833
- getActiveTabLink().should('have.text', 'Remove statements');
834
- SparqlSteps.getQueryArea().should('contain', 'DELETE DATA');
835
- SparqlSteps.executeQuery();
836
- getUpdateMessage()
837
- .should('contain', 'Removed 2 statements.')
838
- .and('contain', 'Update took');
839
-
840
- // Execute the default sample Clear Graph
841
- SparqlSteps.selectSavedQuery('Clear graph');
842
- SparqlSteps.getTabs().should('have.length', 4);
843
- getActiveTabLink().should('have.text', 'Clear graph');
844
- SparqlSteps.getQueryArea().should('contain', 'CLEAR GRAPH');
845
- SparqlSteps.executeQuery();
846
- getUpdateMessage()
847
- .should('contain', 'The number of statements did not change.')
848
- .and('contain', 'Update took');
849
-
850
- // Execute the default SPARQL Select template
851
- SparqlSteps.selectSavedQuery('SPARQL Select template');
852
- SparqlSteps.getTabs().should('have.length', 5);
853
- getActiveTabLink().should('have.text', 'SPARQL Select template');
854
- SparqlSteps.getQueryArea().should('contain', 'SELECT');
855
- SparqlSteps.executeQuery();
856
- getUpdateMessage().should('not.be.visible');
857
- cy.verifyResultsMessage('Showing results from 1 to 72 of 72');
858
- cy.verifyResultsMessage('Query took');
859
-
860
- verifyResultsPageLength(72);
861
- });
862
-
863
- it('Test saved query link', () => {
864
- const queryName = 'Add statements';
865
- SparqlSteps.openSavedQueriesPopup();
866
- SparqlSteps.getPopover().should('be.visible');
867
-
868
- executeSavedQueryCommand(queryName, OPEN_SAVED_QUERY_COMMAND);
869
-
870
- const expectedUrl = Cypress.config().baseUrl + '/sparql?savedQueryName=' + encodeURI(queryName) + '&owner=admin';
871
- getModal()
872
- .should('be.visible')
873
- .and('not.have.class', 'ng-animate')
874
- .find('#clipboardURI')
875
- .should('have.value', expectedUrl);
876
-
877
- // Visit performs full page load
878
- cy.visit(expectedUrl);
879
- SparqlSteps.waitUntilSparqlPageIsLoaded();
880
-
881
- SparqlSteps.getTabs().should('have.length', 2);
882
- getActiveTabLink().should('have.text', queryName);
883
-
884
- // Wait until editor is initialized with the query and then assert the whole query
885
- SparqlSteps.getQueryArea().should('contain', 'INSERT DATA');
886
- cy.fixture('queries/add-statement.txt').then((query) => {
887
- // Convert new line symbols to \n regardless of OS. Query in SPARQL editor uses \n for new line.
888
- const EOLregex = /(\r\n|\r|\n)/g;
889
- const reformattedQuery = query.replace(EOLregex, '\n');
890
- verifyQueryAreaEquals(reformattedQuery);
891
- });
892
- });
893
-
894
- it('Test URL to current query', () => {
895
- const query = 'SELECT ?sub ?pred ?obj WHERE {?sub ?pred ?obj .} LIMIT 100';
896
- cy.waitUntilQueryIsVisible();
897
- cy.pasteQuery(query);
898
-
899
- // Press the link icon to generate a link for a query
900
- getQueryLinkBtn().click();
901
-
902
- // TODO: Test with tab name -> should open such tab if it was deleted
903
-
904
- // TODO: Test with different values for infer & same as
905
-
906
- const encodedQuery = 'SELECT%20%3Fsub%20%3Fpred%20%3Fobj%20WHERE%20%7B%3Fsub%20%3Fpred%20%3Fobj%20.%7D%20LIMIT%20100';
907
- const expectedUrl = Cypress.config().baseUrl + '/sparql?name=&infer=true&sameAs=true&query=' + encodedQuery;
908
- getModal()
909
- .should('be.visible')
910
- .and('not.have.class', 'ng-animate')
911
- .find('#clipboardURI')
912
- .should('have.value', expectedUrl);
913
-
914
- // Visit performs full page load
915
- cy.visit(expectedUrl);
916
- SparqlSteps.waitUntilSparqlPageIsLoaded();
917
- SparqlSteps.getTabs().should('have.length', 1);
918
-
919
- // Wait until editor is initialized with the query and then assert the whole query
920
- SparqlSteps.getQueryArea().should('contain', 'SELECT');
921
- verifyQueryAreaEquals(query);
922
- });
923
- });
924
-
925
- context('SPARQL with autocomplete', () => {
926
- const queryBegin = 'select * where { ';
927
- const queryEnd = ' ?s ?p . } limit 100';
928
- const wineUri = '<http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#CorbansDryWhiteRiesling>';
929
-
930
- it('should suggest resources in the "SPARQL" editor when autocomplete is enabled', () => {
931
- repositoryId = 'sparql-' + Date.now();
932
- SparqlSteps.createRepository(repositoryId);
933
-
934
- cy.importServerFile(repositoryId, FILE_TO_IMPORT);
935
-
936
- cy.enableAutocomplete(repositoryId);
937
- SparqlSteps.visitSparql(true, repositoryId);
938
-
939
- const expectedQuery = queryBegin + wineUri + queryEnd;
940
-
941
- SparqlSteps.clearQuery();
942
-
943
- SparqlSteps.typeQuery(queryBegin, false);
944
- // TODO: Need to test Alt-Enter too
945
- SparqlSteps.typeQuery('Dry' + Cypress.env('modifierKey') + ' ', false, true);
946
-
947
- getAutoSuggestHints()
948
- .should('be.visible')
949
- .and('have.length', 7)
950
- .contains('CorbansDryWhiteRiesling')
951
- .click()
952
- .should('not.exist');
953
-
954
- SparqlSteps.typeQuery(queryEnd, false);
955
-
956
- verifyQueryAreaEquals(expectedQuery);
957
-
958
- SparqlSteps.executeQuery();
959
-
960
- SparqlSteps.getResultsWrapper().should('be.visible');
961
-
962
- verifyResultsPageLength(10);
963
- });
964
-
965
- it('should not suggests resources in the "SPARQL" editor if the autocomplete is NOT enabled', () => {
966
- repositoryId = 'sparql-' + Date.now();
967
- SparqlSteps.createRepoAndVisit(repositoryId);
968
-
969
- SparqlSteps.clearQuery();
970
-
971
- SparqlSteps.typeQuery(queryBegin, false);
972
- // TODO: Need to test Alt-Enter too
973
- SparqlSteps.typeQuery('Dry' + Cypress.env('modifierKey') + ' ', false, true);
974
-
975
- getAutoSuggestHints().should('not.exist');
976
- getToast()
977
- .find('.toast-warning')
978
- .should('be.visible')
979
- .and('contain', 'Autocomplete is OFF');
980
- });
981
- });
982
-
983
- const TABS_SELECTOR = '#sparql-content .nav-tabs .sparql-tab';
984
- const EDITOR_SELECTOR = '#queryEditor';
985
- const YASR_SELECTOR = '#yasr';
986
- const YASR_INNER_SELECTOR = '#yasr-inner';
987
-
988
- function verifyResultsPageLength(resultLength) {
989
- SparqlSteps.getTableResultRows()
990
- .should('have.length', resultLength);
991
- }
992
-
993
- function getResultPagination() {
994
- return cy.get('#yasr .nav.pagination');
995
- }
996
-
997
- function getResultPages() {
998
- // We added prev/next links so only get the li created for actual pages
999
- return getResultPagination().find('li[ng-repeat]');
1000
- }
1001
-
1002
- function getModal() {
1003
- return cy.get('.modal');
1004
- }
1005
-
1006
- function confirmModal() {
1007
- getModal()
1008
- .should('be.visible')
1009
- .and('not.have.class', 'ng-animate')
1010
- .find('.modal-footer')
1011
- .should('be.visible')
1012
- .find('.btn-primary')
1013
- .click();
1014
- }
1015
-
1016
- function getActiveTabLink() {
1017
- return cy.get(TABS_SELECTOR + '.active .nav-link');
1018
- }
1019
-
1020
- function getNewTabButton() {
1021
- return cy.get('#wb-sparql-addNewTab');
1022
- }
1023
-
1024
- function addTab() {
1025
- getNewTabButton().click();
1026
- }
1027
-
1028
- function getLastTab() {
1029
- return SparqlSteps.getTabs().last();
1030
- }
1031
-
1032
- function renameTab(position, newName) {
1033
- SparqlSteps.getTabs().eq(position - 1).then(tab => {
1034
- cy.wrap(tab)
1035
- // First click is to focus it in case it's not the active tab
1036
- .click()
1037
- .find('.nav-link')
1038
- .dblclick();
1039
- cy.wrap(tab)
1040
- .find('.editable-input')
1041
- .type(newName)
1042
- .should('have.value', newName);
1043
- cy.wrap(tab)
1044
- .find('.editable-buttons .btn-primary')
1045
- .click()
1046
- .should('not.exist');
1047
- });
1048
- }
1049
-
1050
- function verifyTabName(position, name) {
1051
- SparqlSteps.getTabs().eq(position - 1)
1052
- .should('be.visible')
1053
- .find('.nav-link')
1054
- .should('have.text', name);
1055
- }
1056
-
1057
- function getTabCloseBtn(position) {
1058
- return SparqlSteps.getTabs().eq(position - 1).find('.delete-sparql-tab-btn');
1059
- }
1060
-
1061
- function closeTab(position) {
1062
- getTabCloseBtn(position).click();
1063
- }
1064
-
1065
- function verifyQueryAreaContains(query) {
1066
- // Using the CodeMirror instance because getting the value from the DOM is very cumbersome
1067
- cy.waitUntil(() =>
1068
- SparqlSteps.getQueryArea()
1069
- .then(codeMirrorEl => codeMirrorEl && codeMirrorEl[0].CodeMirror.getValue().includes(query)));
1070
- }
1071
-
1072
- function verifyQueryAreaEquals(query) {
1073
- // Using the CodeMirror instance because getting the value from the DOM is very cumbersome
1074
- SparqlSteps.getQueryArea().should(codeMirrorEl => {
1075
- const cm = codeMirrorEl[0].CodeMirror;
1076
- expect(cm.getValue().trim()).to.equal(query.trim());
1077
- });
1078
- }
1079
-
1080
- function goToPage(page) {
1081
- getResultPages().contains(page).click();
1082
- SparqlSteps.getLoader().should('not.exist');
1083
- }
1084
-
1085
- function getResultFilterField() {
1086
- return cy.get('#yasr input[type="search"]');
1087
- }
1088
-
1089
- function getTableResponseButton() {
1090
- return cy.get('#yasr .select_table');
1091
- }
1092
-
1093
- function getRawResponseButton() {
1094
- return cy.get('#yasr .select_rawResponse');
1095
- }
1096
-
1097
- function openRawResponse() {
1098
- getRawResponseButton().click();
1099
- }
1100
-
1101
- function getPivotTableButton() {
1102
- return cy.get('#yasr .select_pivot');
1103
- }
1104
-
1105
- function openPivotTable() {
1106
- getPivotTableButton().click();
1107
- }
1108
-
1109
- function getGoogleChartButton() {
1110
- return cy.get('#yasr .select_gchart');
1111
- }
1112
-
1113
- function openGoogleChart() {
1114
- getGoogleChartButton().click();
1115
- }
1116
-
1117
- function getEditorOnlyButton() {
1118
- return cy.get('#hideEditor .editor-only-btn');
1119
- }
1120
-
1121
- function viewEditorOnly() {
1122
- getEditorOnlyButton().click();
1123
- }
1124
-
1125
- function getEditorAndResultsButton() {
1126
- return cy.get('#hideEditor .editor-and-results-btn');
1127
- }
1128
-
1129
- function viewEditorAndResults() {
1130
- getEditorAndResultsButton().click();
1131
- }
1132
-
1133
- function getResultsOnlyButton() {
1134
- return cy.get('#hideEditor .results-only-btn');
1135
- }
1136
-
1137
- function viewResultsOnly() {
1138
- getResultsOnlyButton().click();
1139
- }
1140
-
1141
- function getViewOrientationButton() {
1142
- return cy.get('#hideEditor .toggle-horizontal-view-btn');
1143
- }
1144
-
1145
- function changeViewOrientation() {
1146
- getViewOrientationButton().click();
1147
- }
1148
-
1149
- function getSaveQueryBtn() {
1150
- return cy.get('#wb-sparql-saveQuery');
1151
- }
1152
-
1153
- function saveQuery() {
1154
- return getSaveQueryBtn().click();
1155
- }
1156
-
1157
- function getSavedQueryForm() {
1158
- return cy.get('.modal .save-query-form');
1159
- }
1160
-
1161
- function getSubmitSavedQueryBtn() {
1162
- return cy.get('#wb-sparql-submit');
1163
- }
1164
-
1165
- function submitSavedQuery() {
1166
- getSubmitSavedQueryBtn().click();
1167
- }
1168
-
1169
- function getSavedQueryNameField() {
1170
- return cy.get('#wb-sparql-sampleName');
1171
- }
1172
-
1173
- function getSavedQueryErrors() {
1174
- return getSavedQueryForm().find('.saved-query-errors');
1175
- }
1176
-
1177
- function getSavedQueryField() {
1178
- return cy.get('#wb-sparql-sampleValue');
1179
- }
1180
-
1181
- function executeSavedQueryCommand(savedQueryName, commandSelector) {
1182
- SparqlSteps.getSavedQueryFromPopup(savedQueryName)
1183
- // Current implementation of the saved queries popup always render the action bar next to
1184
- // each query item but it's just hidden with opacity: 0. So IMO it's safe to force it here.
1185
- .trigger('mouseover', {force: true})
1186
- .find('.actions-bar')
1187
- .find(commandSelector)
1188
- .parent('.btn')
1189
- // Cypress sometimes determines the element has 0x0 dimensions...
1190
- .click({force: true});
1191
- }
1192
-
1193
- function getUpdateMessage() {
1194
- return cy.get('#yasr-inner .alert-info.update-info');
1195
- }
1196
-
1197
- function getQueryLinkBtn() {
1198
- return cy.get('#wb-sparql-copyToClipboardQuery');
1199
- }
1200
-
1201
- function getResultsHeader() {
1202
- return cy.get('#yasr .yasr_header');
1203
- }
1204
-
1205
- function getDownloadAsMenuButton() {
1206
- return getResultsHeader().find('.saveAsDropDown > .btn');
1207
- }
1208
-
1209
- function openDownloadAsMenu() {
1210
- getDownloadAsMenuButton().click();
1211
- }
1212
-
1213
- function getDownloadAsFormatButtons() {
1214
- return getResultsHeader().find('.saveAsDropDown .dropdown-menu .dropdown-item');
1215
- }
1216
-
1217
- function verifyDownloadMenuFormat(rdfFormat, mimetype) {
1218
- getDownloadAsFormatButtons()
1219
- .contains(rdfFormat)
1220
- .and('have.attr', 'data-accepts')
1221
- .and('include', mimetype);
1222
- }
1223
-
1224
- function disableExceptions() {
1225
- cy.on('uncaught:exception', () => {
1226
- return false;
1227
- });
1228
- }
1229
-
1230
- function getBooleanResult() {
1231
- return SparqlSteps.getResultsWrapper().find('.booleanBootResult');
1232
- }
1233
-
1234
- function getResultsDownloadButton() {
1235
- return getResultsHeader().find('.yasr_downloadIcon');
1236
- }
1237
-
1238
- function getInferenceButton() {
1239
- return cy.get('#inference').scrollIntoView();
1240
- }
1241
-
1242
- function getSameAsButton() {
1243
- return cy.get('#sameAs').scrollIntoView();
1244
- }
1245
-
1246
- function getAutoSuggestHints() {
1247
- return cy.get('.CodeMirror-hints .CodeMirror-hint');
1248
- }
1249
-
1250
- function getToast() {
1251
- return cy.get('#toast-container');
1252
- }
1253
- });