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,107 @@
1
+ import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
2
+ import {TabContextMenu, YasguiSteps} from "../../steps/yasgui/yasgui-steps";
3
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
4
+ import {YasrSteps} from "../../steps/yasgui/yasr-steps";
5
+ import {ConfirmationDialogSteps} from "../../steps/yasgui/confirmation-dialog-steps";
6
+ import {QueryStubs} from "../../stubs/yasgui/query-stubs";
7
+
8
+ describe('Yasgui tabs', () => {
9
+
10
+ let repositoryId;
11
+ beforeEach(() => {
12
+ repositoryId = 'sparql-editor-' + Date.now();
13
+ QueryStubs.stubQueryCountResponse();
14
+ cy.createRepository({id: repositoryId});
15
+ cy.presetRepository(repositoryId);
16
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
17
+ });
18
+
19
+ afterEach(() => {
20
+ cy.deleteRepository(repositoryId);
21
+ });
22
+
23
+ it('Should ask for confirmation on tab close', () => {
24
+ // Given I have opened yasgui with a single opened tab
25
+ SparqlEditorSteps.visitSparqlEditorPage();
26
+ // And I have created a second tab
27
+ openNewTab(2);
28
+ // When I close the second tab
29
+ YasguiSteps.closeTab(1);
30
+ // Then I expect a confirmation dialog to be opened
31
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
32
+ ConfirmationDialogSteps.getConfirmation().should('contain.text', 'Are you sure you want to close this query tab?');
33
+ // When I cancel the operation
34
+ ConfirmationDialogSteps.reject();
35
+ ConfirmationDialogSteps.getConfirmation().should('not.exist');
36
+ // Then I expect that to remain opened
37
+ YasguiSteps.getTabs().should('have.length', 2);
38
+ // When I try closing it again
39
+ YasguiSteps.closeTab(1);
40
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
41
+ // And I confirm
42
+ ConfirmationDialogSteps.confirm();
43
+ // Then I expect that the tab will be closed
44
+ YasguiSteps.getTabs().should('have.length', 1);
45
+ YasguiSteps.getCurrentTabTitle().should('have.text', 'Unnamed');
46
+ });
47
+
48
+ it('Should ask for confirmation on tab close through tab context menu', {
49
+ retries: {
50
+ runMode: 1,
51
+ openMode: 0
52
+ }
53
+ }, () => {
54
+ // Given I have opened yasgui with a single opened tab
55
+ SparqlEditorSteps.visitSparqlEditorPage();
56
+ // And I have created a second tab
57
+ openNewTab(2);
58
+ // When I close the second tab
59
+ YasguiSteps.openTabContextMenu(1).should('be.visible');
60
+ TabContextMenu.closeTab();
61
+ // Then I expect a confirmation dialog to be opened
62
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
63
+ // And I confirm
64
+ ConfirmationDialogSteps.confirm();
65
+ // Then I expect that the tab will be closed
66
+ YasguiSteps.getTabs().should('have.length', 1);
67
+ YasguiSteps.getCurrentTabTitle().should('have.text', 'Unnamed');
68
+ });
69
+
70
+ it('Should ask for confirmation on close other tabs action', {
71
+ retries: {
72
+ runMode: 1,
73
+ openMode: 0
74
+ }
75
+ }, () => {
76
+ // Given I have opened yasgui with a single opened tab
77
+ SparqlEditorSteps.visitSparqlEditorPage();
78
+ // And I have created more tabs
79
+ openNewTab(2);
80
+ // When I try closing all other tabs but the last one
81
+ YasguiSteps.openTabContextMenu(1).should('be.visible');
82
+ TabContextMenu.closeOtherTabs();
83
+ // Then I expect a confirmation dialog to be opened
84
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
85
+ ConfirmationDialogSteps.getConfirmation().should('contain.text', 'Are you sure you want to close all other query tabs?');
86
+ // When I cancel the operation
87
+ ConfirmationDialogSteps.reject();
88
+ ConfirmationDialogSteps.getConfirmation().should('not.exist');
89
+ // Then I expect that to remain opened
90
+ YasguiSteps.getTabs().should('have.length', 2);
91
+ YasguiSteps.openTabContextMenu(1).should('be.visible');
92
+ TabContextMenu.closeOtherTabs();
93
+ ConfirmationDialogSteps.getConfirmation().should('be.visible');
94
+ // And I confirm
95
+ ConfirmationDialogSteps.confirm();
96
+ // Then I expect that the tab will be closed
97
+ YasguiSteps.getTabs().should('have.length', 1);
98
+ YasguiSteps.getCurrentTabTitle().should('have.text', 'Unnamed 1');
99
+ });
100
+ });
101
+
102
+ function openNewTab(expectedTabsCount) {
103
+ YasguiSteps.openANewTab();
104
+ YasguiSteps.getTabs().should('have.length', expectedTabsCount);
105
+ // Execute the query for a bit of delay before closing the tab
106
+ YasqeSteps.executeQuery();
107
+ }
@@ -0,0 +1,62 @@
1
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
2
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
3
+ import {YasrSteps} from "../../../steps/yasgui/yasr-steps";
4
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
5
+
6
+ describe('Download results', () => {
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
+ it('Should be able to download result as a file', () => {
23
+ QueryStubs.stubDownloadAsJSONResponse(repositoryId);
24
+ YasqeSteps.executeQuery();
25
+ YasrSteps.getDownloadAsDropdown().should('be.visible');
26
+ YasrSteps.downloadAs(0);
27
+ cy.wait('@download').its('request.body').should('equal', '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&offset=0&limit=1001')
28
+ });
29
+
30
+ context('DownloadAs button', () => {
31
+ it('should not be visible if query is not ran', () => {
32
+ // When yasr has not result
33
+ // Then download dropdown should not be visible.
34
+ YasrSteps.getDownloadAsDropdown().should('not.be.visible');
35
+ });
36
+
37
+ it('Should "Download as" dropdown be visible if there is results', () => {
38
+ // When execute a query witch returns results.
39
+ YasqeSteps.executeQuery();
40
+
41
+ // Then "Download as" dropdown should be visible.
42
+ YasrSteps.getDownloadAsDropdown().should('be.visible');
43
+ });
44
+
45
+ it('should contains following dropdown option.', () => {
46
+ // When execute a query witch returns results.
47
+ YasqeSteps.executeQuery();
48
+ // And open the download button.
49
+ YasrSteps.openDownloadAsDropdown();
50
+
51
+ // Then expect follow options to be present.
52
+ YasrSteps.getDownloadAsOption(0).contains('JSON');
53
+ YasrSteps.getDownloadAsOption(1).contains( 'JSON*');
54
+ YasrSteps.getDownloadAsOption(2).contains( 'XML');
55
+ YasrSteps.getDownloadAsOption(3).contains( 'XML*');
56
+ YasrSteps.getDownloadAsOption(4).contains( 'CSV');
57
+ YasrSteps.getDownloadAsOption(5).contains( 'TSV');
58
+ YasrSteps.getDownloadAsOption(6).contains( 'TSV*');
59
+ YasrSteps.getDownloadAsOption(7).contains( 'Binary RDF Results');
60
+ });
61
+ });
62
+ });
@@ -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 have two more page around selected page', {
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('not.exist');
174
+ PaginationSteps.getPageNumberButton(4).should('not.exist');
175
+ PaginationSteps.getPageNumberButton(5).should('not.exist');
176
+ PaginationSteps.getPageNumberButton(6).should('not.exist');
177
+ PaginationSteps.getNextPageButton().should('not.be.disabled');
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('not.exist');
189
+ PaginationSteps.getPageNumberButton(6).should('not.exist');
190
+ PaginationSteps.getNextPageButton().should('not.be.disabled');
191
+
192
+ // When select third page
193
+ PaginationSteps.clickOnPageNumberButton(3);
194
+ PaginationSteps.waitPageSelected(3);
195
+
196
+ PaginationSteps.getPreviousPageButton().should('not.be.disabled');
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('not.be.disabled');
204
+
205
+ // When select fifth page
206
+ PaginationSteps.clickOnPageNumberButton(5);
207
+ PaginationSteps.waitPageSelected(5);
208
+
209
+ PaginationSteps.getPreviousPageButton().should('not.be.disabled');
210
+ PaginationSteps.getPageNumberButton(1).should('not.exist');
211
+ PaginationSteps.getPageNumberButton(2).should('not.exist');
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('not.be.disabled');
218
+
219
+ // When select last page
220
+ PaginationSteps.clickOnPageNumberButton(6);
221
+ PaginationSteps.waitPageSelected(6);
222
+
223
+ PaginationSteps.getPreviousPageButton().should('not.be.disabled');
224
+ PaginationSteps.getPageNumberButton(1).should('not.exist');
225
+ PaginationSteps.getPageNumberButton(2).should('not.exist');
226
+ PaginationSteps.getPageNumberButton(3).should('not.exist');
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,191 @@
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
+ import {ApplicationSteps} from "../../../steps/application-steps";
6
+ import {TablePluginSteps} from "../../../steps/yasgui/table-plugin-steps";
7
+
8
+ describe('Yasr Table plugin', () => {
9
+ let repositoryId;
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
+ // 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('Results formatting', () => {
25
+
26
+ it('Should all resource be formatted with short uri when results are of type uri', {
27
+ retries: {
28
+ runMode: 1,
29
+ openMode: 0
30
+ }
31
+ }, () => {
32
+ // When I execute a query which return results and results type is uri.
33
+ QueryStubs.stubDefaultQueryResponse();
34
+ YasqeSteps.executeQuery();
35
+
36
+ // Then I expect results to be displayed with short uri.
37
+ YasrSteps.getResultCell(1, 2).contains('rdf:type');
38
+ YasrSteps.getResultCell(4, 3).contains('owl:TransitiveProperty');
39
+ });
40
+
41
+ it('Should copy url link be visible when the mouse is over a cell of result table', () => {
42
+ // When I execute a query which return results and results type is uri.
43
+ QueryStubs.stubDefaultQueryResponse();
44
+ YasqeSteps.executeQuery();
45
+
46
+ // And I hovered the mouse over a cell of result table.
47
+ YasrSteps.hoverCell(28, 2);
48
+
49
+ // Then I expect copy url link to be visible
50
+ YasrSteps.getCopyResourceLink(28, 2).should('be.visible');
51
+ });
52
+ });
53
+
54
+ describe('Copy resource link dialog', () => {
55
+
56
+ it('Should open copy link dialog', {
57
+ retries: {
58
+ runMode: 1,
59
+ openMode: 0
60
+ }
61
+ }, () => {
62
+ // When I execute a query which returns results of type is uri.
63
+ QueryStubs.stubDefaultQueryResponse();
64
+ YasqeSteps.executeQuery();
65
+ // And copy resource dialog is open.
66
+ openCopyResourceLinkDialog();
67
+
68
+ // Then I expect copy link dialog to be opened.
69
+ TablePluginSteps.getCopyResourceLinkDialog().should('be.visible');
70
+ });
71
+
72
+ it('Should close copy link dialog when click on close button', {
73
+ retries: {
74
+ runMode: 1,
75
+ openMode: 0
76
+ }
77
+ }, () => {
78
+ // When I execute a query which returns results of type is uri.
79
+ QueryStubs.stubDefaultQueryResponse();
80
+ YasqeSteps.executeQuery();
81
+ // And copy resource dialog is open.
82
+ openCopyResourceLinkDialog();
83
+
84
+ // When I click on close button
85
+ TablePluginSteps.clickCopyLinkDialogCloseButton();
86
+
87
+ // Then I expect copy link dialog to be closed.
88
+ TablePluginSteps.getCopyResourceLinkDialog().should('not.exist');
89
+ });
90
+
91
+ it('Should close copy link dialog when click on cancel button', {
92
+ retries: {
93
+ runMode: 1,
94
+ openMode: 0
95
+ }
96
+ }, () => {
97
+ // When I execute a query which returns results of type is uri.
98
+ QueryStubs.stubDefaultQueryResponse();
99
+ YasqeSteps.executeQuery();
100
+ // And copy resource link dialog is open
101
+ openCopyResourceLinkDialog();
102
+
103
+ // And click on cancel button
104
+ TablePluginSteps.clickCopyLinkDialogCancelButton();
105
+
106
+ // Then I expect copy link dialog to be closed.
107
+ TablePluginSteps.getCopyResourceLinkDialog().should('not.exist');
108
+ });
109
+
110
+ it('Should close copy link dialog when click on copy link button', () => {
111
+ // When I execute a query which returns results of type is uri.
112
+ QueryStubs.stubDefaultQueryResponse();
113
+ YasqeSteps.executeQuery();
114
+ // And copy resource link dialog is open
115
+ openCopyResourceLinkDialog();
116
+
117
+ // And click on copy button
118
+ TablePluginSteps.clickCopyLinkDialogCopyButton();
119
+
120
+ // Then I expect copy link dialog to be closed.
121
+ TablePluginSteps.getCopyResourceLinkDialog().should('not.exist');
122
+ });
123
+
124
+ it('Should close copy link dialog when click outside dialog', () => {
125
+ // When I execute a query which returns results of type is uri.
126
+ QueryStubs.stubDefaultQueryResponse();
127
+ YasqeSteps.executeQuery();
128
+ // And copy resource link dialog is open
129
+ openCopyResourceLinkDialog();
130
+
131
+ // And click on copy button
132
+ TablePluginSteps.clickOutsideCopyLinkDialog();
133
+
134
+ // Then I expect copy link dialog to be closed.
135
+ TablePluginSteps.getCopyResourceLinkDialog().should('not.exist');
136
+ });
137
+
138
+ it('Should input of copy link dialog be filled when dialog is open', () => {
139
+ // When I execute a query which returns results of type is uri.
140
+ QueryStubs.stubDefaultQueryResponse();
141
+ YasqeSteps.executeQuery();
142
+ // And copy resource link dialog is open
143
+ openCopyResourceLinkDialog();
144
+
145
+ // Then I expect the input of dialog to have value.
146
+ TablePluginSteps.getCopyResourceLinkInput().should('have.value', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type');
147
+ });
148
+
149
+ it('Should show success message when user click on copy resource link button.', {
150
+ retries: {
151
+ runMode: 1,
152
+ openMode: 0
153
+ }
154
+ }, () => {
155
+ // When I execute a query
156
+ YasqeSteps.executeQuery();
157
+
158
+ // Then I expect results to be displayed with short uri.
159
+ YasrSteps.getResultCell(1, 2).contains('rdf:type');
160
+ YasrSteps.getResultCell(4, 3).contains('owl:TransitiveProperty');
161
+
162
+ // When I hovered the mouse over a cell of result table.
163
+ YasrSteps.hoverCell(28, 2);
164
+
165
+ // Then I expect copy url link to be visible
166
+ YasrSteps.getCopyResourceLink(28, 2).should('be.visible');
167
+
168
+ // When I click on a copy link.
169
+ YasrSteps.clickOnCopyResourceLink(28, 2);
170
+
171
+ // Then copy resource link dialog have to be opened.
172
+ TablePluginSteps.getCopyResourceLinkDialog().should('be.visible');
173
+ // And input of dialog have to be filled with resource uri
174
+ TablePluginSteps.getCopyResourceLinkInput().should('have.value', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type');
175
+
176
+ // When I click on button "Copy to clipboard"
177
+ TablePluginSteps.clickCopyLinkDialogCopyButton();
178
+
179
+ // And expect success message to be displayed.
180
+ ApplicationSteps.getSuccessNotifications().contains('URL copied successfully to clipboard.');
181
+ // And copy resource link dialog have to not be opened.
182
+ TablePluginSteps.getCopyResourceLinkDialog().should('not.exist');
183
+ });
184
+ });
185
+
186
+ function openCopyResourceLinkDialog(rowNumber = 28, cellNumber = 2) {
187
+ YasrSteps.hoverCell(rowNumber, cellNumber);
188
+ YasrSteps.getCopyResourceLink(rowNumber, cellNumber).should('be.visible');
189
+ YasrSteps.clickOnCopyResourceLink(rowNumber, cellNumber);
190
+ }
191
+ });
@@ -0,0 +1,56 @@
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 button when user execute a CONSTRUCT query.', () => {
7
+ let repositoryId;
8
+ beforeEach(() => {
9
+ repositoryId = 'sparql-editor-' + Date.now();
10
+ QueryStubs.stubQueryCountResponse();
11
+ cy.createRepository({id: repositoryId});
12
+ cy.presetRepository(repositoryId);
13
+ // Given I visit a page with "ontotex-yasgu-web-component" in it.
14
+ SparqlEditorSteps.visitSparqlEditorPage();
15
+ });
16
+
17
+ afterEach(() => {
18
+ cy.deleteRepository(repositoryId);
19
+ });
20
+
21
+ it('should display a "Visual" button configured by user .', {
22
+ retries: {
23
+ runMode: 1,
24
+ openMode: 0
25
+ }
26
+ }, () => {
27
+ // When I visit a page with "ontotext-yasgui-web-component" on it,
28
+ // and select a CONSTRUCT query.
29
+ YasqeSteps.executeQuery();
30
+
31
+ // Then I expect "Visual" button to not be visible.
32
+ YasrSteps.getVisualButton().should('not.be.visible');
33
+
34
+ // When I execute a CONSTRUCT query.
35
+ YasqeSteps.pasteQuery(
36
+ 'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>' +
37
+ 'PREFIX onto: <http://www.ontotext.com/>' +
38
+ 'CONSTRUCT {' +
39
+ '?source rdf:type ?destination .' +
40
+ '} WHERE {' +
41
+ '?bag rdf:type ?source .' +
42
+ '?flight rdf:type ?destination' +
43
+ '}');
44
+ YasqeSteps.executeQuery();
45
+
46
+ // Then I expect "Visual" button to be visible.
47
+ YasrSteps.getVisualButton().should('be.visible');
48
+
49
+ // When I execute SELECT query again.
50
+ YasqeSteps.pasteQuery('select * where {?s ?p ?o.}');
51
+ YasqeSteps.executeQuery();
52
+
53
+ // Then I expect "Visual" button to not be visible.
54
+ YasrSteps.getVisualButton().should('not.be.visible');
55
+ });
56
+ });