graphdb-workbench-tests 2.5.1 → 2.6.0-RC2

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 +53 -12
  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 +228 -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 +201 -39
  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,234 @@
1
+ import {QueryStubDescription, QueryStubs} from "../../../stubs/yasgui/query-stubs";
2
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
3
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
4
+ import {YasrSteps} from "../../../steps/yasgui/yasr-steps";
5
+ import {PaginationSteps} from "../../../steps/yasgui/pagination-steps";
6
+ import {NamespaceStubs} from "../../../stubs/namespace-stubs";
7
+
8
+ describe('Yasr result pagination', () => {
9
+ let repositoryId;
10
+ beforeEach(() => {
11
+ repositoryId = 'sparql-editor-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ NamespaceStubs.stubGeneratedOntotextNamespacesResponse(repositoryId);
16
+ // Given: I visit a page with "ontotex-yasgu-web-component" in it.
17
+ SparqlEditorSteps.visitSparqlEditorPage();
18
+ });
19
+
20
+ afterEach(() => {
21
+ cy.deleteRepository(repositoryId);
22
+ });
23
+
24
+ describe('Visibility of pagination', () => {
25
+ it('should not be visible when a tab is open without a query to be executed', () => {
26
+ // When I visit a page with "ontotext-yasgui" component in it,
27
+ // and there is not executed query.
28
+ //Then I expect pagination to not be visible
29
+ YasrSteps.getPagination().should('not.be.visible');
30
+ });
31
+
32
+ it('should not be visible when there aren\'t results', () => {
33
+ // When I visit a page with "ontotext-yasgui" component in it,
34
+ // and execute a query which don't return results
35
+ QueryStubs.stubEmptyQueryResponse();
36
+ YasqeSteps.executeQuery();
37
+
38
+ //Then I expect pagination to not be visible
39
+ YasrSteps.getPagination().should('not.be.visible');
40
+ });
41
+
42
+ it('should not be visible when results of query are less than configured page size', {
43
+ retries: {
44
+ runMode: 1,
45
+ openMode: 0
46
+ }
47
+ }, () => {
48
+ // When I visit a page with "ontotext-yasgui" component in it,
49
+ // and execute a query which returns results less than page size.
50
+ const queryDescription = new QueryStubDescription()
51
+ .setRepositoryId(repositoryId)
52
+ .setTotalElements(3);
53
+ QueryStubs.stubQueryResults(queryDescription);
54
+ YasqeSteps.executeQuery();
55
+
56
+ // Then I expect pagination to not be visible
57
+ YasrSteps.getPagination().should('not.be.visible');
58
+
59
+ // When I execute a query witch returns results equals to page size.
60
+ queryDescription
61
+ .setRepositoryId(repositoryId)
62
+ .setTotalElements(1000);
63
+ QueryStubs.stubQueryResults(queryDescription);
64
+ YasqeSteps.executeQuery();
65
+
66
+ // Then I expect pagination to not be visible
67
+ YasrSteps.getPagination().should('not.be.visible');
68
+ });
69
+
70
+ it('should be visible when results of query are more than configured page size', () => {
71
+ // When I visit a page with "ontotext-yasgui" component in it,
72
+ // and execute a query which returns results more than page size.
73
+ const queryDescription = new QueryStubDescription()
74
+ .setRepositoryId(repositoryId)
75
+ .setTotalElements(1150);
76
+ QueryStubs.stubQueryResults(queryDescription);
77
+ YasqeSteps.executeQuery();
78
+
79
+ // Then I expect pagination to be visible
80
+ YasrSteps.getPagination().should('be.visible');
81
+ });
82
+
83
+ });
84
+
85
+ describe('Pagination behaviour', () => {
86
+ it('should change page when clink on page number button', () => {
87
+ // When I visit a page with "ontotext-yasgui" component in it,
88
+ // and execute a query which returns results more than page size.
89
+ const queryDescription = new QueryStubDescription()
90
+ .setRepositoryId(repositoryId)
91
+ .setTotalElements(1001);
92
+ QueryStubs.stubQueryResults(queryDescription);
93
+ YasqeSteps.executeQuery();
94
+ PaginationSteps.waitPageSelected(1);
95
+
96
+ // I expect two pages to be shown in pagination,
97
+ PaginationSteps.getPageNumberButtons().should('have.length', 2);
98
+ // and first page to have 1000 results,
99
+ YasrSteps.getResults().should('have.length', 1000);
100
+ // and results to be from the first page
101
+ YasrSteps.getResultLink(0, 2).should('have.text', 'ontogen:page_1-row_1-column_2');
102
+
103
+ // When I click on second page button
104
+ PaginationSteps.clickOnPageNumberButton(2);
105
+ PaginationSteps.waitPageSelected(2);
106
+
107
+ // Then I expect second page to have only one result,
108
+ YasrSteps.getResults().should('have.length', 1);
109
+ // and the results to be from the second page
110
+ YasrSteps.getResultLink(0, 2).should('have.text', 'ontogen:page_2-row_1-column_2');
111
+ });
112
+
113
+ it('should change page when clink on next or previous page button', {
114
+ retries: {
115
+ runMode: 1,
116
+ openMode: 0
117
+ }
118
+ }, () => {
119
+ // When I visit a page with "ontotext-yasgui" component in it,
120
+ // and execute a query which returns results more than page size.
121
+ const queryDescription = new QueryStubDescription()
122
+ .setRepositoryId(repositoryId)
123
+ .setTotalElements(1002);
124
+ QueryStubs.stubQueryResults(queryDescription);
125
+ YasqeSteps.executeQuery();
126
+ PaginationSteps.waitPageSelected(1);
127
+
128
+ // Then I expect two pages to be shown in pagination.
129
+ PaginationSteps.getPageNumberButtons().should('have.length', 2);
130
+ // and first page to have 1000 results
131
+ YasrSteps.getResults().should('have.length', 1000);
132
+ // and results to be from the first page
133
+ YasrSteps.getResultLink(0, 2).should('have.text', 'ontogen:page_1-row_1-column_2');
134
+
135
+ // When I click on next page button
136
+ PaginationSteps.clickOnNextPageButton();
137
+ PaginationSteps.waitPageSelected(2);
138
+
139
+ // Then I expect second page to have two results.
140
+ YasrSteps.getResults().should('have.length', 2);
141
+ // and the result to be from the second page
142
+ YasrSteps.getResultLink(0, 2).should('have.text', 'ontogen:page_2-row_1-column_2');
143
+
144
+ // When I click on previous button
145
+ PaginationSteps.clickOnPreviousPageButton();
146
+ PaginationSteps.waitPageSelected(1);
147
+
148
+ // Then I expect first page to have 1000 results,
149
+ YasrSteps.getResults().should('have.length', 1000);
150
+ // and the results to be from the first page.
151
+ YasrSteps.getResultLink(0, 2).should('have.text', 'ontogen:page_1-row_1-column_2');
152
+ });
153
+
154
+ it('should should render pages in pager properly', {
155
+ retries: {
156
+ runMode: 1,
157
+ openMode: 1
158
+ }
159
+ }, () => {
160
+ // When I visit a page with "ontotext-yasgui" component in it,
161
+ // and execute a query which results are on 6 pages.
162
+ const queryDescription = new QueryStubDescription()
163
+ .setRepositoryId(repositoryId)
164
+ .setTotalElements(5001);
165
+ QueryStubs.stubQueryResults(queryDescription);
166
+ YasqeSteps.executeQuery();
167
+ PaginationSteps.waitPageSelected(1);
168
+
169
+ PaginationSteps.getPreviousPageButton().should('be.disabled');
170
+ PaginationSteps.getPageNumberButton(1).should('have.class', 'selected-page');
171
+ PaginationSteps.getPageNumberButton(2).should('be.visible');
172
+ PaginationSteps.getPageNumberButton(3).should('be.visible');
173
+ PaginationSteps.getPageNumberButton(4).should('be.visible');
174
+ PaginationSteps.getPageNumberButton(5).should('be.visible');
175
+ PaginationSteps.getPageNumberButton(6).should('not.exist');
176
+ PaginationSteps.getPageNumberButton(7).should('not.exist');
177
+ PaginationSteps.getNextPageButton().should('be.enabled');
178
+
179
+ // When select second page
180
+ PaginationSteps.clickOnPageNumberButton(2);
181
+ PaginationSteps.waitPageSelected(2);
182
+
183
+ PaginationSteps.getPreviousPageButton().should('not.be.disabled');
184
+ PaginationSteps.getPageNumberButton(1).should('be.visible');
185
+ PaginationSteps.getPageNumberButton(2).should('have.class', 'selected-page');
186
+ PaginationSteps.getPageNumberButton(3).should('be.visible');
187
+ PaginationSteps.getPageNumberButton(4).should('be.visible');
188
+ PaginationSteps.getPageNumberButton(5).should('be.visible');
189
+ PaginationSteps.getPageNumberButton(6).should('not.exist');
190
+ PaginationSteps.getNextPageButton().should('be.enabled');
191
+
192
+ // When select third page
193
+ PaginationSteps.clickOnPageNumberButton(3);
194
+ PaginationSteps.waitPageSelected(3);
195
+
196
+ PaginationSteps.getPreviousPageButton().should('be.enabled');
197
+ PaginationSteps.getPageNumberButton(1).should('be.visible');
198
+ PaginationSteps.getPageNumberButton(2).should('be.visible');
199
+ PaginationSteps.getPageNumberButton(3).should('have.class', 'selected-page');
200
+ PaginationSteps.getPageNumberButton(4).should('be.visible');
201
+ PaginationSteps.getPageNumberButton(5).should('be.visible');
202
+ PaginationSteps.getPageNumberButton(6).should('not.exist');
203
+ PaginationSteps.getNextPageButton().should('be.enabled');
204
+
205
+ // When select fifth page
206
+ PaginationSteps.clickOnPageNumberButton(5);
207
+ PaginationSteps.waitPageSelected(5);
208
+
209
+ PaginationSteps.getPreviousPageButton().should('be.enabled');
210
+ PaginationSteps.getPageNumberButton(1).should('not.exist');
211
+ PaginationSteps.getPageNumberButton(2).should('be.visible');
212
+ PaginationSteps.getPageNumberButton(3).should('be.visible');
213
+ PaginationSteps.getPageNumberButton(4).should('be.visible');
214
+ PaginationSteps.getPageNumberButton(5).should('have.class', 'selected-page');
215
+ PaginationSteps.getPageNumberButton(6).should('be.visible');
216
+ PaginationSteps.getPageNumberButton(7).should('not.exist');
217
+ PaginationSteps.getNextPageButton().should('be.enabled');
218
+
219
+ // When select last page
220
+ PaginationSteps.clickOnPageNumberButton(6);
221
+ PaginationSteps.waitPageSelected(6);
222
+
223
+ PaginationSteps.getPreviousPageButton().should('be.enabled');
224
+ PaginationSteps.getPageNumberButton(1).should('not.exist');
225
+ PaginationSteps.getPageNumberButton(2).should('be.visible');
226
+ PaginationSteps.getPageNumberButton(3).should('be.visible');
227
+ PaginationSteps.getPageNumberButton(4).should('be.visible');
228
+ PaginationSteps.getPageNumberButton(5).should('be.visible');
229
+ PaginationSteps.getPageNumberButton(6).should('have.class', 'selected-page');
230
+ PaginationSteps.getPageNumberButton(7).should('not.exist');
231
+ PaginationSteps.getNextPageButton().should('be.disabled');
232
+ });
233
+ });
234
+ });
@@ -0,0 +1,39 @@
1
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
2
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
3
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
4
+ import {YasrSteps} from "../../../steps/yasgui/yasr-steps";
5
+
6
+ describe('Yasr Table plugin', () => {
7
+ let repositoryId;
8
+ beforeEach(() => {
9
+ repositoryId = 'sparql-editor-' + Date.now();
10
+ QueryStubs.stubQueryCountResponse();
11
+ cy.createRepository({id: repositoryId});
12
+ cy.presetRepository(repositoryId);
13
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
14
+ // Given I visit a page with "ontotex-yasgu-web-component" in it.
15
+ SparqlEditorSteps.visitSparqlEditorPage();
16
+ });
17
+
18
+ afterEach(() => {
19
+ cy.deleteRepository(repositoryId);
20
+ });
21
+
22
+ describe('Results formatting', () => {
23
+
24
+ it('Should format all resources as short uris when results are of type uri', {
25
+ retries: {
26
+ runMode: 1,
27
+ openMode: 0
28
+ }
29
+ }, () => {
30
+ // When I execute a query which return results and results type is uri.
31
+ QueryStubs.stubDefaultQueryResponse();
32
+ YasqeSteps.executeQuery();
33
+
34
+ // Then I expect results to be displayed with short uri.
35
+ YasrSteps.getResultCell(1, 2).contains('rdf:type');
36
+ YasrSteps.getResultCell(4, 3).contains('owl:TransitiveProperty');
37
+ });
38
+ });
39
+ });
@@ -0,0 +1,57 @@
1
+ import {SparqlEditorSteps} from "../../../../steps/sparql-editor-steps";
2
+ import {YasqeSteps} from "../../../../steps/yasgui/yasqe-steps";
3
+ import {YasrSteps} from "../../../../steps/yasgui/yasr-steps";
4
+ import {QueryStubs} from "../../../../stubs/yasgui/query-stubs";
5
+
6
+ describe('Visual graph button when user execute a CONSTRUCT query', () => {
7
+ let repositoryId;
8
+
9
+ beforeEach(() => {
10
+ repositoryId = 'sparql-editor-' + Date.now();
11
+ QueryStubs.stubQueryCountResponse();
12
+ cy.createRepository({id: repositoryId});
13
+ cy.presetRepository(repositoryId);
14
+ // Given I visit a page with "ontotex-yasgu-web-component" in it.
15
+ SparqlEditorSteps.visitSparqlEditorPage();
16
+ });
17
+
18
+ afterEach(() => {
19
+ cy.deleteRepository(repositoryId);
20
+ });
21
+
22
+ it('Should display a "Visual" graph button configured by user', {
23
+ retries: {
24
+ runMode: 1,
25
+ openMode: 0
26
+ }
27
+ }, () => {
28
+ // When I visit a page with "ontotext-yasgui-web-component" on it,
29
+ // and select a CONSTRUCT query.
30
+ YasqeSteps.executeQuery();
31
+
32
+ // Then I expect "Visual" button to not be visible.
33
+ YasrSteps.getVisualButton().should('not.be.visible');
34
+
35
+ // When I execute a CONSTRUCT query.
36
+ YasqeSteps.pasteQuery(
37
+ 'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>' +
38
+ 'PREFIX onto: <http://www.ontotext.com/>' +
39
+ 'CONSTRUCT {' +
40
+ '?source rdf:type ?destination .' +
41
+ '} WHERE {' +
42
+ '?bag rdf:type ?source .' +
43
+ '?flight rdf:type ?destination' +
44
+ '}');
45
+ YasqeSteps.executeQuery();
46
+
47
+ // Then I expect "Visual" button to be visible.
48
+ YasrSteps.getVisualButton().should('be.visible');
49
+
50
+ // When I execute SELECT query again.
51
+ YasqeSteps.pasteQuery('select * where {?s ?p ?o.}');
52
+ YasqeSteps.executeQuery();
53
+
54
+ // Then I expect "Visual" button to not be visible.
55
+ YasrSteps.getVisualButton().should('not.be.visible');
56
+ });
57
+ });
@@ -1,4 +1,5 @@
1
- import VisualGraphSteps from "../../steps/visual-graph-steps";
1
+ import {VisualGraphSteps} from "../../steps/visual-graph-steps";
2
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
2
3
 
