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