graphdb-workbench-tests 2.0.0-TR7 → 2.0.0
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.
- package/fixtures/locale-en.json +1608 -0
- package/integration/explore/similarity.spec.js +3 -3
- package/integration/explore/visual.graph.spec.js +46 -12
- package/integration/help/rest-api.spec.js +1 -1
- package/integration/home/language-change.spec.js +45 -0
- package/integration/home/workbench.home.spec.js +16 -1
- package/integration/repository/repositories.spec.js +54 -29
- package/integration/setup/connectors-lucene.spec.js +35 -30
- package/integration/setup/my-settings.spec.js +17 -0
- package/integration/setup/plugins.spec.js +69 -0
- package/integration/setup/rdf-rank.spec.js +1 -1
- package/integration/setup/sparql-templates.spec.js +179 -0
- package/integration/setup/user-and-access.spec.js +69 -24
- package/integration/sparql/main.menu.spec.js +8 -13
- package/integration/sparql/sparql-language-change.spec.js +62 -0
- package/integration/sparql/sparql.menu.spec.js +105 -203
- package/package.json +4 -2
- package/plugins/index.js +9 -0
- package/steps/home-steps.js +16 -0
- package/steps/sparql-steps.js +154 -0
- package/support/import-commands.js +8 -6
- package/support/index.js +2 -0
- package/support/settings-commands.js +1 -1
- package/support/sparql-commands.js +3 -5
- package/integration/import/onto-refine.spec.js +0 -135
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ImportSteps from '../../steps/import-steps';
|
|
2
|
+
import SparqlSteps from '../../steps/sparql-steps';
|
|
2
3
|
|
|
3
4
|
const FILE_TO_IMPORT = 'wine.rdf';
|
|
4
5
|
const RDF_STAR_FILE_TO_IMPORT = 'turtlestar-data.ttls';
|
|
@@ -62,73 +63,25 @@ describe('SPARQL screen validation', () => {
|
|
|
62
63
|
' inst:gateService :dropService "".\n' +
|
|
63
64
|
'}';
|
|
64
65
|
|
|
65
|
-
function createRepoAndVisit(repoOptions = {}) {
|
|
66
|
-
createRepository(repoOptions);
|
|
67
|
-
visitSparql(true);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function createRepository(repoOptions = {}) {
|
|
71
|
-
repositoryId = 'sparql-' + Date.now();
|
|
72
|
-
repoOptions.id = repositoryId;
|
|
73
|
-
cy.createRepository(repoOptions);
|
|
74
|
-
cy.initializeRepository(repositoryId);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function visitSparql(resetLocalStorage) {
|
|
78
|
-
cy.visit('/sparql', {
|
|
79
|
-
onBeforeLoad: (win) => {
|
|
80
|
-
if (resetLocalStorage) {
|
|
81
|
-
// Needed because the workbench app is very persistent with its local storage (it's hooked on before unload event)
|
|
82
|
-
// TODO: Add a test that tests this !
|
|
83
|
-
if (win.localStorage) {
|
|
84
|
-
win.localStorage.clear();
|
|
85
|
-
}
|
|
86
|
-
if (win.sessionStorage) {
|
|
87
|
-
win.sessionStorage.clear();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
win.localStorage.setItem('com.ontotext.graphdb.repository', repositoryId);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
waitUntilSparqlPageIsLoaded();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function waitUntilSparqlPageIsLoaded() {
|
|
97
|
-
cy.window();
|
|
98
|
-
// Workbench loading screen should not be visible
|
|
99
|
-
cy.get('.ot-splash').should('not.be.visible');
|
|
100
|
-
|
|
101
|
-
// Run query button should be clickable
|
|
102
|
-
getRunQueryButton().should('be.visible').and('not.be.disabled');
|
|
103
|
-
|
|
104
|
-
cy.waitUntilQueryIsVisible();
|
|
105
|
-
|
|
106
|
-
// Run query button should be clickable
|
|
107
|
-
getRunQueryButton().should('be.visible').and('not.be.disabled');
|
|
108
|
-
|
|
109
|
-
// Editor should have a visible tab
|
|
110
|
-
getTabs().find('.nav-link').should('be.visible');
|
|
111
|
-
|
|
112
|
-
// No active loader
|
|
113
|
-
getLoader().should('not.exist');
|
|
114
|
-
}
|
|
115
|
-
|
|
116
66
|
afterEach(() => {
|
|
117
67
|
cy.deleteRepository(repositoryId);
|
|
118
68
|
});
|
|
119
69
|
|
|
120
70
|
context('SPARQL queries & filtering', () => {
|
|
121
|
-
beforeEach(() =>
|
|
71
|
+
beforeEach(() => {
|
|
72
|
+
repositoryId = 'sparql-' + Date.now();
|
|
73
|
+
SparqlSteps.createRepoAndVisit(repositoryId)
|
|
74
|
+
});
|
|
122
75
|
|
|
123
76
|
it('Test execute default query', () => {
|
|
124
|
-
getTabs().should('have.length', 1);
|
|
77
|
+
SparqlSteps.getTabs().should('have.length', 1);
|
|
125
78
|
|
|
126
79
|
verifyQueryAreaEquals(DEFAULT_QUERY);
|
|
127
80
|
|
|
128
81
|
// No queries should have been run for this tab
|
|
129
82
|
getNoQueryRun().should('be.visible');
|
|
130
83
|
|
|
131
|
-
executeQuery();
|
|
84
|
+
SparqlSteps.executeQuery();
|
|
132
85
|
|
|
133
86
|
verifyResultsPageLength(70);
|
|
134
87
|
});
|
|
@@ -142,7 +95,7 @@ describe('SPARQL screen validation', () => {
|
|
|
142
95
|
// Verify pasting also works
|
|
143
96
|
cy.pasteQuery(DEFAULT_QUERY_MODIFIED);
|
|
144
97
|
|
|
145
|
-
executeQuery();
|
|
98
|
+
SparqlSteps.executeQuery();
|
|
146
99
|
|
|
147
100
|
getResultPages().should('have.length', 2);
|
|
148
101
|
|
|
@@ -160,7 +113,7 @@ describe('SPARQL screen validation', () => {
|
|
|
160
113
|
|
|
161
114
|
verifyQueryAreaEquals(SPARQL_STAR_QUERY);
|
|
162
115
|
|
|
163
|
-
executeQuery();
|
|
116
|
+
SparqlSteps.executeQuery();
|
|
164
117
|
|
|
165
118
|
getResultPages().should('have.length', 1);
|
|
166
119
|
|
|
@@ -180,7 +133,7 @@ describe('SPARQL screen validation', () => {
|
|
|
180
133
|
|
|
181
134
|
verifyQueryAreaEquals(selectQuery);
|
|
182
135
|
|
|
183
|
-
executeQuery();
|
|
136
|
+
SparqlSteps.executeQuery();
|
|
184
137
|
|
|
185
138
|
getResultPages().should('have.length', 1);
|
|
186
139
|
|
|
@@ -200,7 +153,7 @@ describe('SPARQL screen validation', () => {
|
|
|
200
153
|
|
|
201
154
|
verifyQueryAreaEquals(insertQuery);
|
|
202
155
|
|
|
203
|
-
executeQuery();
|
|
156
|
+
SparqlSteps.executeQuery();
|
|
204
157
|
|
|
205
158
|
getUpdateMessage()
|
|
206
159
|
.should('be.visible')
|
|
@@ -213,13 +166,13 @@ describe('SPARQL screen validation', () => {
|
|
|
213
166
|
cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
|
|
214
167
|
|
|
215
168
|
let selectQuery = "PREFIX bd: <http://bigdata.com/RDF#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
|
|
216
|
-
|
|
169
|
+
"select * where {<<bd:bob foaf:mbox <mailto:bob@home>>> ?p ?o .}";
|
|
217
170
|
|
|
218
171
|
typeQuery(selectQuery);
|
|
219
172
|
|
|
220
173
|
verifyQueryAreaEquals(selectQuery);
|
|
221
174
|
|
|
222
|
-
executeQuery();
|
|
175
|
+
SparqlSteps.executeQuery();
|
|
223
176
|
|
|
224
177
|
getResultPages().should('have.length', 1);
|
|
225
178
|
|
|
@@ -232,14 +185,14 @@ describe('SPARQL screen validation', () => {
|
|
|
232
185
|
cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
|
|
233
186
|
|
|
234
187
|
let deleteQuery = "PREFIX bd: <http://bigdata.com/RDF#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
|
|
235
|
-
|
|
236
|
-
|
|
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.}";
|
|
237
190
|
|
|
238
191
|
typeQuery(deleteQuery);
|
|
239
192
|
|
|
240
193
|
verifyQueryAreaEquals(deleteQuery);
|
|
241
194
|
|
|
242
|
-
executeQuery();
|
|
195
|
+
SparqlSteps.executeQuery();
|
|
243
196
|
|
|
244
197
|
getUpdateMessage()
|
|
245
198
|
.should('be.visible')
|
|
@@ -248,14 +201,14 @@ describe('SPARQL screen validation', () => {
|
|
|
248
201
|
getResultPages().should('have.length', 1);
|
|
249
202
|
|
|
250
203
|
let selectQuery = "PREFIX bd: <http://bigdata.com/RDF#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
|
|
251
|
-
|
|
252
|
-
|
|
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.}";
|
|
253
206
|
|
|
254
207
|
typeQuery(selectQuery);
|
|
255
208
|
|
|
256
209
|
verifyQueryAreaEquals(selectQuery);
|
|
257
210
|
|
|
258
|
-
executeQuery();
|
|
211
|
+
SparqlSteps.executeQuery();
|
|
259
212
|
|
|
260
213
|
getResultPages().should('have.length', 1);
|
|
261
214
|
|
|
@@ -274,7 +227,7 @@ describe('SPARQL screen validation', () => {
|
|
|
274
227
|
|
|
275
228
|
cy.pasteQuery(describeQuery);
|
|
276
229
|
|
|
277
|
-
executeQuery();
|
|
230
|
+
SparqlSteps.executeQuery();
|
|
278
231
|
|
|
279
232
|
cy.verifyResultsMessage('Showing results');
|
|
280
233
|
cy.verifyResultsMessage('Query took');
|
|
@@ -303,7 +256,7 @@ describe('SPARQL screen validation', () => {
|
|
|
303
256
|
|
|
304
257
|
verifyQueryAreaEquals(SPARQL_STAR_QUERY);
|
|
305
258
|
|
|
306
|
-
executeQuery();
|
|
259
|
+
SparqlSteps.executeQuery();
|
|
307
260
|
|
|
308
261
|
getResultPages().should('have.length', 1);
|
|
309
262
|
|
|
@@ -318,7 +271,7 @@ describe('SPARQL screen validation', () => {
|
|
|
318
271
|
it('Test filter query results', () => {
|
|
319
272
|
cy.importServerFile(repositoryId, FILE_TO_IMPORT);
|
|
320
273
|
|
|
321
|
-
executeQuery();
|
|
274
|
+
SparqlSteps.executeQuery();
|
|
322
275
|
|
|
323
276
|
// In the search field below the SPARQL editor enter 'White'
|
|
324
277
|
getResultFilterField()
|
|
@@ -342,7 +295,7 @@ describe('SPARQL screen validation', () => {
|
|
|
342
295
|
verifyQueryAreaContains('PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>');
|
|
343
296
|
verifyQueryAreaContains('PREFIX owl: <http://www.w3.org/2002/07/owl#>');
|
|
344
297
|
|
|
345
|
-
executeQuery();
|
|
298
|
+
SparqlSteps.executeQuery();
|
|
346
299
|
|
|
347
300
|
cy.getResultsMessage();
|
|
348
301
|
getResultsWrapper()
|
|
@@ -354,7 +307,7 @@ describe('SPARQL screen validation', () => {
|
|
|
354
307
|
|
|
355
308
|
cy.pasteQuery(describeQuery);
|
|
356
309
|
|
|
357
|
-
executeQuery();
|
|
310
|
+
SparqlSteps.executeQuery();
|
|
358
311
|
|
|
359
312
|
cy.verifyResultsMessage('Showing results')
|
|
360
313
|
cy.verifyResultsMessage('Query took');
|
|
@@ -380,7 +333,7 @@ describe('SPARQL screen validation', () => {
|
|
|
380
333
|
let askQuery = 'ASK WHERE { ?s ?p ?o .FILTER (regex(?o, "ontotext.com")) }';
|
|
381
334
|
|
|
382
335
|
cy.pasteQuery(askQuery);
|
|
383
|
-
executeQuery();
|
|
336
|
+
SparqlSteps.executeQuery();
|
|
384
337
|
|
|
385
338
|
// Confirm that all tabs (Table, Pivot Table, Google chart) are disabled
|
|
386
339
|
getTableResponseButton().should('not.be.visible');
|
|
@@ -396,7 +349,7 @@ describe('SPARQL screen validation', () => {
|
|
|
396
349
|
cy.pasteQuery(constructQuery);
|
|
397
350
|
});
|
|
398
351
|
|
|
399
|
-
executeQuery();
|
|
352
|
+
SparqlSteps.executeQuery();
|
|
400
353
|
|
|
401
354
|
cy.getResultsMessage();
|
|
402
355
|
getResultsWrapper()
|
|
@@ -416,7 +369,7 @@ describe('SPARQL screen validation', () => {
|
|
|
416
369
|
let insertQuery = 'INSERT DATA { <urn:a> <http://a/b> <urn:b> . <urn:b> <http://a/b> <urn:c> . }';
|
|
417
370
|
|
|
418
371
|
cy.pasteQuery(insertQuery);
|
|
419
|
-
executeQuery();
|
|
372
|
+
SparqlSteps.executeQuery();
|
|
420
373
|
|
|
421
374
|
getUpdateMessage().should('be.visible');
|
|
422
375
|
getResultsWrapper().should('not.be.visible');
|
|
@@ -427,7 +380,7 @@ describe('SPARQL screen validation', () => {
|
|
|
427
380
|
.should('be.visible');
|
|
428
381
|
|
|
429
382
|
cy.pasteQuery(DEFAULT_QUERY);
|
|
430
|
-
executeQuery();
|
|
383
|
+
SparqlSteps.executeQuery();
|
|
431
384
|
|
|
432
385
|
// Confirm that all statements are available (70 from ruleset, 2 explicit and 2 inferred)
|
|
433
386
|
getResultsWrapper().should('be.visible');
|
|
@@ -435,15 +388,14 @@ describe('SPARQL screen validation', () => {
|
|
|
435
388
|
verifyResultsPageLength(74);
|
|
436
389
|
|
|
437
390
|
// Uncheck ‘Include inferred’
|
|
438
|
-
|
|
439
|
-
.
|
|
440
|
-
|
|
441
|
-
.
|
|
442
|
-
|
|
443
|
-
.should('be.visible');
|
|
391
|
+
cy.waitUntil(() =>
|
|
392
|
+
getInferenceButton().find('.icon-inferred-on')
|
|
393
|
+
.then(infBtn => infBtn && cy.wrap(infBtn).click()))
|
|
394
|
+
.then(() =>
|
|
395
|
+
cy.get('.icon-inferred-off').should('be.visible'));
|
|
444
396
|
|
|
445
397
|
// Confirm that only inferred statements (only 2) are available
|
|
446
|
-
executeQuery();
|
|
398
|
+
SparqlSteps.executeQuery();
|
|
447
399
|
verifyResultsPageLength(2);
|
|
448
400
|
});
|
|
449
401
|
|
|
@@ -472,7 +424,7 @@ describe('SPARQL screen validation', () => {
|
|
|
472
424
|
});
|
|
473
425
|
|
|
474
426
|
context('SPARQL queries with OWL-Horst Optimized', () => {
|
|
475
|
-
beforeEach(() => createRepoAndVisit({
|
|
427
|
+
beforeEach(() => SparqlSteps.createRepoAndVisit(repositoryId, {
|
|
476
428
|
params: {
|
|
477
429
|
ruleset: {
|
|
478
430
|
value: 'owl-horst-optimized'
|
|
@@ -491,7 +443,7 @@ describe('SPARQL screen validation', () => {
|
|
|
491
443
|
'}';
|
|
492
444
|
|
|
493
445
|
cy.pasteQuery(defaultQueryWithoutLimit);
|
|
494
|
-
executeQuery();
|
|
446
|
+
SparqlSteps.executeQuery();
|
|
495
447
|
|
|
496
448
|
cy.verifyResultsMessage('1,000 of 7,065');
|
|
497
449
|
getResultsWrapper()
|
|
@@ -499,11 +451,12 @@ describe('SPARQL screen validation', () => {
|
|
|
499
451
|
verifyResultsPageLength(1000);
|
|
500
452
|
|
|
501
453
|
// Disable the inference from the ">>" icon on the right of the SPARQL editor.
|
|
502
|
-
|
|
503
|
-
.
|
|
504
|
-
|
|
505
|
-
.
|
|
506
|
-
|
|
454
|
+
cy.waitUntil(() =>
|
|
455
|
+
getInferenceButton().find('.icon-inferred-on')
|
|
456
|
+
.then(infBtn => infBtn && cy.wrap(infBtn).click()))
|
|
457
|
+
.then(() =>
|
|
458
|
+
cy.get('.icon-inferred-off').should('be.visible'));
|
|
459
|
+
SparqlSteps.executeQuery();
|
|
507
460
|
|
|
508
461
|
// Verify that there are 1,839 results
|
|
509
462
|
cy.verifyResultsMessage('1,000 of 1,839');
|
|
@@ -524,7 +477,7 @@ describe('SPARQL screen validation', () => {
|
|
|
524
477
|
'}';
|
|
525
478
|
|
|
526
479
|
cy.pasteQuery(updateToExecute);
|
|
527
|
-
executeQuery();
|
|
480
|
+
SparqlSteps.executeQuery();
|
|
528
481
|
getUpdateMessage()
|
|
529
482
|
.should('be.visible')
|
|
530
483
|
.and('contain', 'Added 1 statements');
|
|
@@ -535,7 +488,7 @@ describe('SPARQL screen validation', () => {
|
|
|
535
488
|
.should('be.visible');
|
|
536
489
|
|
|
537
490
|
cy.pasteQuery(selectQuery);
|
|
538
|
-
executeQuery();
|
|
491
|
+
SparqlSteps.executeQuery();
|
|
539
492
|
verifyResultsPageLength(2);
|
|
540
493
|
|
|
541
494
|
getSameAsButton()
|
|
@@ -543,19 +496,19 @@ describe('SPARQL screen validation', () => {
|
|
|
543
496
|
.find('.icon-sameas-off')
|
|
544
497
|
.should('be.visible');
|
|
545
498
|
|
|
546
|
-
executeQuery();
|
|
499
|
+
SparqlSteps.executeQuery();
|
|
547
500
|
verifyResultsPageLength(1);
|
|
548
501
|
});
|
|
549
502
|
});
|
|
550
503
|
|
|
551
504
|
context('SPARQL view & download', () => {
|
|
552
|
-
beforeEach(() => createRepoAndVisit());
|
|
505
|
+
beforeEach(() => SparqlSteps.createRepoAndVisit(repositoryId));
|
|
553
506
|
|
|
554
507
|
it('Test open a new tab', () => {
|
|
555
508
|
getNewTabButton().click();
|
|
556
509
|
|
|
557
510
|
// Verify that as result of clicking addNewTab button we've opened one more tab
|
|
558
|
-
getTabs().should('have.length', 2);
|
|
511
|
+
SparqlSteps.getTabs().should('have.length', 2);
|
|
559
512
|
|
|
560
513
|
getLastTab()
|
|
561
514
|
.should('have.class', 'active')
|
|
@@ -575,7 +528,7 @@ describe('SPARQL screen validation', () => {
|
|
|
575
528
|
renameTab(1, firstTabName);
|
|
576
529
|
|
|
577
530
|
// Still one after renaming
|
|
578
|
-
getTabs().should('have.length', 1);
|
|
531
|
+
SparqlSteps.getTabs().should('have.length', 1);
|
|
579
532
|
|
|
580
533
|
addTab();
|
|
581
534
|
|
|
@@ -584,7 +537,7 @@ describe('SPARQL screen validation', () => {
|
|
|
584
537
|
// TODO: Add spec/steps for cancelling rename
|
|
585
538
|
|
|
586
539
|
// Still two after renaming
|
|
587
|
-
getTabs().should('have.length', 2);
|
|
540
|
+
SparqlSteps.getTabs().should('have.length', 2);
|
|
588
541
|
verifyTabName(1, firstTabName);
|
|
589
542
|
verifyTabName(2, secondTabName);
|
|
590
543
|
|
|
@@ -592,10 +545,10 @@ describe('SPARQL screen validation', () => {
|
|
|
592
545
|
ImportSteps.visitUserImport();
|
|
593
546
|
|
|
594
547
|
cy.visit("/sparql");
|
|
595
|
-
waitUntilSparqlPageIsLoaded();
|
|
548
|
+
SparqlSteps.waitUntilSparqlPageIsLoaded();
|
|
596
549
|
|
|
597
550
|
// Still two after navigation
|
|
598
|
-
getTabs().should('have.length', 2);
|
|
551
|
+
SparqlSteps.getTabs().should('have.length', 2);
|
|
599
552
|
verifyTabName(1, firstTabName);
|
|
600
553
|
verifyTabName(2, secondTabName);
|
|
601
554
|
});
|
|
@@ -618,7 +571,7 @@ describe('SPARQL screen validation', () => {
|
|
|
618
571
|
confirmModal();
|
|
619
572
|
getModal().should('not.exist');
|
|
620
573
|
|
|
621
|
-
getTabs().should('have.length', 2);
|
|
574
|
+
SparqlSteps.getTabs().should('have.length', 2);
|
|
622
575
|
|
|
623
576
|
verifyTabName(1, 'Tab 1');
|
|
624
577
|
verifyTabName(2, 'Tab 3');
|
|
@@ -640,12 +593,12 @@ describe('SPARQL screen validation', () => {
|
|
|
640
593
|
confirmModal();
|
|
641
594
|
getModal().should('not.exist');
|
|
642
595
|
|
|
643
|
-
getTabs().should('have.length', 1);
|
|
596
|
+
SparqlSteps.getTabs().should('have.length', 1);
|
|
644
597
|
verifyTabName(1, 'Tab 3');
|
|
645
598
|
});
|
|
646
599
|
|
|
647
600
|
it('Test download query results in Supported formats', () => {
|
|
648
|
-
executeQuery();
|
|
601
|
+
SparqlSteps.executeQuery();
|
|
649
602
|
|
|
650
603
|
// Wait until results are visible before verifying the download menu
|
|
651
604
|
getResultsWrapper().should('be.visible');
|
|
@@ -664,7 +617,7 @@ describe('SPARQL screen validation', () => {
|
|
|
664
617
|
});
|
|
665
618
|
|
|
666
619
|
it('Test switch result format tabs', () => {
|
|
667
|
-
executeQuery();
|
|
620
|
+
SparqlSteps.executeQuery();
|
|
668
621
|
|
|
669
622
|
openRawResponse();
|
|
670
623
|
getResultsWrapper()
|
|
@@ -722,7 +675,7 @@ describe('SPARQL screen validation', () => {
|
|
|
722
675
|
cy.get(YASR_SELECTOR).should('have.class', 'vertical');
|
|
723
676
|
|
|
724
677
|
// Run the default query on vertical mode
|
|
725
|
-
executeQuery();
|
|
678
|
+
SparqlSteps.executeQuery();
|
|
726
679
|
// Verify that all results are properly scaled/displayed
|
|
727
680
|
verifyResultsPageLength(70);
|
|
728
681
|
|
|
@@ -735,7 +688,7 @@ describe('SPARQL screen validation', () => {
|
|
|
735
688
|
});
|
|
736
689
|
|
|
737
690
|
context('Saved queries & links', () => {
|
|
738
|
-
beforeEach(() => createRepoAndVisit());
|
|
691
|
+
beforeEach(() => SparqlSteps.createRepoAndVisit(repositoryId));
|
|
739
692
|
|
|
740
693
|
const QUERY_FOR_SAVING = 'select (count (*) as ?cnt)\n' +
|
|
741
694
|
'where {\n' +
|
|
@@ -771,8 +724,8 @@ describe('SPARQL screen validation', () => {
|
|
|
771
724
|
getSavedQueryForm().should('not.exist');
|
|
772
725
|
|
|
773
726
|
// Verify that the query is saved
|
|
774
|
-
openSavedQueriesPopup();
|
|
775
|
-
getPopover()
|
|
727
|
+
SparqlSteps.openSavedQueriesPopup();
|
|
728
|
+
SparqlSteps.getPopover()
|
|
776
729
|
.should('be.visible')
|
|
777
730
|
.and('contain', savedQueryName);
|
|
778
731
|
|
|
@@ -796,8 +749,8 @@ describe('SPARQL screen validation', () => {
|
|
|
796
749
|
|
|
797
750
|
// Verify that the query is edited.
|
|
798
751
|
// Select the query from the saved queries again
|
|
799
|
-
openSavedQueriesPopup();
|
|
800
|
-
getPopover()
|
|
752
|
+
SparqlSteps.openSavedQueriesPopup();
|
|
753
|
+
SparqlSteps.getPopover()
|
|
801
754
|
.should('be.visible')
|
|
802
755
|
.and('contain', savedQueryName);
|
|
803
756
|
|
|
@@ -812,8 +765,8 @@ describe('SPARQL screen validation', () => {
|
|
|
812
765
|
submitSavedQuery();
|
|
813
766
|
|
|
814
767
|
// Click on the saved queries icon
|
|
815
|
-
openSavedQueriesPopup();
|
|
816
|
-
getPopover()
|
|
768
|
+
SparqlSteps.openSavedQueriesPopup();
|
|
769
|
+
SparqlSteps.getPopover()
|
|
817
770
|
.should('be.visible')
|
|
818
771
|
.and('contain', savedQueryName);
|
|
819
772
|
|
|
@@ -826,8 +779,8 @@ describe('SPARQL screen validation', () => {
|
|
|
826
779
|
cy.get('.popover').should('not.exist');
|
|
827
780
|
|
|
828
781
|
// Verify that the query is deleted
|
|
829
|
-
openSavedQueriesPopup();
|
|
830
|
-
getPopover()
|
|
782
|
+
SparqlSteps.openSavedQueriesPopup();
|
|
783
|
+
SparqlSteps.getPopover()
|
|
831
784
|
.should('be.visible')
|
|
832
785
|
.and('not.contain', savedQueryName);
|
|
833
786
|
});
|
|
@@ -880,42 +833,42 @@ describe('SPARQL screen validation', () => {
|
|
|
880
833
|
// Execute all default saved queries
|
|
881
834
|
|
|
882
835
|
// Execute the default sample Add Statements
|
|
883
|
-
selectSavedQuery('Add statements');
|
|
884
|
-
getTabs().should('have.length', 2);
|
|
836
|
+
SparqlSteps.selectSavedQuery('Add statements');
|
|
837
|
+
SparqlSteps.getTabs().should('have.length', 2);
|
|
885
838
|
getActiveTabLink().should('have.text', 'Add statements');
|
|
886
|
-
getQueryArea().should('contain', 'INSERT DATA');
|
|
887
|
-
executeQuery();
|
|
839
|
+
SparqlSteps.getQueryArea().should('contain', 'INSERT DATA');
|
|
840
|
+
SparqlSteps.executeQuery();
|
|
888
841
|
// Verify query information: “Added 2 statements”
|
|
889
842
|
getUpdateMessage()
|
|
890
843
|
.should('contain', 'Added 2 statements.')
|
|
891
844
|
.and('contain', 'Update took');
|
|
892
845
|
|
|
893
846
|
// Execute the default sample Remove statements
|
|
894
|
-
selectSavedQuery('Remove statements');
|
|
895
|
-
getTabs().should('have.length', 3);
|
|
847
|
+
SparqlSteps.selectSavedQuery('Remove statements');
|
|
848
|
+
SparqlSteps.getTabs().should('have.length', 3);
|
|
896
849
|
getActiveTabLink().should('have.text', 'Remove statements');
|
|
897
|
-
getQueryArea().should('contain', 'DELETE DATA');
|
|
898
|
-
executeQuery();
|
|
850
|
+
SparqlSteps.getQueryArea().should('contain', 'DELETE DATA');
|
|
851
|
+
SparqlSteps.executeQuery();
|
|
899
852
|
getUpdateMessage()
|
|
900
853
|
.should('contain', 'Removed 2 statements.')
|
|
901
854
|
.and('contain', 'Update took');
|
|
902
855
|
|
|
903
856
|
// Execute the default sample Clear Graph
|
|
904
|
-
selectSavedQuery('Clear graph');
|
|
905
|
-
getTabs().should('have.length', 4);
|
|
857
|
+
SparqlSteps.selectSavedQuery('Clear graph');
|
|
858
|
+
SparqlSteps.getTabs().should('have.length', 4);
|
|
906
859
|
getActiveTabLink().should('have.text', 'Clear graph');
|
|
907
|
-
getQueryArea().should('contain', 'CLEAR GRAPH');
|
|
908
|
-
executeQuery();
|
|
860
|
+
SparqlSteps.getQueryArea().should('contain', 'CLEAR GRAPH');
|
|
861
|
+
SparqlSteps.executeQuery();
|
|
909
862
|
getUpdateMessage()
|
|
910
863
|
.should('contain', 'The number of statements did not change.')
|
|
911
864
|
.and('contain', 'Update took');
|
|
912
865
|
|
|
913
866
|
// Execute the default SPARQL Select template
|
|
914
|
-
selectSavedQuery('SPARQL Select template');
|
|
915
|
-
getTabs().should('have.length', 5);
|
|
867
|
+
SparqlSteps.selectSavedQuery('SPARQL Select template');
|
|
868
|
+
SparqlSteps.getTabs().should('have.length', 5);
|
|
916
869
|
getActiveTabLink().should('have.text', 'SPARQL Select template');
|
|
917
|
-
getQueryArea().should('contain', 'SELECT');
|
|
918
|
-
executeQuery();
|
|
870
|
+
SparqlSteps.getQueryArea().should('contain', 'SELECT');
|
|
871
|
+
SparqlSteps.executeQuery();
|
|
919
872
|
getUpdateMessage().should('not.be.visible');
|
|
920
873
|
cy.verifyResultsMessage('Showing results from 1 to 74 of 74');
|
|
921
874
|
cy.verifyResultsMessage('Query took');
|
|
@@ -925,8 +878,8 @@ describe('SPARQL screen validation', () => {
|
|
|
925
878
|
|
|
926
879
|
it('Test saved query link', () => {
|
|
927
880
|
const queryName = 'Add statements';
|
|
928
|
-
openSavedQueriesPopup();
|
|
929
|
-
getPopover().should('be.visible');
|
|
881
|
+
SparqlSteps.openSavedQueriesPopup();
|
|
882
|
+
SparqlSteps.getPopover().should('be.visible');
|
|
930
883
|
|
|
931
884
|
executeSavedQueryCommand(queryName, OPEN_SAVED_QUERY_COMMAND);
|
|
932
885
|
|
|
@@ -939,13 +892,13 @@ describe('SPARQL screen validation', () => {
|
|
|
939
892
|
|
|
940
893
|
// Visit performs full page load
|
|
941
894
|
cy.visit(expectedUrl);
|
|
942
|
-
waitUntilSparqlPageIsLoaded();
|
|
895
|
+
SparqlSteps.waitUntilSparqlPageIsLoaded();
|
|
943
896
|
|
|
944
|
-
getTabs().should('have.length', 2);
|
|
897
|
+
SparqlSteps.getTabs().should('have.length', 2);
|
|
945
898
|
getActiveTabLink().should('have.text', queryName);
|
|
946
899
|
|
|
947
900
|
// Wait until editor is initialized with the query and then assert the whole query
|
|
948
|
-
getQueryArea().should('contain', 'INSERT DATA');
|
|
901
|
+
SparqlSteps.getQueryArea().should('contain', 'INSERT DATA');
|
|
949
902
|
cy.fixture('queries/add-statement.txt').then((query) => {
|
|
950
903
|
// Convert new line symbols to \n regardless of OS. Query in SPARQL editor uses \n for new line.
|
|
951
904
|
const EOLregex = /(\r\n|\r|\n)/g;
|
|
@@ -975,11 +928,11 @@ describe('SPARQL screen validation', () => {
|
|
|
975
928
|
|
|
976
929
|
// Visit performs full page load
|
|
977
930
|
cy.visit(expectedUrl);
|
|
978
|
-
waitUntilSparqlPageIsLoaded();
|
|
979
|
-
getTabs().should('have.length', 1);
|
|
931
|
+
SparqlSteps.waitUntilSparqlPageIsLoaded();
|
|
932
|
+
SparqlSteps.getTabs().should('have.length', 1);
|
|
980
933
|
|
|
981
934
|
// Wait until editor is initialized with the query and then assert the whole query
|
|
982
|
-
getQueryArea().should('contain', 'SELECT');
|
|
935
|
+
SparqlSteps.getQueryArea().should('contain', 'SELECT');
|
|
983
936
|
verifyQueryAreaEquals(query);
|
|
984
937
|
});
|
|
985
938
|
});
|
|
@@ -990,12 +943,12 @@ describe('SPARQL screen validation', () => {
|
|
|
990
943
|
const wineUri = '<http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#CorbansDryWhiteRiesling>';
|
|
991
944
|
|
|
992
945
|
it('should suggest resources in the "SPARQL" editor when autocomplete is enabled', () => {
|
|
993
|
-
createRepository();
|
|
946
|
+
SparqlSteps.createRepository(repositoryId);
|
|
994
947
|
|
|
995
948
|
cy.importServerFile(repositoryId, FILE_TO_IMPORT);
|
|
996
949
|
|
|
997
950
|
cy.enableAutocomplete(repositoryId);
|
|
998
|
-
visitSparql(true);
|
|
951
|
+
SparqlSteps.visitSparql(true, repositoryId);
|
|
999
952
|
|
|
1000
953
|
const expectedQuery = queryBegin + wineUri + queryEnd;
|
|
1001
954
|
|
|
@@ -1016,7 +969,7 @@ describe('SPARQL screen validation', () => {
|
|
|
1016
969
|
|
|
1017
970
|
verifyQueryAreaEquals(expectedQuery);
|
|
1018
971
|
|
|
1019
|
-
executeQuery();
|
|
972
|
+
SparqlSteps.executeQuery();
|
|
1020
973
|
|
|
1021
974
|
getResultsWrapper().should('be.visible');
|
|
1022
975
|
|
|
@@ -1024,7 +977,7 @@ describe('SPARQL screen validation', () => {
|
|
|
1024
977
|
});
|
|
1025
978
|
|
|
1026
979
|
it('should not suggests resources in the "SPARQL" editor if the autocomplete is NOT enabled', () => {
|
|
1027
|
-
createRepoAndVisit();
|
|
980
|
+
SparqlSteps.createRepoAndVisit(repositoryId);
|
|
1028
981
|
|
|
1029
982
|
clearQuery();
|
|
1030
983
|
|
|
@@ -1045,26 +998,6 @@ describe('SPARQL screen validation', () => {
|
|
|
1045
998
|
const YASR_SELECTOR = '#yasr';
|
|
1046
999
|
const YASR_INNER_SELECTOR = '#yasr-inner';
|
|
1047
1000
|
|
|
1048
|
-
function executeQuery() {
|
|
1049
|
-
getRunQueryButton().click();
|
|
1050
|
-
getLoader().should('not.exist');
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
function getLoader() {
|
|
1054
|
-
return cy.get('.ot-loader-new-content');
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
function getPopover() {
|
|
1058
|
-
return cy.get('.popover')
|
|
1059
|
-
.should('not.have.class', 'ng-animate')
|
|
1060
|
-
.and('not.have.class', 'in-add')
|
|
1061
|
-
.and('not.have.class', 'in-add-active');
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
function getRunQueryButton() {
|
|
1065
|
-
return cy.get('#wb-sparql-runQuery');
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
1001
|
function getTableResultRows() {
|
|
1069
1002
|
return getResultsWrapper().find('.resultsTable tbody tr');
|
|
1070
1003
|
}
|
|
@@ -1097,10 +1030,6 @@ describe('SPARQL screen validation', () => {
|
|
|
1097
1030
|
.click();
|
|
1098
1031
|
}
|
|
1099
1032
|
|
|
1100
|
-
function getTabs() {
|
|
1101
|
-
return cy.get(TABS_SELECTOR);
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
1033
|
function getActiveTabLink() {
|
|
1105
1034
|
return cy.get(TABS_SELECTOR + '.active .nav-link');
|
|
1106
1035
|
}
|
|
@@ -1114,13 +1043,13 @@ describe('SPARQL screen validation', () => {
|
|
|
1114
1043
|
}
|
|
1115
1044
|
|
|
1116
1045
|
function getLastTab() {
|
|
1117
|
-
return getTabs().last();
|
|
1046
|
+
return SparqlSteps.getTabs().last();
|
|
1118
1047
|
}
|
|
1119
1048
|
|
|
1120
1049
|
function renameTab(position, newName) {
|
|
1121
|
-
getTabs().eq(position - 1).then(tab => {
|
|
1050
|
+
SparqlSteps.getTabs().eq(position - 1).then(tab => {
|
|
1122
1051
|
cy.wrap(tab)
|
|
1123
|
-
|
|
1052
|
+
// First click is to focus it in case it's not the active tab
|
|
1124
1053
|
.click()
|
|
1125
1054
|
.find('.nav-link')
|
|
1126
1055
|
.dblclick();
|
|
@@ -1136,14 +1065,14 @@ describe('SPARQL screen validation', () => {
|
|
|
1136
1065
|
}
|
|
1137
1066
|
|
|
1138
1067
|
function verifyTabName(position, name) {
|
|
1139
|
-
getTabs().eq(position - 1)
|
|
1068
|
+
SparqlSteps.getTabs().eq(position - 1)
|
|
1140
1069
|
.should('be.visible')
|
|
1141
1070
|
.find('.nav-link')
|
|
1142
1071
|
.should('have.text', name);
|
|
1143
1072
|
}
|
|
1144
1073
|
|
|
1145
1074
|
function getTabCloseBtn(position) {
|
|
1146
|
-
return getTabs().eq(position - 1).find('.delete-sparql-tab-btn');
|
|
1075
|
+
return SparqlSteps.getTabs().eq(position - 1).find('.delete-sparql-tab-btn');
|
|
1147
1076
|
}
|
|
1148
1077
|
|
|
1149
1078
|
function closeTab(position) {
|
|
@@ -1153,24 +1082,20 @@ describe('SPARQL screen validation', () => {
|
|
|
1153
1082
|
function verifyQueryAreaContains(query) {
|
|
1154
1083
|
// Using the CodeMirror instance because getting the value from the DOM is very cumbersome
|
|
1155
1084
|
cy.waitUntil(() =>
|
|
1156
|
-
getQueryArea()
|
|
1085
|
+
SparqlSteps.getQueryArea()
|
|
1157
1086
|
.then(codeMirrorEl => codeMirrorEl && codeMirrorEl[0].CodeMirror.getValue().includes(query)));
|
|
1158
1087
|
}
|
|
1159
1088
|
|
|
1160
1089
|
function verifyQueryAreaEquals(query) {
|
|
1161
1090
|
// Using the CodeMirror instance because getting the value from the DOM is very cumbersome
|
|
1162
|
-
getQueryArea().should(codeMirrorEl => {
|
|
1091
|
+
SparqlSteps.getQueryArea().should(codeMirrorEl => {
|
|
1163
1092
|
const cm = codeMirrorEl[0].CodeMirror;
|
|
1164
1093
|
expect(cm.getValue().trim()).to.equal(query.trim());
|
|
1165
1094
|
});
|
|
1166
1095
|
}
|
|
1167
1096
|
|
|
1168
|
-
function getQueryArea() {
|
|
1169
|
-
return cy.get('#queryEditor .CodeMirror');
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
1097
|
function getQueryTextArea() {
|
|
1173
|
-
return getQueryArea().find('textarea');
|
|
1098
|
+
return SparqlSteps.getQueryArea().find('textarea');
|
|
1174
1099
|
}
|
|
1175
1100
|
|
|
1176
1101
|
function getNoQueryRun() {
|
|
@@ -1192,7 +1117,7 @@ describe('SPARQL screen validation', () => {
|
|
|
1192
1117
|
|
|
1193
1118
|
function goToPage(page) {
|
|
1194
1119
|
getResultPages().contains(page).click();
|
|
1195
|
-
getLoader().should('not.exist');
|
|
1120
|
+
SparqlSteps.getLoader().should('not.exist');
|
|
1196
1121
|
}
|
|
1197
1122
|
|
|
1198
1123
|
function getResultFilterField() {
|
|
@@ -1291,33 +1216,10 @@ describe('SPARQL screen validation', () => {
|
|
|
1291
1216
|
return cy.get('#wb-sparql-sampleValue');
|
|
1292
1217
|
}
|
|
1293
1218
|
|
|
1294
|
-
function getSavedQueriesPopupBtn() {
|
|
1295
|
-
return cy.get('#wb-sparql-toggleSampleQueries');
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
function openSavedQueriesPopup() {
|
|
1299
|
-
getSavedQueriesPopupBtn().click();
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
function getSavedQueryFromPopup(savedQueryName) {
|
|
1303
|
-
return cy.get('#wb-sparql-queryInSampleQueries')
|
|
1304
|
-
.contains(savedQueryName)
|
|
1305
|
-
.closest('.saved-query');
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
function selectSavedQuery(savedQueryName) {
|
|
1309
|
-
openSavedQueriesPopup();
|
|
1310
|
-
getPopover().should('be.visible');
|
|
1311
|
-
getSavedQueryFromPopup(savedQueryName)
|
|
1312
|
-
.find('a')
|
|
1313
|
-
// the popup is opened and the link with the text is visible but cypress think it's 0x0px width/height
|
|
1314
|
-
.click({force: true});
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
1219
|
function executeSavedQueryCommand(savedQueryName, commandSelector) {
|
|
1318
|
-
getSavedQueryFromPopup(savedQueryName)
|
|
1319
|
-
|
|
1320
|
-
|
|
1220
|
+
SparqlSteps.getSavedQueryFromPopup(savedQueryName)
|
|
1221
|
+
// Current implementation of the saved queries popup always render the action bar next to
|
|
1222
|
+
// each query item but it's just hidden with opacity: 0. So IMO it's safe to force it here.
|
|
1321
1223
|
.trigger('mouseover', {force: true})
|
|
1322
1224
|
.find('.actions-bar')
|
|
1323
1225
|
.find(commandSelector)
|