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
@@ -0,0 +1,258 @@
1
+ import {SecurityStubs} from "../security-stubs";
2
+
3
+ export class QueryStubs {
4
+
5
+ static stubInferAndSameAsDefaults(infer = true, sameAs = true) {
6
+ SecurityStubs.stubInferAndSameAsDefaults();
7
+ SecurityStubs.stubUserSecurity(infer, sameAs);
8
+ }
9
+
10
+ static stubQueryCountResponse() {
11
+ cy.intercept('GET', '/rest/monitor/query/count', {body: 0});
12
+ }
13
+
14
+ static stubDefaultQueryResponse(repositoryId, withDelay = 0) {
15
+ QueryStubs.stubQueryResponse(repositoryId, '/graphql-editor/default-query-response.json', withDelay);
16
+ }
17
+
18
+ static stubEmptyQueryResponse(repositoryId, withDelay = 0) {
19
+ QueryStubs.stubQueryResponse(repositoryId, '/queries/empty-query-response.json', withDelay);
20
+ }
21
+
22
+ static stubDownloadAsJSONResponse(repositoryId, withDelay = 0) {
23
+ cy.intercept(`/repositories/${repositoryId}`, (req) => {}).as('download');
24
+ }
25
+
26
+ static stubDefaultTripleQueryResponse(repositoryId, withDelay = 0) {
27
+ QueryStubs.stubQueryResponse(repositoryId, '/queries/default-triple-query-response.json', withDelay);
28
+ }
29
+
30
+ static stubQueryResponse(repositoryId, fixture, withDelay = 0) {
31
+ cy.intercept(`/repositories/${repositoryId}`, {fixture, delay: withDelay}).as(`${repositoryId}-stub-query`);
32
+ }
33
+
34
+ static stubQueryResults(queryDescription) {
35
+ const resultType = queryDescription.resultType;
36
+ const pageSize = queryDescription.pageSize;
37
+ const totalElements = queryDescription.totalElements;
38
+ const countQuery = queryDescription.countQuery;
39
+ const repositoryId = queryDescription.repositoryId;
40
+
41
+ const fullyFiledPages = Math.floor(totalElements / pageSize);
42
+ const elementsForLastPage = totalElements % pageSize;
43
+ const limit = countQuery ? pageSize + 1 : pageSize;
44
+
45
+ // Stubs responses for all fully filled pages.
46
+ for (let pageNumber = 0; pageNumber < fullyFiledPages; pageNumber++) {
47
+ const offset = pageNumber * pageSize;
48
+ let returnElements = pageSize;
49
+
50
+ if (QueryStubs.isLastPage(pageNumber, fullyFiledPages)) {
51
+ // Check if there are more results, if yes the query must return one more result.
52
+ if (elementsForLastPage > 0 && countQuery) {
53
+ returnElements += 1;
54
+ }
55
+ } else {
56
+ if (countQuery) {
57
+ // If there are more pages the query must return one more result.
58
+ returnElements += 1;
59
+ }
60
+ }
61
+ const page = pageNumber + 1;
62
+ QueryStubs.stubQueryWithResults(repositoryId, page, offset, limit, returnElements, resultType);
63
+ }
64
+
65
+ // Stubs the last page with.
66
+ if (elementsForLastPage > 0) {
67
+ const offset = fullyFiledPages * pageSize;
68
+ const page = fullyFiledPages + 1;
69
+ QueryStubs.stubQueryWithResults(repositoryId, page, offset, limit, elementsForLastPage, resultType);
70
+ }
71
+
72
+ QueryStubs.stubTotalQueryCount(repositoryId, totalElements, resultType);
73
+ }
74
+
75
+ static isLastPage(currentPage, allPage) {
76
+ return allPage - currentPage === 1;
77
+ }
78
+
79
+ static stubQueryWithResults(repositoryId, page, offset, limit, returnResult, resultType) {
80
+ const result = QueryStubs.createEmptyResponse(resultType);
81
+ result.results.bindings = QueryStubs.createResults(resultType, page, returnResult);
82
+ cy.intercept(`/repositories/${repositoryId}`, (req) => {
83
+ if (req.body.indexOf(`limit=${limit}`) > -1 && req.body.indexOf(`offset=${offset}`) > -1) {
84
+ req.reply(result);
85
+ }
86
+ }).as(`query-${page}_${offset}_${limit}_${returnResult}`);
87
+ }
88
+
89
+ static stubTotalQueryCount(repositoryId, totalElements, resultType, delay = 0) {
90
+ const result = QueryStubs.createEmptyResponse(resultType);
91
+ result.results.bindings = [QueryStubs.createTotalResultsCount(resultType, totalElements)];
92
+ cy.intercept(`/repositories/${repositoryId}`, (req) => {
93
+ if (req.body.indexOf('count=1') > -1) {
94
+ req.reply(result);
95
+ }
96
+ }).as(`countQuery-${totalElements}`);
97
+ }
98
+
99
+ static createResults(resultType, page, count) {
100
+ const results = [];
101
+ for (let index = 0; index < count; index++) {
102
+ results.push(QueryStubs.createAnResult(resultType, page, index + 1));
103
+ }
104
+ return results;
105
+ }
106
+
107
+ static createAnResult(resultType, page, row) {
108
+ switch (resultType) {
109
+ case ResultType.URI:
110
+ return this.createAnUriResult(page, row);
111
+ case ResultType.TRIPLE:
112
+ return this.createAnTripleResult(page, row);
113
+ }
114
+ }
115
+
116
+ static createAnTripleResult(page, row) {
117
+ return {
118
+ t : {
119
+ type : "triple",
120
+ value : {
121
+ s : {
122
+ type : "uri",
123
+ value : QueryStubs.createAnUri(page, row, 1)
124
+ },
125
+ p : {
126
+ type : "uri",
127
+ value : QueryStubs.createAnUri(page, row, 2)
128
+ },
129
+ o : {
130
+ type : "uri",
131
+ value : QueryStubs.createAnUri(page, row, 3)
132
+ }
133
+ }
134
+ }
135
+ };
136
+ }
137
+
138
+ static createAnUriResult(page, row) {
139
+ return {
140
+ s: {
141
+ type: "uri",
142
+ value: QueryStubs.createAnUri(page, row, 1)
143
+ },
144
+ p: {
145
+ type: "uri",
146
+ value: QueryStubs.createAnUri(page, row, 2)
147
+ },
148
+ o: {
149
+ type: "uri",
150
+ value: QueryStubs.createAnUri(page, row, 3)
151
+ }
152
+ };
153
+ }
154
+
155
+ static createAnUri(page, row, column) {
156
+ return `http://ontotext-yasgui/generated-yri#page_${page}-row_${row}-column_${column}`;
157
+ }
158
+
159
+ static createEmptyResponse(resultType) {
160
+ switch (resultType) {
161
+ case ResultType.URI:
162
+ return QueryStubs.createEmptyUriResponse();
163
+ case ResultType.TRIPLE:
164
+ return QueryStubs.createTripleResponse();
165
+ }
166
+ }
167
+
168
+ static createEmptyUriResponse() {
169
+ return {
170
+ head: {
171
+ vars: ["s", "p", "o"]
172
+ },
173
+ results: {
174
+ bindings: []
175
+ }
176
+ };
177
+ }
178
+
179
+ static createTripleResponse() {
180
+ return {
181
+ head: {
182
+ vars: ["t"]
183
+ },
184
+ results: {
185
+ bindings: []
186
+ }
187
+ };
188
+ }
189
+
190
+ static createTotalResultsCount(resultType, totalElement) {
191
+ switch (resultType) {
192
+ case ResultType.URI:
193
+ return QueryStubs.createUriTotalResultsCount(totalElement);
194
+ case ResultType.TRIPLE:
195
+ return QueryStubs.createTripleTotalResultsCount(totalElement);
196
+ }
197
+ }
198
+
199
+ static createUriTotalResultsCount(totalElement) {
200
+ return {
201
+ s: {
202
+ type: "uri",
203
+ value: `${totalElement}`
204
+ },
205
+ p: {
206
+ type: "uri",
207
+ value: `${totalElement}`
208
+ },
209
+ o: {
210
+ type: "uri",
211
+ value: `${totalElement}`
212
+ }
213
+ };
214
+ }
215
+
216
+ static createTripleTotalResultsCount(totalElement) {
217
+ return {
218
+ t: {
219
+ datatype: "http://www.w3.org/2001/XMLSchema#int",
220
+ type: "literal",
221
+ value: `${totalElement}`
222
+ }
223
+ };
224
+ }
225
+ }
226
+
227
+ export class QueryStubDescription {
228
+ constructor() {
229
+ this.resultType = ResultType.URI;
230
+ this.countQuery = true;
231
+ this.pageSize = 1000;
232
+ }
233
+
234
+ setTotalElements(totalElements) {
235
+ this.totalElements = totalElements;
236
+ return this;
237
+ }
238
+
239
+ setCountQuery(countQuery) {
240
+ this.countQuery = countQuery;
241
+ return this;
242
+ }
243
+
244
+ setResultType(resultType) {
245
+ this.resultType = resultType;
246
+ return this;
247
+ }
248
+
249
+ setRepositoryId(repositoryId) {
250
+ this.repositoryId = repositoryId;
251
+ return this;
252
+ }
253
+ }
254
+
255
+ export const ResultType = {
256
+ 'URI': 'uri',
257
+ 'TRIPLE': 'triple'
258
+ };
package/support/index.js CHANGED
@@ -19,6 +19,8 @@ import './commands';
19
19
  // Alternatively you can use CommonJS syntax:
20
20
  // require('./commands')
21
21
 
22
+ import 'cypress-real-events';
23
+
22
24
  // Configures an environment variable with the key used for common actions (cmd on mac, ctrl on other OS).
23
25
  // This variable must be used in all actions that type e.g. ctrl-a to select text.
24
26
  Cypress.env('modifierKey', Cypress.platform === 'darwin' ? '{cmd}' : '{ctrl}');
@@ -21,7 +21,12 @@ Cypress.Commands.add('createRepository', (options = {}) => {
21
21
  Cypress.Commands.add('deleteRepository', (id) => {
22
22
  // Note: Going through /rest/repositories because it would not fail if the repo is missing
23
23
  const url = REPOSITORIES_URL + id;
24
- cy.request('DELETE', url)
24
+ cy.request({
25
+ method: 'DELETE',
26
+ url: url,
27
+ // Prevent Cypress from failing the test on non-2xx status codes
28
+ failOnStatusCode: false
29
+ })
25
30
  .then((response) => {
26
31
  cy.waitUntil(() => response && response.status === 200);
27
32
  });
@@ -47,7 +47,7 @@ function getQueryArea() {
47
47
  }
48
48
 
49
49
  function getQueryTextArea() {
50
- return getQueryArea().find('textarea').scrollIntoView().should('be.visible');
50
+ return getQueryArea().find('textarea');
51
51
  }
52
52
 
53
53
  function waitUntilQueryIsVisible() {
@@ -1,3 +1,6 @@
1
+ export const EXPLORE_GRAPH_URL = '/rest/explore-graph';
2
+ export const GRAPH_CONFIG_URL = `${EXPLORE_GRAPH_URL}/config`;
3
+
1
4
  Cypress.Commands.add('searchEasyVisualGraph', (searchGraph) => {
2
5
  cy.get('.search-rdf-resources > #search-resource-box > .form-control')
3
6
  .invoke('val', searchGraph)
@@ -15,3 +18,25 @@ Cypress.Commands.add('searchEasyVisualGraph', (searchGraph) => {
15
18
  });
16
19
  });
17
20
  });
21
+
22
+ Cypress.Commands.add('deleteGraphConfig', (name) => {
23
+ cy.request({
24
+ method: 'GET',
25
+ url: GRAPH_CONFIG_URL
26
+ }).then((response) => {
27
+ const config = response.body.find((config) => config.name === name);
28
+ if (!config) {
29
+ return false;
30
+ }
31
+ return cy.request({
32
+ method: 'DELETE',
33
+ url: `${GRAPH_CONFIG_URL}/${config.id}`,
34
+ // Prevent Cypress from failing the test on non-2xx status codes
35
+ failOnStatusCode: false
36
+ });
37
+ }).then((response) => {
38
+ if (response) {
39
+ cy.waitUntil(() => response && response.status === 200);
40
+ }
41
+ });
42
+ });
@@ -1,196 +0,0 @@
1
- describe('Main menu tests', function () {
2
-
3
- before(function () {
4
- cy.clearLocalStorage();
5
- });
6
-
7
- beforeEach(function () {
8
- cy.visit('/');
9
- cy.window();
10
-
11
- cy.get('.card-title').should('contain', 'Welcome to GraphDB');
12
- });
13
-
14
- it('Test main menu visibility and redirects', () => {
15
- const menuItems = [
16
- {
17
- name: 'Import',
18
- visible: true,
19
- redirect: '/import'
20
- },
21
- {
22
- name: 'Explore',
23
- visible: true,
24
- submenu: [
25
- {
26
- name: 'Graphs overview',
27
- visible: false,
28
- redirect: '/graphs'
29
- },
30
- {
31
- name: 'Class hierarchy',
32
- visible: false,
33
- redirect: '/hierarchy'
34
- },
35
- {
36
- name: 'Class relationships',
37
- visible: false,
38
- redirect: '/relationships'
39
- },
40
- {
41
- name: 'Visual graph',
42
- visible: false,
43
- redirect: '/graphs-visualizations'
44
- },
45
- {
46
- name: 'Similarity',
47
- visible: false,
48
- redirect: '/similarity'
49
- }
50
- ]
51
- },
52
- {
53
- name: 'SPARQL',
54
- visible: true,
55
- redirect: '/sparql'
56
- },
57
- {
58
- name: 'Monitor',
59
- visible: true,
60
- submenu: [
61
- {
62
- name: 'Queries and Updates',
63
- visible: false,
64
- redirect: '/queries'
65
- },
66
- {
67
- name: 'System',
68
- visible: false,
69
- redirect: '/system'
70
- }
71
- ]
72
- },
73
- {
74
- name: 'Setup',
75
- visible: true,
76
- submenu: [
77
- {
78
- name: 'Repositories',
79
- visible: false,
80
- redirect: '/repository'
81
- },
82
- {
83
- name: 'Users and Access',
84
- visible: false,
85
- redirect: '/users'
86
- },
87
- {
88
- name: 'My Settings',
89
- visible: false,
90
- redirect: '/settings'
91
- },
92
- {
93
- name: 'Connectors',
94
- visible: false,
95
- redirect: '/connectors'
96
- },
97
- {
98
- name: 'Cluster',
99
- visible: false,
100
- redirect: '/cluster'
101
- },
102
- {
103
- name: 'Plugins',
104
- visible: false,
105
- redirect: '/plugins'
106
- },
107
- {
108
- name: 'Namespaces',
109
- visible: false,
110
- redirect: '/namespaces'
111
- },
112
- {
113
- name: 'Autocomplete',
114
- visible: false,
115
- redirect: '/autocomplete'
116
- },
117
- {
118
- name: 'RDF Rank',
119
- visible: false,
120
- redirect: '/rdfrank'
121
- }
122
- ]
123
- },
124
- {
125
- name: 'Help',
126
- visible: true,
127
- submenu: [
128
- {
129
- name: 'Interactive guides',
130
- visible: false,
131
- redirect: '/guides'
132
- },
133
- {
134
- name: 'REST API',
135
- visible: false,
136
- redirect: '/webapi'
137
- },
138
- {
139
- name: 'Documentation',
140
- visible: false,
141
- externalRedirect: 'https://graphdb.ontotext.com/documentation/'
142
- },
143
- {
144
- name: 'Tutorials',
145
- visible: false,
146
- externalRedirect: '/tutorials.html'
147
- },
148
- {
149
- name: 'Support',
150
- visible: false,
151
- externalRedirect: 'https://graphdb.ontotext.com/'
152
- },
153
- {
154
- name: 'System information',
155
- visible: false,
156
- redirect: '/sysinfo'
157
- }
158
- ]
159
- }
160
- ];
161
-
162
- menuItems.forEach((menu, menuIndex) => {
163
- let menuVisibilityCheck = menu.visible ? 'be.visible' : 'not.be.visible';
164
- // Verify that main menu items are present and their visibility
165
- cy.get('.main-menu .menu-element-root').eq(menuIndex + 1).as('menu')
166
- .should(menuVisibilityCheck).within(() =>
167
- cy.get('.menu-item').contains(menu.name));
168
-
169
- // Verify submenu items and their visibility when the main menu is not opened
170
- (menu.submenu || []).forEach((submenu, submenuIndex) => {
171
- let submenuVisibilityCheck = submenu.visible ? 'be.visible' : 'not.be.visible';
172
- cy.get('@menu').next('.sub-menu').find('.sub-menu-item').eq(submenuIndex)
173
- .should(submenuVisibilityCheck).and('contain', submenu.name);
174
- });
175
-
176
- cy.get('@menu').click().then(() => {
177
- (menu.submenu || []).forEach((submenu, submenuIndex) => {
178
- // Verify submenu items visibility when the main menu is opened.
179
- cy.get('@menu').next('.sub-menu').find('.sub-menu-item').eq(submenuIndex).as('submenu')
180
- .should('be.visible').and('contain', submenu.name);
181
-
182
- // Also verify redirection performed from submenu links. Some links open page on
183
- // external domain so those are not opened but the link href attribute is verified
184
- // instead.
185
- if (submenu.redirect) {
186
- cy.get('@submenu').find('a').click();
187
- cy.url().should('include', submenu.redirect);
188
- } else if (submenu.externalRedirect) {
189
- cy.get('@submenu').find('a')
190
- .should('have.attr', 'href').and('include', submenu.externalRedirect);
191
- }
192
- });
193
- });
194
- });
195
- });
196
- });
@@ -1,74 +0,0 @@
1
- import SparqlSteps from "../../steps/sparql-steps";
2
- import {QueryStubs} from "../../stubs/query-stubs";
3
-
4
- const LONG_ERROR_MESSAGE = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
5
- const MAX_VISIBLE_ERROR_CHARACTERS = 160;
6
- const SHORTEN_PART_OFF_ERROR_MESSAGE = LONG_ERROR_MESSAGE.substring(0, MAX_VISIBLE_ERROR_CHARACTERS);
7
- const SHORT_ERROR_MESSAGE = LONG_ERROR_MESSAGE.substring(0, MAX_VISIBLE_ERROR_CHARACTERS - 1);
8
- describe('Error handling', () => {
9
- let repositoryId;
10
-
11
- beforeEach(() => {
12
- repositoryId = 'sparql-error-handling' + Date.now();
13
- cy.createRepository({id: repositoryId});
14
- cy.presetRepository(repositoryId);
15
- SparqlSteps.visit();
16
- });
17
-
18
- afterEach(() => {
19
- cy.deleteRepository(repositoryId);
20
- });
21
-
22
- it('should show all error message if message length is short', () => {
23
- QueryStubs.stubQueryErrorResponse(repositoryId, 400, SHORT_ERROR_MESSAGE);
24
- // When I open sparql editor page
25
- // Then I should see no query has been executed
26
- SparqlSteps.getNoQueryRunInfo().should('be.visible');
27
- // When I execute a query
28
- SparqlSteps.executeQuery();
29
-
30
- // Then I expect to see all message,
31
- SparqlSteps.getResultInfo().should('contain', SHORT_ERROR_MESSAGE);
32
- // and don't see the button "Show full exception message",
33
- SparqlSteps.getShowFullExceptionMessage().should('not.exist');
34
- // and don't see the button "Show less exception message",
35
- SparqlSteps.getShowLessExceptionMessage().should('not.exist');
36
-
37
- });
38
-
39
- it('should show shorten error message if message length is long', () => {
40
- QueryStubs.stubQueryErrorResponse(repositoryId, 400, LONG_ERROR_MESSAGE);
41
- // When I open sparql editor page
42
- // Then I should see no query has been executed
43
- SparqlSteps.getNoQueryRunInfo().should('be.visible');
44
- // When I execute a query
45
- SparqlSteps.executeQuery();
46
-
47
- // Then I expect to see shorten error message,
48
- SparqlSteps.getResultInfo().should('contain', SHORTEN_PART_OFF_ERROR_MESSAGE);
49
- // and the button "Show full exception message" to be displayed,
50
- SparqlSteps.getShowFullExceptionMessage().should('be.visible');
51
- // and don't see the button "Show less exception message",
52
- SparqlSteps.getShowLessExceptionMessage().should('not.exist');
53
-
54
- // When I click on "Show full error message" button.
55
- SparqlSteps.clickOnShowFullExceptionMessage();
56
-
57
- // Then I expect to see full error message
58
- SparqlSteps.getResultInfo().should('contain', LONG_ERROR_MESSAGE);
59
- // and the button "Show full exception message" to not exist,
60
- SparqlSteps.getShowFullExceptionMessage().should('not.exist');
61
- // and see the button "Show less exception message",
62
- SparqlSteps.getShowLessExceptionMessage().should('be.visible');
63
-
64
- // When I click on "Show less error message" button.
65
- SparqlSteps.clickOnShowLessExceptionMessage();
66
-
67
- // Then I expect to see short error message
68
- SparqlSteps.getResultInfo().should('contain', SHORTEN_PART_OFF_ERROR_MESSAGE);
69
- // and the button "Show full exception message" to be displayed,
70
- SparqlSteps.getShowFullExceptionMessage().should('be.exist');
71
- // and don't see the button "Show less exception message",
72
- SparqlSteps.getShowLessExceptionMessage().should('not.exist');
73
- });
74
- });
@@ -1,58 +0,0 @@
1
- import SparqlSteps from '../../steps/sparql-steps';
2
-
3
- describe('YASQE and YASR language change validation', () => {
4
- let repositoryId;
5
-
6
- beforeEach(() => {
7
- repositoryId = 'sparql-' + Date.now();
8
- SparqlSteps.createRepoAndVisit(repositoryId);
9
- });
10
-
11
- afterEach(() => {
12
- // Change the language back to English
13
- SparqlSteps.changeLanguage('en');
14
-
15
- cy.deleteRepository(repositoryId);
16
- });
17
-
18
- context('Default language should be active and language change should affect labels', () => {
19
- it('should change labels in SPARQL view', () => {
20
-
21
- // Check some labels are in default language
22
- SparqlSteps.getSparqlQueryUpdateLabel().should('contain', 'SPARQL Query & Update');
23
- SparqlSteps.getDownloadBtn().should('contain', 'Download as');
24
- SparqlSteps.getEditorAndResultsBtn().should('contain', 'Editor and results');
25
- SparqlSteps.getResultsOnlyBtn().should('contain', 'Results only');
26
-
27
- SparqlSteps.changeLanguage('fr');
28
-
29
- // The text in the labels should change
30
- SparqlSteps.getSparqlQueryUpdateLabel().should('contain', 'Requête et mise à jour SPARQL');
31
- SparqlSteps.getDownloadBtn().should('contain', 'Téléchargement');
32
- SparqlSteps.getEditorAndResultsBtn().should('contain', 'Éditeur et résultats');
33
- SparqlSteps.getResultsOnlyBtn().should('contain', 'Résultats seulement');
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
- });
57
- });
58
- });