graphdb-workbench-tests 2.5.1 → 2.6.0-RC1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/fixtures/graphdb-import/resource-test-data.ttl +99 -0
  2. package/fixtures/graphql-editor/default-query-response.json +517 -0
  3. package/fixtures/guides/guides.json +764 -0
  4. package/fixtures/guides/movies.ttl +629 -0
  5. package/fixtures/guides/starwars.ttl +4384 -0
  6. package/fixtures/locale-en.json +44 -10
  7. package/fixtures/namespaces/ontotext-generated-namespace.json +22 -0
  8. package/fixtures/queries/empty-query-response.json +11 -0
  9. package/integration/cluster/cluster-management.spec.js +1 -2
  10. package/integration/explore/graphs.overview.spec.js +4 -2
  11. package/integration/explore/similariti-index-create.spec.js +333 -0
  12. package/integration/explore/similarity-index.spec.js +88 -0
  13. package/integration/explore/similarity.spec.js +180 -56
  14. package/integration/explore/visual-graph/graphs-config.spec.js +453 -0
  15. package/integration/explore/{visual.graph.spec.js → visual-graph/visual.graph.spec.js} +146 -347
  16. package/integration/guides/movies-interactive-guide.spec.js +73 -0
  17. package/integration/guides/star-wars-interactive-guide.js +60 -0
  18. package/integration/home/language-change.spec.js +3 -3
  19. package/integration/import/import.user.data.spec.js +2 -0
  20. package/integration/resource/resource.spec.js +357 -0
  21. package/integration/setup/aclmanagement/create-rule.spec.js +88 -11
  22. package/integration/setup/aclmanagement/delete-rule.spec.js +6 -4
  23. package/integration/setup/aclmanagement/edit-rule.spec.js +13 -8
  24. package/integration/setup/aclmanagement/render-rules.spec.js +4 -2
  25. package/integration/setup/aclmanagement/reorder-rules.spec.js +5 -3
  26. package/integration/setup/aclmanagement/revert-rules.spec.js +4 -3
  27. package/integration/setup/aclmanagement/scopes.spec.js +220 -0
  28. package/integration/setup/aclmanagement/update-rules.spec.js +17 -9
  29. package/integration/setup/jdbc-create.spec.js +330 -0
  30. package/integration/setup/jdbc.spec.js +78 -154
  31. package/integration/setup/my-settings.spec.js +9 -41
  32. package/integration/setup/sparql-template-create.js +150 -0
  33. package/integration/setup/sparql-templates.spec.js +82 -146
  34. package/integration/sparql-editor/actions/execute-query.spec.js +44 -0
  35. package/integration/sparql-editor/actions/expand-results-over-sameas.spec.js +136 -0
  36. package/integration/sparql-editor/actions/include-inferred-statements.spec.js +100 -0
  37. package/integration/sparql-editor/actions/inferred-sameas.spec.js +47 -0
  38. package/integration/sparql-editor/actions/save-query.spec.js +70 -0
  39. package/integration/sparql-editor/actions/show-saved-queries.spec.js +61 -0
  40. package/integration/sparql-editor/internationalization.spec.js +41 -0
  41. package/integration/sparql-editor/saved-query/abort-query.spec.js +51 -0
  42. package/integration/sparql-editor/saved-query/delete-query.spec.js +56 -0
  43. package/integration/sparql-editor/saved-query/edit-query.spec.js +68 -0
  44. package/integration/sparql-editor/saved-query/share-query.spec.js +78 -0
  45. package/integration/sparql-editor/sparql-editor.spec.js +55 -0
  46. package/integration/sparql-editor/yasgui-tabs.spec.js +107 -0
  47. package/integration/sparql-editor/yasr/download-as.spec.js +54 -0
  48. package/integration/sparql-editor/yasr/pagination.spec.js +234 -0
  49. package/integration/sparql-editor/yasr/table-plugin.spec.js +39 -0
  50. package/integration/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +57 -0
  51. package/integration-flaky/explore/visual.graph.spec.js +3 -2
  52. package/integration-flaky/setup/sparql-template-create.js +139 -0
  53. package/integration-flaky/sparql-editor/actions/execute-update-query.spec.js +89 -0
  54. package/integration-flaky/sparql-editor/actions/share-query.spec.js +84 -0
  55. package/integration-flaky/sparql-editor/lucene-connector.spec.js +62 -0
  56. package/integration-flaky/sparql-editor/plugins/error-plugin.spec.js +83 -0
  57. package/integration-flaky/sparql-editor/yasr/table-plugin.spec.js +81 -0
  58. package/package.json +3 -1
  59. package/steps/application-steps.js +5 -0
  60. package/steps/autocomplete-steps.js +10 -0
  61. package/steps/error-steps.js +9 -0
  62. package/steps/explore/graphs-overview-steps.js +24 -0
  63. package/steps/explore/similarity-index-create-steps.js +113 -0
  64. package/steps/explore/similarity-indexes-steps.js +18 -0
  65. package/steps/guides/guide-dialog-steps.js +38 -0
  66. package/steps/guides/guide-steps.js +278 -0
  67. package/steps/guides/movies-guide-steps.js +241 -0
  68. package/steps/guides/star-wars-guide-steps.js +188 -0
  69. package/steps/import-steps.js +16 -0
  70. package/steps/language-selector-steps.js +22 -0
  71. package/steps/loader-steps.js +10 -0
  72. package/steps/lucene-connector-steps.js +43 -0
  73. package/steps/main-menu-steps.js +67 -0
  74. package/steps/repository-selector-steps.js +26 -0
  75. package/steps/repository-steps.js +4 -0
  76. package/steps/resource/resource-edit-steps.js +111 -0
  77. package/steps/resource/resource-steps.js +149 -0
  78. package/steps/setup/acl-management-steps.js +193 -35
  79. package/steps/setup/jdbc-create-steps.js +97 -0
  80. package/steps/setup/jdbc-steps.js +42 -0
  81. package/steps/setup/sparql-create-update-steps.js +55 -0
  82. package/steps/setup/sparql-templates-steps.js +38 -0
  83. package/steps/sparql-editor-steps.js +20 -0
  84. package/steps/sparql-steps.js +0 -6
  85. package/steps/visual-graph-steps.js +365 -6
  86. package/steps/yasgui/confirmation-dialog-steps.js +13 -0
  87. package/steps/yasgui/pagination-steps.js +47 -0
  88. package/steps/yasgui/plugin/error-plugin-steps.js +30 -0
  89. package/steps/yasgui/save-query-dialog.js +61 -0
  90. package/steps/yasgui/saved-queries-dialog.js +29 -0
  91. package/steps/yasgui/saved-query.js +25 -0
  92. package/steps/yasgui/share-saved-query-dialog.js +25 -0
  93. package/steps/yasgui/table-plugin-steps.js +29 -0
  94. package/steps/yasgui/yasgui-loader.js +10 -0
  95. package/steps/yasgui/yasgui-steps.js +191 -0
  96. package/steps/yasgui/yasqe-steps.js +187 -0
  97. package/steps/yasgui/yasr-steps.js +108 -0
  98. package/stubs/namespace-stubs.js +10 -0
  99. package/stubs/repositories-stub.js +58 -0
  100. package/stubs/security-stubs.js +69 -0
  101. package/stubs/yasgui/connectors-stubs.js +12 -0
  102. package/stubs/yasgui/query-stubs.js +253 -0
  103. package/support/index.js +3 -0
  104. package/support/repository-commands.js +5 -5
  105. package/support/sparql-commands.js +1 -1
  106. package/support/visual-graph-commands.js +25 -0
  107. package/integration/sparql/main.menu.spec.js +0 -232
  108. package/integration/sparql/sparql-error-handling.spec.js +0 -74
  109. package/integration/sparql/sparql-language-change.spec.js +0 -58
  110. package/integration/sparql/sparql-result-formating.spec.js +0 -84
  111. package/integration/sparql/sparql.menu.spec.js +0 -1253
  112. package/integration-flaky/setup/sparql-templates.spec.js +0 -125
  113. package/integration-flaky/sparql/sparql-language-change.spec.js +0 -45
  114. package/integration-flaky/sparql/sparql.menu.spec.js +0 -75
