graphdb-workbench-tests 2.2.2 → 2.2.3-TR2

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.
@@ -32,5 +32,27 @@ describe('YASQE and YASR language change validation', () => {
32
32
  SparqlSteps.getEditorAndResultsBtn().should('contain', 'Éditeur et résultats');
33
33
  SparqlSteps.getResultsOnlyBtn().should('contain', 'Résultats seulement');
34
34
  });
35
+
36
+ it('should change "Download as" dropdown label. Test "GDB-8100" bug.', () => {
37
+
38
+ // When I visit a page with YASQE and YASR in it,
39
+ // and execute a query.
40
+ SparqlSteps.executeQuery();
41
+
42
+ // Then I expect 'Download as' to be translated to English.
43
+ SparqlSteps.getDownloadBtn().should('contain', 'Download as');
44
+
45
+ // When I change the language.
46
+ SparqlSteps.changeLanguage('fr');
47
+
48
+ // Then I expect 'Download as' to be translated to French.
49
+ SparqlSteps.getDownloadBtn().should('contain', 'Téléchargement');
50
+
51
+ // When I rerun the query.
52
+ SparqlSteps.executeQuery();
53
+
54
+ // Then I expect 'Download as' to be translated to French.
55
+ SparqlSteps.getDownloadBtn().should('contain', 'Téléchargement');
56
+ });
35
57
  });
36
58
  });