3
4
  const FILE_TO_IMPORT = 'wine.rdf';
4
5
  const VALID_RESOURCE = 'USRegion';
@@ -37,7 +38,7 @@ describe('Visual graph screen validation', () => {
37
38
  getGraphConfigName().type(graphConfigName, {force: true});
38
39
 
39
40
  cy.waitUntil(() => getGraphConfigName().should('have.value', graphConfigName));
40
- cy.pasteQuery('CONSTRUCT WHERE {?s ?p ?o} LIMIT 10');
41
+ YasqeSteps.pasteQuery('CONSTRUCT WHERE {?s ?p ?o} LIMIT 10');
41
42
  cy.waitUntilQueryIsVisible();
42
43
 
43
44
  getSaveConfig().click();
@@ -0,0 +1,139 @@
1
+ import {SparqlCreateUpdateSteps} from "../../steps/setup/sparql-create-update-steps";
2
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
3
+ import ImportSteps from "../../steps/import-steps";
4
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
5
+ import {MainMenuSteps} from "../../steps/main-menu-steps";
6
+ import {RepositorySelectorSteps} from "../../steps/repository-selector-steps";
7
+ import {SparqlTemplatesSteps} from "../../steps/setup/sparql-templates-steps";
8
+
9
+ describe('SPARQL create template', () => {
10
+
11
+ let repositoryId;
12
+ let secondRepositoryId;
13
+
14
+ beforeEach(() => {
15
+ repositoryId = 'sparql-templates-repo' + Date.now();
16
+ cy.createRepository({id: repositoryId});
17
+ cy.presetRepository(repositoryId);
18
+ secondRepositoryId = 'sparql-templates-second-repo' + Date.now();
19
+ cy.createRepository({id: secondRepositoryId});
20
+ SparqlCreateUpdateSteps.visit();
21
+ });
22
+
23
+ afterEach(() => {
24
+ cy.deleteRepository(repositoryId);
25
+ cy.deleteRepository(secondRepositoryId);
26
+ });
27
+
28
+ it('should has error message described that query is invalid', {
29
+ retries: {
30
+ runMode: 1,
31
+ openMode: 0
32
+ }
33
+ }, () => {
34
+ // When I visit 'Sparql create template' view,
35
+ // and fill valid template id.
36
+ SparqlCreateUpdateSteps.typeTemplateId('http://test');
37
+
38
+ // When I fill invalid query (select for example).
39
+ YasqeSteps.pasteQuery('select * where {?s ?p }');
40
+ // and click on "Save" button.
41
+ SparqlCreateUpdateSteps.clickOnSaveButton();
42
+
43
+ // Then I expect to see error message.
44
+ SparqlCreateUpdateSteps.getInvalidQueryElement().contains('Invalid query');
45
+ });
46
+
47
+ it('should display confirm dialog I am updating a sparql template and change the repository', {
48
+ retries: {
49
+ runMode: 1,
50
+ openMode: 0
51
+ }
52
+ }, () => {
53
+ // When I visit 'Sparql create template' view,
54
+ // create a SPARQL template
55
+ const templateId = 'http://' + Date.now();
56
+ SparqlCreateUpdateSteps.typeTemplateId(templateId);
57
+ SparqlCreateUpdateSteps.clickOnSaveButton();
58
+ SparqlTemplatesSteps.verifyUrl();
59
+ // and open it for edit.
60
+ SparqlCreateUpdateSteps.visit(templateId);
61
+
62
+ // When I change the repository.
63
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
64
+
65
+ // Then I expect to be redirected to sparql templates view.
66
+ SparqlTemplatesSteps.verifyUrl();
67
+
68
+ // When I open a sparql template for edit,
69
+ RepositorySelectorSteps.selectRepository(repositoryId);
70
+ SparqlCreateUpdateSteps.visit(templateId);
71
+
72
+ // and edit the query,
73
+ YasqeSteps.writeInEditor('query changed');
74
+ // and try to change the selected repository.
75
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
76
+
77
+ // Then I expect to see confirm dialog.
78
+ ModalDialogSteps.getDialogHeader().contains('Confirm');
79
+ ModalDialogSteps.getDialogBody().contains('You have unsaved changes. Are you sure that you want to exit?');
80
+
81
+ // When I confirm.
82
+ ModalDialogSteps.clickOnConfirmButton();
83
+
84
+ // Then I expect to be navigated to sparql templates view.
85
+ SparqlTemplatesSteps.verifyUrl();
86
+
87
+ // When I open a sparql template for edit,
88
+ RepositorySelectorSteps.selectRepository(repositoryId);
89
+ SparqlCreateUpdateSteps.visit(templateId);
90
+ // and edit the query,
91
+ YasqeSteps.writeInEditor('query changed');
92
+ // and try to change the selected repository.
93
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
94
+
95
+ // Then I expect to see confirm dialog.
96
+ ModalDialogSteps.getDialogHeader().contains('Confirm');
97
+ ModalDialogSteps.getDialogBody().contains('You have unsaved changes. Are you sure that you want to exit?');
98
+
99
+ // When I cancel.
100
+ ModalDialogSteps.clickOnCancelButton();
101
+
102
+ // Then I expect the view and repository not changed,
103
+ SparqlCreateUpdateSteps.verifyUrl();
104
+ RepositorySelectorSteps.getSelectedRepository().contains(repositoryId);
105
+
106
+ // When I close the dialog.
107
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
108
+ ModalDialogSteps.clickOnCloseButton();
109
+
110
+ // Then I expect the view and repository not changed,
111
+ SparqlCreateUpdateSteps.verifyUrl();
112
+ RepositorySelectorSteps.getSelectedRepository().contains(repositoryId);
113
+ });
114
+
115
+ it('should confirm me before navigate when query is changed', {
116
+ retries: {
117
+ runMode: 1,
118
+ openMode: 0
119
+ }
120
+ }, () => {
121
+ // When I visit 'Sparql create template' view,
122
+ // and change the query in ontotext-yasgui editor.
123
+ // When I fill non update query (select for example).
124
+ YasqeSteps.writeInEditor('change query');
125
+
126
+ // When I try to navigate to other view
127
+ MainMenuSteps.clickOnMenu('Import');
128
+
129
+ // Then I expect to see confirm dialog inform me that there are unsaved changes.
130
+ ModalDialogSteps.getDialogHeader().contains('Confirm');
131
+ ModalDialogSteps.getDialogBody().contains('You have unsaved changes. Are you sure that you want to exit?');
132
+
133
+ // When I click on confirm button.
134
+ ModalDialogSteps.clickOnConfirmButton();
135
+
136
+ // Then I expect to be navigated to other view.
137
+ ImportSteps.verifyUserImportUrl();
138
+ });
139
+ });
@@ -0,0 +1,89 @@
1
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
2
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
3
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
4
+ import {TablePluginSteps} from "../../../steps/yasgui/table-plugin-steps";
5
+
6
+ describe('Execute of update query', () => {
7
+
8
+ let repositoryId;
9
+
10
+ beforeEach(() => {
11
+ repositoryId = 'sparql-editor-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
16
+
17
+ SparqlEditorSteps.visitSparqlEditorPage();
18
+ YasqeSteps.getYasqe().should('be.visible');
19
+ });
20
+
21
+ afterEach(() => {
22
+ cy.deleteRepository(repositoryId);
23
+ });
24
+
25
+ it('should display properly result message info when insert 2 statements', {
26
+ retries: {
27
+ runMode: 1,
28
+ openMode: 0
29
+ }
30
+ }, () => {
31
+ // When I execute insert query which adds 2 results
32
+ YasqeSteps.pasteQuery(
33
+ 'PREFIX : <http://bedrock/> ' +
34
+ 'INSERT DATA { ' +
35
+ ':fred :hasSpouse :wilma.' +
36
+ ':fred :hasChild :pebbles.' +
37
+ '}');
38
+ YasqeSteps.executeQuery();
39
+
40
+ // Then I expect result message info to informs me that 2 statements have been added.
41
+ TablePluginSteps.getQueryResultInfo().contains('Added 2 statements.');
42
+ });
43
+
44
+ it('should display properly result message info when no one statement is added.', () => {
45
+ // When I execute insert query which don't change repository statements
46
+ YasqeSteps.pasteQuery(
47
+ 'PREFIX : <http://bedrock/> ' +
48
+ 'INSERT { ' +
49
+ ':fred :hasSpouse :wilma. ' +
50
+ '} WHERE { ' +
51
+ 'rdf:name rdf:label "not_exist_label".' +
52
+ '}');
53
+ YasqeSteps.executeQuery();
54
+
55
+ // Then I expect result message info to informs me that statements did not change.
56
+ TablePluginSteps.getQueryResultInfo().contains('The number of statements did not change.');
57
+ });
58
+
59
+ it('should display result message info which describes that two statements are removed', {
60
+ retries: {
61
+ runMode: 1,
62
+ openMode: 0
63
+ }
64
+ }, () => {
65
+ // When I visit a page with "ontotext-yasgui-web-component" in it,
66
+ // and selected repository has some inserted statements.
67
+ YasqeSteps.pasteQuery(
68
+ 'PREFIX : <http://bedrock/> ' +
69
+ 'INSERT DATA { ' +
70
+ ':fred :hasSpouse :wilma.' +
71
+ ':fred :hasChild :pebbles.' +
72
+ '}');
73
+ YasqeSteps.executeQuery();
74
+ // Wait statements to be inserted.
75
+ TablePluginSteps.getQueryResultInfo().contains('Added 2 statements.');
76
+
77
+ // When I execute delete query which removes 2 results
78
+ YasqeSteps.pasteQuery(
79
+ 'PREFIX : <http://bedrock/> ' +
80
+ 'DELETE DATA { ' +
81
+ ':fred :hasSpouse :wilma.' +
82
+ ':fred :hasChild :pebbles.' +
83
+ '}');
84
+ YasqeSteps.executeQuery();
85
+
86
+ // Then I expect result message info to informs me that 2 statements have been added.
87
+ TablePluginSteps.getQueryResultInfo().contains('Removed 2 statements.');
88
+ });
89
+ });
@@ -0,0 +1,84 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
+ import {ApplicationSteps} from "../../../steps/application-steps";
4
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
5
+ import {DEFAULT_QUERY} from "../../../steps/yasgui/saved-query";
6
+ import {ShareSavedQueryDialog} from "../../../steps/yasgui/share-saved-query-dialog";
7
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
8
+
9
+ describe('Share query', () => {
10
+
11
+ let repositoryId;
12
+
13
+ beforeEach(() => {
14
+ repositoryId = 'sparql-editor-' + Date.now();
15
+ QueryStubs.stubQueryCountResponse();
16
+ cy.createRepository({id: repositoryId});
17
+ cy.presetRepository(repositoryId);
18
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
19
+
20
+ SparqlEditorSteps.visitSparqlEditorPage();
21
+ YasguiSteps.getYasgui().should('be.visible');
22
+ });
23
+
24
+ afterEach(() => {
25
+ cy.deleteRepository(repositoryId);
26
+ });
27
+
28
+ it('Should be able to get shareable link for current query', () => {
29
+ // When I click on share query action
30
+ YasqeSteps.shareQuery();
31
+ // Then I expect a dialog with the shareable link to appear
32
+ ShareSavedQueryDialog.getDialog().should('be.visible');
33
+ ShareSavedQueryDialog.getDialogTitle().should('contain', 'Copy URL to clipboard');
34
+ ShareSavedQueryDialog.getShareLink().then((shareLink) => {
35
+ expect(shareLink).to.have.string(`/sparql?name=Unnamed&query=select%20*%20where%20%7B%20%20%0A%20%3Fs%20%3Fp%20%3Fo%20.%20%0A%20%7D%20limit%20100&infer=true&sameAs=true`);
36
+ });
37
+ // When I cancel operation
38
+ ShareSavedQueryDialog.closeDialog();
39
+ // Then I expect that the dialog should be closed
40
+ ShareSavedQueryDialog.getDialog().should('not.exist');
41
+ // And I click the copy button
42
+ YasqeSteps.shareQuery();
43
+ ShareSavedQueryDialog.getDialog().should('be.visible');
44
+ ShareSavedQueryDialog.copyLink();
45
+ // Then I expect that the share link is copied in the clipboard
46
+ ShareSavedQueryDialog.getDialog().should('not.exist');
47
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
48
+ });
49
+
50
+ it('Should be able to open a share link in a new editor tab',
51
+ {
52
+ retries: {
53
+ runMode: 1,
54
+ openMode: 0
55
+ }
56
+ }, () => {
57
+ // Given I have opened the sparql editor
58
+ YasguiSteps.getTabs().should('have.length', 1);
59
+ // When I get the shareable link for current query
60
+ YasqeSteps.shareQuery();
61
+ ShareSavedQueryDialog.getDialog().should('be.visible');
62
+ // And I open the link
63
+ ShareSavedQueryDialog.getShareLink().then((shareLink) => {
64
+ cy.visit(shareLink);
65
+ // Then I expect that the sparql view should be opened
66
+ // And the saved query will be loaded in the editor
67
+ YasguiSteps.getTabs().should('have.length', 1);
68
+ YasguiSteps.getCurrentTab().should('contain', 'Unnamed');
69
+ YasguiSteps.getTabQuery(0).should('contain', DEFAULT_QUERY);
70
+ // TODO: And the infer should be active
71
+ // TODO: And the expand results should be active
72
+ // When I open the other tab
73
+ // TODO: the next step appears to be flaky with the element is detached error
74
+ // YasguiSteps.openTab(0);
75
+ // YasguiSteps.getCurrentTab().should('contain', 'Unnamed');
76
+ // // And I open the share link again
77
+ // cy.visit(shareLink);
78
+ // // Then I expect that the previously opened tab to be selected instead of opening a new one
79
+ // YasguiSteps.getTabs().should('have.length', 2);
80
+ // YasguiSteps.getCurrentTab().should('contain', savedQueryName);
81
+ // YasguiSteps.getTabQuery(0).should('contain', DEFAULT_QUERY);
82
+ });
83
+ });
84
+ });