@@ -0,0 +1,253 @@
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
+ static stubDefaultQueryResponse(repositoryId, withDelay = 0) {
14
+ QueryStubs.stubQueryResponse(repositoryId, '/graphql-editor/default-query-response.json', withDelay);
15
+ }
16
+
17
+ static stubEmptyQueryResponse(repositoryId, withDelay = 0) {
18
+ QueryStubs.stubQueryResponse(repositoryId, '/queries/empty-query-response.json', withDelay);
19
+ }
20
+
21
+ static stubDefaultTripleQueryResponse(repositoryId, withDelay = 0) {
22
+ QueryStubs.stubQueryResponse(repositoryId, '/queries/default-triple-query-response.json', withDelay);
23
+ }
24
+
25
+ static stubQueryResponse(repositoryId, fixture, withDelay = 0) {
26
+ cy.intercept(`/repositories/${repositoryId}`, {fixture, delay: withDelay}).as(`${repositoryId}-stub-query`);
27
+ }
28
+
29
+ static stubQueryResults(queryDescription) {
30
+ const resultType = queryDescription.resultType;
31
+ const pageSize = queryDescription.pageSize;
32
+ const totalElements = queryDescription.totalElements;
33
+ const countQuery = queryDescription.countQuery;
34
+ const repositoryId = queryDescription.repositoryId;
35
+
36
+ const fullyFiledPages = Math.floor(totalElements / pageSize);
37
+ const elementsForLastPage = totalElements % pageSize;
38
+ const limit = countQuery ? pageSize + 1 : pageSize;
39
+
40
+ // Stubs responses for all fully filled pages.
41
+ for (let pageNumber = 0; pageNumber < fullyFiledPages; pageNumber++) {
42
+ const offset = pageNumber * pageSize;
43
+ let returnElements = pageSize;
44
+
45
+ if (QueryStubs.isLastPage(pageNumber, fullyFiledPages)) {
46
+ // Check if there are more results, if yes the query must return one more result.
47
+ if (elementsForLastPage > 0 && countQuery) {
48
+ returnElements += 1;
49
+ }
50
+ } else {
51
+ if (countQuery) {
52
+ // If there are more pages the query must return one more result.
53
+ returnElements += 1;
54
+ }
55
+ }
56
+ const page = pageNumber + 1;
57
+ QueryStubs.stubQueryWithResults(repositoryId, page, offset, limit, returnElements, resultType);
58
+ }
59
+
60
+ // Stubs the last page with.
61
+ if (elementsForLastPage > 0) {
62
+ const offset = fullyFiledPages * pageSize;
63
+ const page = fullyFiledPages + 1;
64
+ QueryStubs.stubQueryWithResults(repositoryId, page, offset, limit, elementsForLastPage, resultType);
65
+ }
66
+
67
+ QueryStubs.stubTotalQueryCount(repositoryId, totalElements, resultType);
68
+ }
69
+
70
+ static isLastPage(currentPage, allPage) {
71
+ return allPage - currentPage === 1;
72
+ }
73
+
74
+ static stubQueryWithResults(repositoryId, page, offset, limit, returnResult, resultType) {
75
+ const result = QueryStubs.createEmptyResponse(resultType);
76
+ result.results.bindings = QueryStubs.createResults(resultType, page, returnResult);
77
+ cy.intercept(`/repositories/${repositoryId}`, (req) => {
78
+ if (req.body.indexOf(`limit=${limit}`) > -1 && req.body.indexOf(`offset=${offset}`) > -1) {
79
+ req.reply(result);
80
+ }
81
+ }).as(`query-${page}_${offset}_${limit}_${returnResult}`);
82
+ }
83
+
84
+ static stubTotalQueryCount(repositoryId, totalElements, resultType, delay = 0) {
85
+ const result = QueryStubs.createEmptyResponse(resultType);
86
+ result.results.bindings = [QueryStubs.createTotalResultsCount(resultType, totalElements)];
87
+ cy.intercept(`/repositories/${repositoryId}`, (req) => {
88
+ if (req.body.indexOf('count=1') > -1) {
89
+ req.reply(result);
90
+ }
91
+ }).as(`countQuery-${totalElements}`);
92
+ }
93
+
94
+ static createResults(resultType, page, count) {
95
+ const results = [];
96
+ for (let index = 0; index < count; index++) {
97
+ results.push(QueryStubs.createAnResult(resultType, page, index + 1));
98
+ }
99
+ return results;
100
+ }
101
+
102
+ static createAnResult(resultType, page, row) {
103
+ switch (resultType) {
104
+ case ResultType.URI:
105
+ return this.createAnUriResult(page, row);
106
+ case ResultType.TRIPLE:
107
+ return this.createAnTripleResult(page, row);
108
+ }
109
+ }
110
+
111
+ static createAnTripleResult(page, row) {
112
+ return {
113
+ t : {
114
+ type : "triple",
115
+ value : {
116
+ s : {
117
+ type : "uri",
118
+ value : QueryStubs.createAnUri(page, row, 1)
119
+ },
120
+ p : {
121
+ type : "uri",
122
+ value : QueryStubs.createAnUri(page, row, 2)
123
+ },
124
+ o : {
125
+ type : "uri",
126
+ value : QueryStubs.createAnUri(page, row, 3)
127
+ }
128
+ }
129
+ }
130
+ };
131
+ }
132
+
133
+ static createAnUriResult(page, row) {
134
+ return {
135
+ s: {
136
+ type: "uri",
137
+ value: QueryStubs.createAnUri(page, row, 1)
138
+ },
139
+ p: {
140
+ type: "uri",
141
+ value: QueryStubs.createAnUri(page, row, 2)
142
+ },
143
+ o: {
144
+ type: "uri",
145
+ value: QueryStubs.createAnUri(page, row, 3)
146
+ }
147
+ };
148
+ }
149
+
150
+ static createAnUri(page, row, column) {
151
+ return `http://ontotext-yasgui/generated-yri#page_${page}-row_${row}-column_${column}`;
152
+ }
153
+
154
+ static createEmptyResponse(resultType) {
155
+ switch (resultType) {
156
+ case ResultType.URI:
157
+ return QueryStubs.createEmptyUriResponse();
158
+ case ResultType.TRIPLE:
159
+ return QueryStubs.createTripleResponse();
160
+ }
161
+ }
162
+
163
+ static createEmptyUriResponse() {
164
+ return {
165
+ head: {
166
+ vars: ["s", "p", "o"]
167
+ },
168
+ results: {
169
+ bindings: []
170
+ }
171
+ };
172
+ }
173
+
174
+ static createTripleResponse() {
175
+ return {
176
+ head: {
177
+ vars: ["t"]
178
+ },
179
+ results: {
180
+ bindings: []
181
+ }
182
+ };
183
+ }
184
+
185
+ static createTotalResultsCount(resultType, totalElement) {
186
+ switch (resultType) {
187
+ case ResultType.URI:
188
+ return QueryStubs.createUriTotalResultsCount(totalElement);
189
+ case ResultType.TRIPLE:
190
+ return QueryStubs.createTripleTotalResultsCount(totalElement);
191
+ }
192
+ }
193
+
194
+ static createUriTotalResultsCount(totalElement) {
195
+ return {
196
+ s: {
197
+ type: "uri",
198
+ value: `${totalElement}`
199
+ },
200
+ p: {
201
+ type: "uri",
202
+ value: `${totalElement}`
203
+ },
204
+ o: {
205
+ type: "uri",
206
+ value: `${totalElement}`
207
+ }
208
+ };
209
+ }
210
+
211
+ static createTripleTotalResultsCount(totalElement) {
212
+ return {
213
+ t: {
214
+ datatype: "http://www.w3.org/2001/XMLSchema#int",
215
+ type: "literal",
216
+ value: `${totalElement}`
217
+ }
218
+ };
219
+ }
220
+ }
221
+
222
+ export class QueryStubDescription {
223
+ constructor() {
224
+ this.resultType = ResultType.URI;
225
+ this.countQuery = true;
226
+ this.pageSize = 1000;
227
+ }
228
+
229
+ setTotalElements(totalElements) {
230
+ this.totalElements = totalElements;
231
+ return this;
232
+ }
233
+
234
+ setCountQuery(countQuery) {
235
+ this.countQuery = countQuery;
236
+ return this;
237
+ }
238
+
239
+ setResultType(resultType) {
240
+ this.resultType = resultType;
241
+ return this;
242
+ }
243
+
244
+ setRepositoryId(repositoryId) {
245
+ this.repositoryId = repositoryId;
246
+ return this;
247
+ }
248
+ }
249
+
250
+ export const ResultType = {
251
+ 'URI': 'uri',
252
+ 'TRIPLE': 'triple'
253
+ };
package/support/index.js CHANGED
@@ -19,6 +19,9 @@ import './commands';
19
19
  // Alternatively you can use CommonJS syntax:
20
20
  // require('./commands')
21
21
 
22
+ import 'cypress-real-events';
23
+ import 'cypress-file-upload';
24
+
22
25
  // Configures an environment variable with the key used for common actions (cmd on mac, ctrl on other OS).
23
26
  // This variable must be used in all actions that type e.g. ctrl-a to select text.
24
27
  Cypress.env('modifierKey', Cypress.platform === 'darwin' ? '{cmd}' : '{ctrl}');
@@ -71,12 +71,12 @@ Cypress.Commands.add('getNamespaces', (id) => {
71
71
  });
72
72
  });
73
73
 
74
- let toggleAutocomplete = (repositoryId, enable) => {
74
+ const toggleAutocomplete = (repositoryId, enable) => {
75
75
  cy.request({
76
76
  method: 'POST',
77
77
  url: `${AUTOCOMPLETE_URL}enabled?enabled=${enable}`,
78
78
  headers: {
79
- 'X-GraphDB-Repository': repositoryId,
79
+ 'X-GraphDB-Repository': repositoryId
80
80
  }
81
81
  }).then((response) => {
82
82
  cy.waitUntil(() => response && response.body === `Autocomplete was ${enable ? 'enabled' : 'disabled'}`);
@@ -84,13 +84,13 @@ let toggleAutocomplete = (repositoryId, enable) => {
84
84
  waitAutocomplete(repositoryId);
85
85
  };
86
86
 
87
- let waitAutocomplete = function (repositoryId) {
87
+ const waitAutocomplete = function (repositoryId) {
88
88
  cy.waitUntil(() =>
89
89
  cy.request({
90
90
  method: 'GET',
91
91
  url: AUTOCOMPLETE_URL + 'status',
92
92
  headers: {
93
93
  'X-GraphDB-Repository': repositoryId
94
- },
95
- }).then(response => response.status === 200 && (response.body === 'READY' || response.body === 'NONE')));
94
+ }
95
+ }).then((response) => response.status === 200 && (response.body === 'READY' || response.body === 'NONE')));
96
96
  };
@@ -49,7 +49,7 @@ function getQueryArea() {
49
49
  }
50
50
 
51
51
  function getQueryTextArea() {
52
- return getQueryArea().find('textarea').scrollIntoView().should('be.visible');
52
+ return getQueryArea().find('textarea');
53
53
  }
54
54
 
55
55
  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,232 +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: 'Backup and Restore',
68
- visible: false,
69
- redirect: '/monitor/backup-and-restore'
70
- },
71
- {
72
- name: 'System',
73
- visible: false,
74
- redirect: '/system'
75
- }
76
- ]
77
- },
78
- {
79
- name: 'Setup',
80
- visible: true,
81
- submenu: [
82
- {
83
- name: 'Repositories',
84
- visible: false,
85
- redirect: '/repository'
86
- },
87
- {
88
- name: 'Users and Access',
89
- visible: false,
90
- redirect: '/users'
91
- },
92
- {
93
- name: 'ACL Management',
94
- visible: false,
95
- redirect: '/aclmanagement'
96
- },
97
- {
98
- name: 'My Settings',
99
- visible: false,
100
- redirect: '/settings'
101
- },
102
- {
103
- name: 'Connectors',
104
- visible: false,
105
- redirect: '/connectors'
106
- },
107
- {
108
- name: 'Cluster',
109
- visible: false,
110
- redirect: '/cluster'
111
- },
112
- {
113
- name: 'Plugins',
114
- visible: false,
115
- redirect: '/plugins'
116
- },
117
- {
118
- name: 'Namespaces',
119
- visible: false,
120
- redirect: '/namespaces'
121
- },
122
- {
123
- name: 'Autocomplete',
124
- visible: false,
125
- redirect: '/autocomplete'
126
- },
127
- {
128
- name: 'RDF Rank',
129
- visible: false,
130
- redirect: '/rdfrank'
131
- },
132
- {
133
- name: 'JDBC',
134
- visible: false,
135
- redirect: '/jdbc'
136
- },
137
- {
138
- name: 'SPARQL Templates',
139
- visible: false,
140
- redirect: '/sparql-templates'
141
- },
142
- {
143
- name: 'License',
144
- visible: false,
145
- redirect: '/license'
146
- }
147
- ]
148
- },
149
- {
150
- name: 'Lab',
151
- visible: true,
152
- submenu: [
153
- {
154
- name: 'Talk to Your Graph',
155
- visible: false,
156
- redirect: '/chatgpt'
157
- }
158
- ]
159
- },
160
- {
161
- name: 'Help',
162
- visible: true,
163
- submenu: [
164
- {
165
- name: 'Interactive guides',
166
- visible: false,
167
- redirect: '/guides'
168
- },
169
- {
170
- name: 'REST API',
171
- visible: false,
172
- redirect: '/webapi'
173
- },
174
- {
175
- name: 'Documentation',
176
- visible: false,
177
- externalRedirect: 'https://graphdb.ontotext.com/documentation/'
178
- },
179
- {
180
- name: 'Tutorials',
181
- visible: false,
182
- externalRedirect: '/tutorials.html'
183
- },
184
- {
185
- name: 'Support',
186
- visible: false,
187
- externalRedirect: 'https://graphdb.ontotext.com/'
188
- },
189
- {
190
- name: 'System information',
191
- visible: false,
192
- redirect: '/sysinfo'
193
- }
194
- ]
195
- }
196
- ];
197
-
198
- menuItems.forEach((menu, menuIndex) => {
199
- let menuVisibilityCheck = menu.visible ? 'be.visible' : 'not.be.visible';
200
- // Verify that main menu items are present and their visibility
201
- cy.get('.main-menu .menu-element-root').eq(menuIndex + 1).as('menu')
202
- .should(menuVisibilityCheck).within(() =>
203
- cy.get('.menu-item').contains(menu.name));
204
-
205
- // Verify submenu items and their visibility when the main menu is not opened
206
- (menu.submenu || []).forEach((submenu, submenuIndex) => {
207
- let submenuVisibilityCheck = submenu.visible ? 'be.visible' : 'not.be.visible';
208
- cy.get('@menu').next('.sub-menu').find('.sub-menu-item').eq(submenuIndex)
209
- .should(submenuVisibilityCheck).and('contain', submenu.name);
210
- });
211
-
212
- cy.get('@menu').click().then(() => {
213
- (menu.submenu || []).forEach((submenu, submenuIndex) => {
214
- // Verify submenu items visibility when the main menu is opened.
215
- cy.get('@menu').next('.sub-menu').find('.sub-menu-item').eq(submenuIndex).as('submenu')
216
- .should('be.visible').and('contain', submenu.name);
217
-
218
- // Also verify redirection performed from submenu links. Some links open page on
219
- // external domain so those are not opened but the link href attribute is verified
220
- // instead.
221
- if (submenu.redirect) {
222
- cy.get('@submenu').find('a').click();
223
- cy.url().should('include', submenu.redirect);
224
- } else if (submenu.externalRedirect) {
225
- cy.get('@submenu').find('a')
226
- .should('have.attr', 'href').and('include', submenu.externalRedirect);
227
- }
228
- });
229
- });
230
- });
231
- });
232
- });
@@ -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
- });