@@ -0,0 +1,69 @@
1
+ import SparqlSteps from "../../steps/sparql-steps";
2
+
3
+ describe('Formatting of SPARQL result bindings.', () => {
4
+ let repositoryId;
5
+
6
+ beforeEach(() => {
7
+ repositoryId = 'sparql-' + Date.now();
8
+ SparqlSteps.createRepoAndVisit(repositoryId);
9
+ });
10
+
11
+ afterEach(() => {
12
+ cy.deleteRepository(repositoryId);
13
+ });
14
+
15
+ it('should format result cell properly if result binding is IRI', () => {
16
+ // When I execute a query that returns IRI result.
17
+ SparqlSteps.typeQuery('select * where { values (?x ) { (<http://example.com/foobarbaz/meow/123>) }}');
18
+ SparqlSteps.executeQuery();
19
+
20
+ // Then I expect "/" character and "://" sequence to be followed by <wbr> tag.
21
+ SparqlSteps.getResultCellLink(0, 1).then(function($el) {
22
+ expect($el.html()).to.eq('http://<wbr>example.com/<wbr>foobarbaz/<wbr>meow/<wbr>123');
23
+ });
24
+ // and break-word is applied,
25
+ SparqlSteps.getResultCellLink(0, 1).should('have.css', 'word-wrap', 'break-word');
26
+ SparqlSteps.getResultUriCell(0, 1).should('have.attr', 'lang', 'xx');
27
+ });
28
+
29
+ it('should format properly result cell if result binding is literal and has language tag', () => {
30
+ // When I execute a query that returns literal result.
31
+ SparqlSteps.typeQuery('select * where { values (?x ) { ("some text "@en-GB) }}');
32
+ SparqlSteps.executeQuery();
33
+
34
+ // Then I expect break-word is applied,
35
+ SparqlSteps.getResultNoUriCell(0, 1).should('have.css', 'word-wrap', 'break-word');
36
+ // language attribute is applied.
37
+ SparqlSteps.getResultLiteralCell(0, 1).should('have.attr', 'lang', 'en-GB');
38
+ SparqlSteps.getResultLiteralCell(0, 1).should('have.css', 'hyphens', 'auto');
39
+ });
40
+
41
+ it('should format properly result cell if result binding is literal and has not language tag', () => {
42
+ // When I execute a query that returns literal result.
43
+ SparqlSteps.typeQuery('select * where { values (?x ) { ("some text ") }}');
44
+ SparqlSteps.executeQuery();
45
+
46
+ // Then I expect break-word is applied,
47
+ SparqlSteps.getResultNoUriCell(0, 1).should('have.css', 'word-wrap', 'break-word');
48
+ // language attribute is applied.
49
+ SparqlSteps.getResultLiteralCell(0, 1).should('have.attr', 'lang', 'xx');
50
+ SparqlSteps.getResultLiteralCell(0, 1).should('have.css', 'hyphens', 'auto');
51
+ });
52
+
53
+ it('should format result cell properly if result binding is literal and contains data type value', () => {
54
+ // When I execute a query that returns literal result.
55
+ SparqlSteps.typeQuery('select * where { values (?x ) { ("some text with data type 2.0^^xsd:floatsup") }}');
56
+ SparqlSteps.executeQuery();
57
+
58
+ // Then I expect "^^" to be prefixed with <wbr> tag,
59
+ SparqlSteps.getResultNoUriCell(0, 1).then(function($el) {
60
+ expect($el.html()).to.eq("\"some text with data type 2.0<wbr>^^xsd:<wbr>floatsup\"");
61
+ });
62
+
63
+ // and I expect break-word is applied,
64
+ SparqlSteps.getResultCell(0, 1).should('have.css', 'word-wrap', 'break-word');
65
+ // and language attribute is applied.
66
+ SparqlSteps.getResultLiteralCell(0, 1).should('have.attr', 'lang', 'xx');
67
+ SparqlSteps.getResultLiteralCell(0, 1).should('have.css', 'hyphens', 'auto');
68
+ });
69
+ });
@@ -88,7 +88,7 @@ describe('SPARQL screen validation', () => {
88
88
 
89
89
  it('Test modify default query', () => {
90
90
  // Run custom query returning 1001 results
91
- typeQuery(DEFAULT_QUERY_MODIFIED);
91
+ SparqlSteps.typeQuery(DEFAULT_QUERY_MODIFIED);
92
92
 
93
93
  verifyQueryAreaEquals(DEFAULT_QUERY_MODIFIED);
94
94
 
@@ -109,7 +109,7 @@ describe('SPARQL screen validation', () => {
109
109
  it('Test execute sparqlstar query', () => {
110
110
  cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
111
111
 
112
- typeQuery(SPARQL_STAR_QUERY);
112
+ SparqlSteps.typeQuery(SPARQL_STAR_QUERY);
113
113
 
114
114
  verifyQueryAreaEquals(SPARQL_STAR_QUERY);
115
115
 
@@ -119,9 +119,9 @@ describe('SPARQL screen validation', () => {
119
119
 
120
120
  verifyResultsPageLength(104);
121
121
 
122
- getTableResultRows().should('contain', '<<');
122
+ SparqlSteps.getTableResultRows().should('contain', '<<');
123
123
 
124
- getTableResultRows().should('contain', 'http://bigdata.com/RDF#bob');
124
+ SparqlSteps.getTableResultRows().should('contain', 'http://bigdata.com/RDF#bob');
125
125
  });
126
126
 
127
127
  it('Test execute sparqlstar select with bind query', () => {
@@ -129,7 +129,7 @@ describe('SPARQL screen validation', () => {
129
129
 
130
130
  let selectQuery = 'select * {bind (<<?s ?p ?o>> as ?t) .}';
131
131
 
132
- typeQuery(selectQuery);
132
+ SparqlSteps.typeQuery(selectQuery);
133
133
 
134
134
  verifyQueryAreaEquals(selectQuery);
135
135
 
@@ -139,9 +139,9 @@ describe('SPARQL screen validation', () => {
139
139
 
140
140
  verifyResultsPageLength(3);
141
141
 
142
- getTableResultRows().should('contain', '<<');
142
+ SparqlSteps.getTableResultRows().should('contain', '<<');
143
143
 
144
- getTableResultRows().should('contain', 'http://bigdata.com/RDF#bob');
144
+ SparqlSteps.getTableResultRows().should('contain', 'http://bigdata.com/RDF#bob');
145
145
  });
146
146
 
147
147
  it('Test execute sparqlstar insert query', () => {
@@ -149,7 +149,7 @@ describe('SPARQL screen validation', () => {
149
149
 
150
150
  let insertQuery = 'insert data {<<<urn:a> <urn:p> 1>> <urn:x> 2}';
151
151
 
152
- typeQuery(insertQuery);
152
+ SparqlSteps.typeQuery(insertQuery);
153
153
 
154
154
  verifyQueryAreaEquals(insertQuery);
155
155
 
@@ -168,7 +168,7 @@ describe('SPARQL screen validation', () => {
168
168
  let selectQuery = "PREFIX bd: <http://bigdata.com/RDF#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
169
169
  "select * where {<<bd:bob foaf:mbox <mailto:bob@home>>> ?p ?o .}";
170
170
 
171
- typeQuery(selectQuery);
171
+ SparqlSteps.typeQuery(selectQuery);
172
172
 
173
173
  verifyQueryAreaEquals(selectQuery);
174
174
 
@@ -178,7 +178,7 @@ describe('SPARQL screen validation', () => {
178
178
 
179
179
  verifyResultsPageLength(4);
180
180
 
181
- getTableResultRows().should('contain', 'http://hr.example.com/employees/bob');
181
+ SparqlSteps.getTableResultRows().should('contain', 'http://hr.example.com/employees/bob');
182
182
  });
183
183
 
184
184
  it('Test execute sparqlstar delete query and search for deleted triple', () => {
@@ -188,7 +188,7 @@ describe('SPARQL screen validation', () => {
188
188
  "PREFIX dc: <http://purl.org/dc/terms/>\nPREFIX re: <http://reasoner.example.com/engines#>\n" +
189
189
  "delete data {<<bd:alice foaf:knows bd:bob>> dc:source re:engine_1.}";
190
190
 
191
- typeQuery(deleteQuery);
191
+ SparqlSteps.typeQuery(deleteQuery);
192
192
 
193
193
  verifyQueryAreaEquals(deleteQuery);
194
194
 
@@ -204,7 +204,7 @@ describe('SPARQL screen validation', () => {
204
204
  "PREFIX dc: <http://purl.org/dc/terms/>\nPREFIX re: <http://reasoner.example.com/engines#>\n" +
205
205
  "select * where {<<bd:alice foaf:knows bd:bob>> dc:source re:engine_1.}";
206
206
 
207
- typeQuery(selectQuery);
207
+ SparqlSteps.typeQuery(selectQuery);
208
208
 
209
209
  verifyQueryAreaEquals(selectQuery);
210
210
 
@@ -232,15 +232,15 @@ describe('SPARQL screen validation', () => {
232
232
  cy.verifyResultsMessage('Showing results');
233
233
  cy.verifyResultsMessage('Query took');
234
234
 
235
- getResultsWrapper()
235
+ SparqlSteps.getResultsWrapper()
236
236
  .should('be.visible');
237
237
 
238
238
  getResultPages().should('have.length', 1);
239
239
  verifyResultsPageLength(9);
240
240
 
241
- getTableResultRows().should('contain', '<<');
241
+ SparqlSteps.getTableResultRows().should('contain', '<<');
242
242
 
243
- getTableResultRows().should('contain', 'http://bigdata.com/RDF#bob');
243
+ SparqlSteps.getTableResultRows().should('contain', 'http://bigdata.com/RDF#bob');
244
244
 
245
245
  // Confirm that all tabs Raw Response, Pivot Table, Google chart are enabled
246
246
  getTableResponseButton().should('be.visible').and('not.be.disabled');
@@ -252,7 +252,7 @@ describe('SPARQL screen validation', () => {
252
252
  it('Should check for XML star download format', () => {
253
253
  cy.importServerFile(repositoryId, RDF_STAR_FILE_TO_IMPORT);
254
254
 
255
- typeQuery(SPARQL_STAR_QUERY);
255
+ SparqlSteps.typeQuery(SPARQL_STAR_QUERY);
256
256
 
257
257
  verifyQueryAreaEquals(SPARQL_STAR_QUERY);
258
258
 
@@ -288,7 +288,7 @@ describe('SPARQL screen validation', () => {
288
288
  // Yasqe blows when inserting prefixes for some reason....
289
289
  disableExceptions();
290
290
 
291
- typeQuery(prefixQuery);
291
+ SparqlSteps.typeQuery(prefixQuery);
292
292
  });
293
293
 
294
294
  // Should have inserted the prefixes
@@ -298,7 +298,7 @@ describe('SPARQL screen validation', () => {
298
298
  SparqlSteps.executeQuery();
299
299
 
300
300
  cy.getResultsMessage();
301
- getResultsWrapper()
301
+ SparqlSteps.getResultsWrapper()
302
302
  .should('be.visible');
303
303
  });
304
304
 
@@ -311,7 +311,7 @@ describe('SPARQL screen validation', () => {
311
311
 
312
312
  cy.verifyResultsMessage('Showing results')
313
313
  cy.verifyResultsMessage('Query took');
314
- getResultsWrapper()
314
+ SparqlSteps.getResultsWrapper()
315
315
  .should('be.visible');
316
316
 
317
317
  // Confirm that all tabs Raw Response, Pivot Table, Google chart are enabled
@@ -353,7 +353,7 @@ describe('SPARQL screen validation', () => {
353
353
  SparqlSteps.executeQuery();
354
354
 
355
355
  cy.getResultsMessage();
356
- getResultsWrapper()
356
+ SparqlSteps.getResultsWrapper()
357
357
  .should('be.visible');
358
358
 
359
359
  // Confirm that all tabs (Table, Pivot Table, Google chart) are disabled
@@ -375,18 +375,18 @@ describe('SPARQL screen validation', () => {
375
375
  verifyResultsPageLength(44);
376
376
  cy.pasteQuery(LIST_TEXT_MINING_SERVICES);
377
377
  cy.executeQuery();
378
- getTableResultRows().should('contain', 'http://www.ontotext.com/textmining/instance#gateService');
378
+ SparqlSteps.getTableResultRows().should('contain', 'http://www.ontotext.com/textmining/instance#gateService');
379
379
  cy.pasteQuery(LIST_TEXT_MINING_INSTANCE_CONFIG);
380
380
  cy.executeQuery();
381
- getTableResultRows().should('contain', 'http://www.ontotext.com/textmining#Gate');
382
- getTableResultRows().should('contain', 'http://www.ontotext.com/textmining#connect');
383
- getTableResultRows().should('contain', 'https://cloud-api.gate.ac.uk');
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
384
  cy.pasteQuery(DROP_TEXT_MINING_INSTANCE);
385
385
  cy.executeQuery();
386
386
  cy.pasteQuery(LIST_TEXT_MINING_SERVICES);
387
387
  cy.executeQuery();
388
388
  getResultPages().should('have.length', 1);
389
- getTableResultRows().should('contain', 'No data available in table');
389
+ SparqlSteps.getTableResultRows().should('contain', 'No data available in table');
390
390
  });
391
391
  });
392
392
 
@@ -416,7 +416,7 @@ describe('SPARQL screen validation', () => {
416
416
  SparqlSteps.executeQuery();
417
417
 
418
418
  cy.verifyResultsMessage('1,000 of 7,065');
419
- getResultsWrapper()
419
+ SparqlSteps.getResultsWrapper()
420
420
  .should('be.visible');
421
421
  verifyResultsPageLength(1000);
422
422
 
@@ -574,7 +574,7 @@ describe('SPARQL screen validation', () => {
574
574
  SparqlSteps.executeQuery();
575
575
 
576
576
  // Wait until results are visible before verifying the download menu
577
- getResultsWrapper().should('be.visible');
577
+ SparqlSteps.getResultsWrapper().should('be.visible');
578
578
  verifyResultsPageLength(70);
579
579
 
580
580
  openDownloadAsMenu();
@@ -593,12 +593,12 @@ describe('SPARQL screen validation', () => {
593
593
  SparqlSteps.executeQuery();
594
594
 
595
595
  openRawResponse();
596
- getResultsWrapper()
596
+ SparqlSteps.getResultsWrapper()
597
597
  .find('.CodeMirror-code')
598
598
  .should('be.visible');
599
599
 
600
600
  openPivotTable();
601
- getResultsWrapper()
601
+ SparqlSteps.getResultsWrapper()
602
602
  .find('.pivotTable table.pvtUi')
603
603
  .should('be.visible');
604
604
 
@@ -606,7 +606,7 @@ describe('SPARQL screen validation', () => {
606
606
  disableExceptions();
607
607
 
608
608
  openGoogleChart();
609
- getResultsWrapper()
609
+ SparqlSteps.getResultsWrapper()
610
610
  .find('#yasr-inner_gchartWrapper .google-visualization-table')
611
611
  .should('be.visible');
612
612
  });
@@ -929,11 +929,11 @@ describe('SPARQL screen validation', () => {
929
929
 
930
930
  const expectedQuery = queryBegin + wineUri + queryEnd;
931
931
 
932
- clearQuery();
932
+ SparqlSteps.clearQuery();
933
933
 
934
- typeQuery(queryBegin, false);
934
+ SparqlSteps.typeQuery(queryBegin, false);
935
935
  // TODO: Need to test Alt-Enter too
936
- typeQuery('Dry' + Cypress.env('modifierKey') + ' ', false, true);
936
+ SparqlSteps.typeQuery('Dry' + Cypress.env('modifierKey') + ' ', false, true);
937
937
 
938
938
  getAutoSuggestHints()
939
939
  .should('be.visible')
@@ -942,13 +942,13 @@ describe('SPARQL screen validation', () => {
942
942
  .click()
943
943
  .should('not.exist');
944
944
 
945
- typeQuery(queryEnd, false);
945
+ SparqlSteps.typeQuery(queryEnd, false);
946
946
 
947
947
  verifyQueryAreaEquals(expectedQuery);
948
948
 
949
949
  SparqlSteps.executeQuery();
950
950
 
951
- getResultsWrapper().should('be.visible');
951
+ SparqlSteps.getResultsWrapper().should('be.visible');
952
952
 
953
953
  verifyResultsPageLength(10);
954
954
  });
@@ -957,11 +957,11 @@ describe('SPARQL screen validation', () => {
957
957
  repositoryId = 'sparql-' + Date.now();
958
958
  SparqlSteps.createRepoAndVisit(repositoryId);
959
959
 
960
- clearQuery();
960
+ SparqlSteps.clearQuery();
961
961
 
962
- typeQuery(queryBegin, false);
962
+ SparqlSteps.typeQuery(queryBegin, false);
963
963
  // TODO: Need to test Alt-Enter too
964
- typeQuery('Dry' + Cypress.env('modifierKey') + ' ', false, true);
964
+ SparqlSteps.typeQuery('Dry' + Cypress.env('modifierKey') + ' ', false, true);
965
965
 
966
966
  getAutoSuggestHints().should('not.exist');
967
967
  getToast()
@@ -976,12 +976,8 @@ describe('SPARQL screen validation', () => {
976
976
  const YASR_SELECTOR = '#yasr';
977
977
  const YASR_INNER_SELECTOR = '#yasr-inner';
978
978
 
979
- function getTableResultRows() {
980
- return getResultsWrapper().find('.resultsTable tbody tr');
981
- }
982
-
983
979
  function verifyResultsPageLength(resultLength) {
984
- getTableResultRows()
980
+ SparqlSteps.getTableResultRows()
985
981
  .should('have.length', resultLength);
986
982
  }
987
983
 
@@ -1072,27 +1068,10 @@ describe('SPARQL screen validation', () => {
1072
1068
  });
1073
1069
  }
1074
1070
 
1075
- function getQueryTextArea() {
1076
- return SparqlSteps.getQueryArea().find('textarea');
1077
- }
1078
-
1079
1071
  function getNoQueryRun() {
1080
1072
  return cy.get('#yasr-inner .no-query-run');
1081
1073
  }
1082
1074
 
1083
- function clearQuery() {
1084
- // Using force because the textarea is not visible
1085
- getQueryTextArea().type(Cypress.env('modifierKey') + 'a{backspace}', {force: true});
1086
- }
1087
-
1088
- function typeQuery(query, clear = true, parseSpecialCharSequences = false) {
1089
- if (clear) {
1090
- clearQuery();
1091
- }
1092
- // Using force because the textarea is not visible
1093
- getQueryTextArea().type(query, {force: true, parseSpecialCharSequences});
1094
- }
1095
-
1096
1075
  function goToPage(page) {
1097
1076
  getResultPages().contains(page).click();
1098
1077
  SparqlSteps.getLoader().should('not.exist');
@@ -1214,10 +1193,6 @@ describe('SPARQL screen validation', () => {
1214
1193
  return cy.get('#wb-sparql-copyToClipboardQuery');
1215
1194
  }
1216
1195
 
1217
- function getResultsWrapper() {
1218
- return cy.get('#yasr-inner .yasr_results');
1219
- }
1220
-
1221
1196
  function getResultsHeader() {
1222
1197
  return cy.get('#yasr .yasr_header');
1223
1198
  }
@@ -1248,7 +1223,7 @@ describe('SPARQL screen validation', () => {
1248
1223
  }
1249
1224
 
1250
1225
  function getBooleanResult() {
1251
- return getResultsWrapper().find('.booleanBootResult');
1226
+ return SparqlSteps.getResultsWrapper().find('.booleanBootResult');
1252
1227
  }
1253
1228
 
1254
1229
  function getResultsDownloadButton() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.2.2",
3
+ "version": "2.2.3-TR2",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "start": "cypress open",
@@ -149,6 +149,51 @@ class SparqlSteps {
149
149
  static getResultsDescription() {
150
150
  return cy.get('.results-description');
151
151
  }
152
+
153
+ static typeQuery(query, clear = true, parseSpecialCharSequences = false) {
154
+ if (clear) {
155
+ SparqlSteps.clearQuery();
156
+ }
157
+ // Using force because the textarea is not visible
158
+ SparqlSteps.getQueryTextArea().type(query, {force: true, parseSpecialCharSequences});
159
+ }
160
+
161
+ static clearQuery() {
162
+ // Using force because the textarea is not visible
163
+ SparqlSteps.getQueryTextArea().type(Cypress.env('modifierKey') + 'a{backspace}', {force: true});
164
+ }
165
+
166
+ static getQueryTextArea() {
167
+ return SparqlSteps.getQueryArea().find('textarea');
168
+ }
169
+
170
+ static getResultsWrapper() {
171
+ return cy.get('#yasr-inner .yasr_results');
172
+ }
173
+
174
+ static getTableResultRows() {
175
+ return SparqlSteps.getResultsWrapper().find('.resultsTable tbody tr');
176
+ }
177
+
178
+ static getResultCell(rowIndex, columnIndex) {
179
+ return SparqlSteps.getTableResultRows().eq(rowIndex).find('td').eq(columnIndex);
180
+ }
181
+
182
+ static getResultCellLink(rowIndex, columnIndex) {
183
+ return SparqlSteps.getResultCell(rowIndex, columnIndex).find('a').eq(0);
184
+ }
185
+
186
+ static getResultUriCell(rowIndex, columnIndex) {
187
+ return SparqlSteps.getResultCell(rowIndex, columnIndex).find('.uri-cell');
188
+ }
189
+
190
+ static getResultLiteralCell(rowIndex, columnIndex) {
191
+ return SparqlSteps.getResultCell(rowIndex, columnIndex).find('.literal-cell');
192
+ }
193
+
194
+ static getResultNoUriCell(rowIndex, columnIndex) {
195
+ return SparqlSteps.getResultCell(rowIndex, columnIndex).find('.nonUri');
196
+ }
152
197
  }
153
198
 
154
199
  export default SparqlSteps;