graphdb-workbench-tests 3.5.3 → 4.0.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 (136) hide show
  1. package/cypress-guides.config.js +45 -0
  2. package/e2e-flaky/import/import-server-files-operations.spec.js +8 -30
  3. package/e2e-flaky/import/import-user-data-batch-operations.spec.js +7 -7
  4. package/e2e-flaky/import/import-user-data-url.spec.js +1 -1
  5. package/e2e-flaky/sparql-editor/lucene-connector.spec.js +1 -1
  6. package/e2e-legacy/explore/graphs-overview/graphs.overview.spec.js +31 -2
  7. package/e2e-legacy/explore/visual-graph/visual.graph.spec.js +35 -4
  8. package/e2e-legacy/graph-navigator/graph-navigator-restrictions.spec.js +216 -0
  9. package/e2e-legacy/graph-navigator/graph-navigator.spec.js +520 -0
  10. package/e2e-legacy/guides/import-rdf-file/confirm-duplicate-rdf-file.spec.js +1 -1
  11. package/e2e-legacy/guides/main-menu/main-menu-guide.spec.js +6 -14
  12. package/e2e-legacy/guides/ttyg/configure-agent/configure-agent-guide.spec.js +27 -32
  13. package/e2e-legacy/guides/ttyg/edit-agent/edit-ttyg-agent-guide.spec.js +12 -20
  14. package/e2e-legacy/help/rest-api-documentatio/rest-api-documentation-theme.spec.js +50 -0
  15. package/e2e-legacy/home/home-page-without-repositories.spec.js +3 -1
  16. package/e2e-legacy/home/home-page-without-selected-repository.spec.js +2 -1
  17. package/e2e-legacy/import/import-server-files-batch-operations.spec.js +38 -5
  18. package/e2e-legacy/import/import-server-files.spec.js +39 -23
  19. package/e2e-legacy/import/import-user-data-file-upload.spec.js +83 -23
  20. package/e2e-legacy/import/import-user-data-settings-dialog.spec.js +81 -10
  21. package/e2e-legacy/import/import-user-data-text-snippet.spec.js +6 -45
  22. package/e2e-legacy/import/import-user-data-url.spec.js +9 -5
  23. package/e2e-legacy/import/import-user-data.spec.js +8 -8
  24. package/e2e-legacy/import/import-view.spec.js +2 -2
  25. package/e2e-legacy/import/initial-state/import-page-with-selected-repositor.js +1 -1
  26. package/e2e-legacy/import/initial-state/import-page-with-selected-repository-without-imported-files.js +1 -1
  27. package/e2e-legacy/monitor/global-operation-statuses-component.spec.js +13 -17
  28. package/e2e-legacy/monitor/query-and-updates/queries-and-updates-with-repository.spec.js +16 -0
  29. package/e2e-legacy/rdf-version/rdf-version-accept-header.spec.js +145 -0
  30. package/e2e-legacy/repository/attach-remote-location.spec.js +7 -15
  31. package/e2e-legacy/repository/fedx-deprecation.spec.js +178 -0
  32. package/e2e-legacy/repository/ontop-repository.spec.js +25 -34
  33. package/e2e-legacy/repository/rename-repository-restrictions.spec.js +129 -0
  34. package/e2e-legacy/repository/repositories.spec.js +27 -10
  35. package/e2e-legacy/repository/repository-picker-tooltip.spec.js +72 -0
  36. package/e2e-legacy/repository/repository-selector-tooltip.spec.js +55 -0
  37. package/e2e-legacy/resource/resource.spec.js +177 -40
  38. package/e2e-legacy/setup/aclmanagement/create-rule.spec.js +14 -25
  39. package/e2e-legacy/setup/aclmanagement/delete-rule.spec.js +6 -6
  40. package/e2e-legacy/setup/aclmanagement/edit-rule.spec.js +15 -15
  41. package/e2e-legacy/setup/aclmanagement/render-rules.spec.js +1 -1
  42. package/e2e-legacy/setup/aclmanagement/reorder-rules.spec.js +2 -2
  43. package/e2e-legacy/setup/aclmanagement/revert-rules.spec.js +2 -2
  44. package/e2e-legacy/setup/aclmanagement/update-rules.spec.js +3 -3
  45. package/e2e-legacy/setup/aclmanagement/validate-uri.spec.js +152 -0
  46. package/e2e-legacy/setup/connectors/connectors-initial-state-with-selected-repository.spec.js +1 -1
  47. package/e2e-legacy/setup/plugins/plugins-without-repository.spec.js +1 -1
  48. package/e2e-legacy/setup/settings/my-settings.spec.js +25 -15
  49. package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +34 -24
  50. package/e2e-legacy/sparql-editor/actions/expand-results-over-sameas.spec.js +8 -8
  51. package/e2e-legacy/sparql-editor/actions/include-inferred-statements.spec.js +4 -4
  52. package/e2e-legacy/sparql-editor/actions/inferred-sameas.spec.js +2 -2
  53. package/e2e-legacy/sparql-editor/saved-query/abort-query.spec.js +1 -1
  54. package/e2e-legacy/sparql-editor/sparql-editor-navigation.spec.js +219 -0
  55. package/e2e-legacy/sparql-editor/yasgui-tabs.spec.js +1 -1
  56. package/e2e-legacy/sparql-editor/yasr/download-as.spec.js +4 -7
  57. package/e2e-legacy/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +8 -8
  58. package/e2e-legacy/ttyg/chat-list.spec.js +16 -1
  59. package/e2e-legacy/ttyg/chat-panel.spec.js +14 -0
  60. package/e2e-legacy/ttyg/chat-template-injection.spec.js +49 -0
  61. package/e2e-legacy/ttyg/create-chat.spec.js +1 -1
  62. package/e2e-legacy/ttyg/delete-agent.spec.js +14 -0
  63. package/e2e-legacy/ttyg/edit-agent.spec.js +8 -0
  64. package/e2e-legacy/ttyg/ttyg-initial-state-with-configured-api-key.spec.js +1 -1
  65. package/e2e-legacy/ttyg/ttyg-initial-state-with-selected-repository.spec.js +1 -1
  66. package/e2e-legacy/ttyg/ttyg-initial-state-without-repositories.spec.js +1 -1
  67. package/e2e-security/explore/visual-graph/graph-config-owner-actions.spec.js +52 -0
  68. package/e2e-security/repository/url-with-repository-id-parameter.spec.js +17 -0
  69. package/e2e-security/setup/home/cookie-policy.spec.js +4 -0
  70. package/e2e-security/setup/license/license-loading.spec.js +57 -0
  71. package/e2e-security/setup/license/license-logout.spec.js +38 -0
  72. package/e2e-security/setup/users-and-access/create-user-permissions.spec.js +1 -1
  73. package/e2e-security/setup/users-and-access/repo-admin-role.spec.js +1 -1
  74. package/e2e-security/setup/users-and-access/user-and-access.spec.js +0 -1
  75. package/eslint.config.js +5 -0
  76. package/fixtures/connectors/get-connectors.json +0 -1
  77. package/fixtures/graph-navigator/graph-navigator-settings-invalid.ttl +149 -0
  78. package/fixtures/graph-navigator/graph-navigator-settings.ttl +148 -0
  79. package/fixtures/graphdb-import/wine.rdf +279 -285
  80. package/fixtures/monitoring/get-active-queries-cluster-replicating.json +15 -0
  81. package/fixtures/ttyg/agent/get-agent-list-with-html-in-names.json +77 -0
  82. package/fixtures/ttyg/chats/get-chat-list-with-html-in-name.json +22 -0
  83. package/fixtures/ttyg/chats/get-chat-with-template-injection.json +27 -0
  84. package/npm-shrinkwrap.json +1264 -1265
  85. package/package.json +12 -2
  86. package/steps/application-steps.js +4 -0
  87. package/steps/base-steps.js +4 -0
  88. package/steps/cookie-policy/cookie-consent-banner-steps.js +2 -2
  89. package/steps/error-steps.js +2 -2
  90. package/steps/explore/graphs-overview-steps.js +44 -0
  91. package/steps/graph-navigator-steps.js +159 -0
  92. package/steps/header-steps.js +5 -1
  93. package/steps/home-steps.js +3 -6
  94. package/steps/import/import-server-files-steps.js +8 -0
  95. package/steps/import/import-settings-dialog-steps.js +16 -0
  96. package/steps/import/import-steps.js +94 -23
  97. package/steps/import/import-test-constants.js +1 -1
  98. package/steps/import/import-user-data-steps.js +26 -26
  99. package/steps/language-selector-steps.js +4 -0
  100. package/steps/layout-steps.js +6 -0
  101. package/steps/login-steps.js +7 -3
  102. package/steps/main-menu-steps.js +14 -14
  103. package/steps/monitoring/queries-and-updates-steps.js +9 -0
  104. package/steps/ontop-repository-steps.js +4 -0
  105. package/steps/page-restrictions-steps.js +24 -0
  106. package/steps/repositories/attach-repository-steps.js +2 -10
  107. package/steps/repository-picker-list-steps.js +58 -0
  108. package/steps/repository-selector-steps.js +20 -0
  109. package/steps/repository-steps.js +64 -9
  110. package/steps/resource/resource-steps.js +76 -9
  111. package/steps/rest-api-documentation-steps.js +23 -0
  112. package/steps/setup/acl-management-steps.js +4 -24
  113. package/steps/setup/settings-steps.js +42 -0
  114. package/steps/toaster-steps.js +4 -0
  115. package/steps/ttyg/chat-panel-steps.js +4 -0
  116. package/steps/ttyg/ttyg-view-steps.js +1 -14
  117. package/steps/visual-graph-steps.js +8 -0
  118. package/steps/widgets/repository-errors-widget-steps.js +15 -2
  119. package/steps/yasgui/yasqe-steps.js +5 -7
  120. package/steps/yasgui/yasr-steps.js +8 -0
  121. package/stubs/browser-stubs.js +40 -0
  122. package/stubs/graph-navigator-stubs.js +28 -0
  123. package/stubs/license-stubs.js +11 -3
  124. package/stubs/monitoring/queries-and-updates-stubs.js +5 -0
  125. package/stubs/repositories/repositories-stubs.js +44 -0
  126. package/stubs/ttyg/ttyg-stubs.js +3 -2
  127. package/stubs/yasgui/query-stubs.js +5 -0
  128. package/support/repository-commands.js +15 -0
  129. package/support/sparql-commands.js +2 -0
  130. package/support/visual-graph-commands.js +19 -0
  131. package/e2e-legacy/home/solr-banner/solr-banner.spec.js +0 -137
  132. package/fixtures/graphdb-import/test-trigstar.trigs +0 -32
  133. package/fixtures/graphdb-import/test_turtlestar.ttls +0 -6
  134. package/fixtures/graphdb-import/turtlestar-data.ttls +0 -77
  135. package/steps/deprecation-banner/deprecation-banner-steps.js +0 -13
  136. package/steps/deprecation-steps.js +0 -13
@@ -0,0 +1,520 @@
1
+ import {GraphNavigatorSteps} from '../../steps/graph-navigator-steps.js';
2
+ import {LanguageSelectorSteps} from '../../steps/language-selector-steps.js';
3
+ import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
4
+ import {MainMenuSteps} from '../../steps/main-menu-steps.js';
5
+ import {YasqeSteps} from '../../steps/yasgui/yasqe-steps.js';
6
+ import {YasrSteps} from '../../steps/yasgui/yasr-steps.js';
7
+ import {ToasterSteps} from '../../steps/toaster-steps.js';
8
+ import {GraphNavigatorStubs} from '../../stubs/graph-navigator-stubs.js';
9
+
10
+ const FILE_TO_IMPORT = 'resource-test-data.ttl';
11
+ const SEED_RESOURCE_ENCODED = 'http:%2F%2Fexample.com%2Fontology%23CustomerLoyalty';
12
+ const SEED_RESOURCE_LABEL = 'CustomerLoyalty';
13
+ const SETTINGS_FILE_NAME = 'graph-navigator-settings.ttl';
14
+ const SETTINGS_FILE = `fixtures/graph-navigator/${SETTINGS_FILE_NAME}`;
15
+ const INVALID_SETTINGS_FILE_NAME = 'graph-navigator-settings-invalid.ttl';
16
+ const INVALID_SETTINGS_FILE = `fixtures/graph-navigator/${INVALID_SETTINGS_FILE_NAME}`;
17
+
18
+ const CONSTRUCT_QUERY = 'CONSTRUCT { <http://example.com/ontology#CustomerLoyalty> ?p ?o } WHERE { <http://example.com/ontology#CustomerLoyalty> ?p ?o }';
19
+ const CONSTRUCT_TARGET_LABEL = 'Metric';
20
+ // TODO: Remove once GraphDB creates the system repository itself.
21
+ // The graph-navigator settings endpoint requires this repository.
22
+ const SYSTEM_REPOSITORY_ID = 'SystemRepository';
23
+
24
+ /**
25
+ * Switches the repository on the SPARQL view and returns to the Graph Navigator view via the navigation bar.
26
+ *
27
+ * @param {string} repositoryId The repository to switch to.
28
+ */
29
+ function switchRepositoryOnAnotherViewAndReturn(repositoryId) {
30
+ MainMenuSteps.clickOnSparqlMenu();
31
+ GraphNavigatorSteps.getComponent().should('not.exist');
32
+ YasqeSteps.getEditor().should('be.visible');
33
+ RepositorySelectorSteps.selectRepository(repositoryId);
34
+ RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
35
+ MainMenuSteps.clickOnGraphNavigator();
36
+ }
37
+
38
+ describe('Graph Navigator', () => {
39
+ let repositoryId;
40
+
41
+ // TODO: Remove once GraphDB creates the system repository itself.
42
+ before(() => {
43
+ cy.deleteRepository(SYSTEM_REPOSITORY_ID);
44
+ cy.createRepository({id: SYSTEM_REPOSITORY_ID});
45
+ });
46
+
47
+ // TODO: Remove once GraphDB creates the system repository itself.
48
+ after(() => {
49
+ cy.deleteRepository(SYSTEM_REPOSITORY_ID);
50
+ });
51
+
52
+ beforeEach(() => {
53
+ repositoryId = 'repository-' + Date.now();
54
+ cy.createRepository({id: repositoryId});
55
+ cy.presetRepository(repositoryId);
56
+ cy.importServerFile(repositoryId, FILE_TO_IMPORT);
57
+ });
58
+
59
+ afterEach(() => {
60
+ cy.deleteRepository(repositoryId);
61
+ });
62
+
63
+ it('should mount the Graph Navigator workspace when a repository is active', () => {
64
+ // Given I open the Graph Navigator view without a start resource.
65
+ GraphNavigatorSteps.visit();
66
+
67
+ // Then I expect the Graph Navigator workspace and its canvas to be rendered.
68
+ GraphNavigatorSteps.getWorkspace().should('exist');
69
+ GraphNavigatorSteps.getCanvas().should('exist');
70
+
71
+ // And I expect the canvas to start empty because no start resource was provided.
72
+ GraphNavigatorSteps.getElements().should('not.exist');
73
+ });
74
+
75
+ it('should place the start resource on the canvas as a seed', () => {
76
+ // Given I open the Graph Navigator view with a start resource.
77
+ GraphNavigatorSteps.visit(SEED_RESOURCE_ENCODED);
78
+
79
+ // Then I expect the start resource to be placed on the canvas as a seed element.
80
+ GraphNavigatorSteps.getElements().should('have.length', 1);
81
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
82
+ });
83
+
84
+ it('should show an error toast, when a graph request fails', () => {
85
+ // Given the repository's SPARQL requests fail.
86
+ cy.intercept('POST', `/repositories/${repositoryId}`, {statusCode: 500}).as('graphRequest');
87
+
88
+ // When I open the Graph Navigator view with a start resource.
89
+ GraphNavigatorSteps.visit(SEED_RESOURCE_ENCODED);
90
+ cy.wait('@graphRequest');
91
+
92
+ // Then I expect an error toast about the graph data.
93
+ ToasterSteps.getToasterMessage().should('contain', 'Failed to load graph data.');
94
+ });
95
+
96
+ it('should seed the canvas with the graph computed from a CONSTRUCT query', () => {
97
+ // Given I open the Graph Navigator view with a CONSTRUCT query, as sent from the SPARQL editor.
98
+ GraphNavigatorSteps.visitWithQuery(CONSTRUCT_QUERY);
99
+
100
+ // Then I expect the computed graph to be seeded on the canvas: the subject and its related resource.
101
+ GraphNavigatorSteps.getElements().should('have.length', 2);
102
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
103
+ GraphNavigatorSteps.getElement(CONSTRUCT_TARGET_LABEL).should('exist');
104
+ });
105
+
106
+ it('should unmount and mount the diagram component without errors', () => {
107
+ // Given I have opened the Graph Navigator view, so its diagram component is already loaded.
108
+ GraphNavigatorSteps.visit();
109
+ GraphNavigatorSteps.getWorkspace().should('exist');
110
+ // And I have navigated to the SPARQL editor and executed a CONSTRUCT query.
111
+ MainMenuSteps.clickOnSparqlMenu();
112
+ YasqeSteps.getEditor().should('be.visible');
113
+ YasqeSteps.pasteQuery(CONSTRUCT_QUERY);
114
+ YasqeSteps.executeQuery();
115
+
116
+ // When I click on the "Graph Navigator" button.
117
+ YasrSteps.visualizeInGraphNavigator();
118
+
119
+ // Then I expect to be navigated to the Graph Navigator view, so it renders a second time
120
+ GraphNavigatorSteps.getComponent().should('exist');
121
+ // And I expect the computed graph to be seeded on the canvas: the subject and its related resource.
122
+ GraphNavigatorSteps.getElements().should('have.length', 2);
123
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
124
+ GraphNavigatorSteps.getElement(CONSTRUCT_TARGET_LABEL).should('exist');
125
+ });
126
+
127
+ it('should keep the displayed resources when the language is switched', () => {
128
+ // Given the Graph Navigator view is opened with a start resource that gets seeded on the canvas.
129
+ GraphNavigatorSteps.visit(SEED_RESOURCE_ENCODED);
130
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
131
+ GraphNavigatorSteps.getElements().should('have.length', 1);
132
+
133
+ // When I switch the language.
134
+ LanguageSelectorSteps.switchToFr();
135
+
136
+ // Then I expect the same resources to remain visible because the layout is carried across the remount.
137
+ GraphNavigatorSteps.getElements().should('have.length', 1);
138
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
139
+ });
140
+
141
+ it('should keep the diagram on refresh and when navigating away and back', () => {
142
+ // Given the Graph Navigator view is opened with a start resource that gets seeded on the canvas.
143
+ GraphNavigatorSteps.visit(SEED_RESOURCE_ENCODED);
144
+ GraphNavigatorSteps.getElements().should('have.length', 1);
145
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
146
+
147
+ // When I refresh the page.
148
+ cy.reload();
149
+
150
+ // Then I expect the diagram state to be preserved across the refresh.
151
+ GraphNavigatorSteps.getElements().should('have.length', 1);
152
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
153
+
154
+ // When I navigate to another view via the navigation bar.
155
+ MainMenuSteps.clickOnSparqlMenu();
156
+ GraphNavigatorSteps.getComponent().should('not.exist');
157
+
158
+ // Wait for the SPARQL Query & Update view to be loaded before continuing.
159
+ // Without this wait, Cypress may try to click the Graph Navigator menu item before the page is fully loaded,
160
+ // causing the test to fail intermittently with the error:
161
+ // "This element `<li.sub-menu-item>` is not visible because it has CSS property: `display: none`"
162
+ // when trying to click the Graph Navigator submenu.
163
+ YasqeSteps.getEditor().should('be.visible');
164
+ // And I return to the Graph Navigator view via the navigation bar.
165
+ MainMenuSteps.clickOnGraphNavigator();
166
+
167
+ // Then I expect the diagram to be restored, because it is persisted for the repository it was drawn in.
168
+ GraphNavigatorSteps.getWorkspace().should('exist');
169
+ GraphNavigatorSteps.getElements().should('have.length', 1);
170
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
171
+
172
+ // When I refresh the page, which now has no start resource to seed the canvas with.
173
+ cy.reload();
174
+
175
+ // Then I expect the diagram to be restored from the persisted state.
176
+ GraphNavigatorSteps.getWorkspace().should('exist');
177
+ GraphNavigatorSteps.getElements().should('have.length', 1);
178
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
179
+ });
180
+
181
+ describe('Settings', () => {
182
+ it('should open the settings sidebar', () => {
183
+ // Given I open the Graph Navigator view.
184
+ GraphNavigatorSteps.visit();
185
+
186
+ // When I click the Settings button.
187
+ GraphNavigatorSteps.openSettings();
188
+
189
+ // Then I expect the settings sidebar to be open.
190
+ GraphNavigatorSteps.getSettingsSidebar().should('be.visible');
191
+ GraphNavigatorSteps.getBrowseButton().should('contain', 'Browse');
192
+ });
193
+
194
+ it('should keep the settings sidebar open when clicking on the page', () => {
195
+ // Given I have opened the settings.
196
+ GraphNavigatorSteps.visit();
197
+ GraphNavigatorSteps.openSettings();
198
+
199
+ // When I click on the canvas.
200
+ GraphNavigatorSteps.clickOnCanvas();
201
+
202
+ // Then I expect the sidebar to stay open.
203
+ GraphNavigatorSteps.getSettingsSidebar().should('be.visible');
204
+ });
205
+
206
+ it('should disable reset when the default settings are in use', () => {
207
+ // Given I open the settings of a repository without uploaded settings.
208
+ GraphNavigatorSteps.visit();
209
+ GraphNavigatorSteps.openSettings();
210
+
211
+ // Then I expect the reset action to be disabled, because there is nothing to reset to.
212
+ GraphNavigatorSteps.getSettingsSidebar().should('be.visible');
213
+ GraphNavigatorSteps.getResetButton().should('be.disabled');
214
+ });
215
+
216
+ it('should cancel a selected file', () => {
217
+ // Given I have selected a settings file.
218
+ GraphNavigatorSteps.visit();
219
+ GraphNavigatorSteps.openSettings();
220
+ GraphNavigatorSteps.selectSettingsFile(SETTINGS_FILE);
221
+ GraphNavigatorSteps.getSelectedSettingsFile(SETTINGS_FILE_NAME).should('exist');
222
+
223
+ // When I cancel it.
224
+ GraphNavigatorSteps.clickCancelFile();
225
+
226
+ // Then I expect the file to be removed.
227
+ GraphNavigatorSteps.getSettingsSidebar().should('not.contain', SETTINGS_FILE_NAME);
228
+ GraphNavigatorSteps.getUploadButton().should('be.disabled');
229
+ });
230
+
231
+ it('should ask for confirmation before uploading', () => {
232
+ // Given I have selected a settings file.
233
+ GraphNavigatorSteps.visit();
234
+ GraphNavigatorSteps.openSettings();
235
+ GraphNavigatorSteps.selectSettingsFile(SETTINGS_FILE);
236
+
237
+ // When I upload it.
238
+ GraphNavigatorSteps.clickUpload();
239
+
240
+ // Then I expect a confirmation that warns the diagram may behave unexpectedly.
241
+ GraphNavigatorSteps.getConfirmDialog().should('be.visible')
242
+ .and('contain', 'The diagram might behave unexpectedly with the new settings.');
243
+
244
+ // When I cancel.
245
+ GraphNavigatorSteps.cancelDialog();
246
+
247
+ // Then I expect the sidebar to stay open with the file still selected.
248
+ GraphNavigatorSteps.getSettingsSidebar().should('be.visible');
249
+ GraphNavigatorSteps.getSelectedSettingsFile(SETTINGS_FILE_NAME).should('exist');
250
+
251
+ // When I upload and confirm.
252
+ GraphNavigatorSteps.clickUpload();
253
+ GraphNavigatorSteps.confirmDialog();
254
+
255
+ // Then I expect a success message and the diagram to be rendered.
256
+ ToasterSteps.verifySuccess('The settings were uploaded');
257
+ GraphNavigatorSteps.getWorkspace().should('exist');
258
+ });
259
+
260
+ it('should show the validation errors of a rejected file', () => {
261
+ // Given I have selected a settings file with invalid values and an unknown property.
262
+ GraphNavigatorSteps.visit();
263
+ GraphNavigatorSteps.openSettings();
264
+ GraphNavigatorSteps.selectSettingsFile(INVALID_SETTINGS_FILE);
265
+
266
+ // When I upload it.
267
+ GraphNavigatorSteps.clickUpload();
268
+ GraphNavigatorSteps.confirmDialog();
269
+
270
+ // Then I expect the errors under the file.
271
+ ToasterSteps.verifyNewToasterError('Could not upload the settings');
272
+ GraphNavigatorSteps.getSelectedSettingsFile(INVALID_SETTINGS_FILE_NAME).should('exist');
273
+ GraphNavigatorSteps.getUploadErrors().should('be.visible')
274
+ .and('contain', '3 validation errors')
275
+ .and('contain', 'Fix the errors and upload again.');
276
+ GraphNavigatorSteps.getUploadError('gn:acceptBlankNodes').should('contain', 'Must be of type boolean');
277
+ GraphNavigatorSteps.getUploadError('gn:openWorldProperties').should('contain', 'Must be of type boolean');
278
+ GraphNavigatorSteps.getUploadError('gn:unknownSetting')
279
+ .should('contain', 'Not a known property');
280
+
281
+ // When I close and reopen the settings.
282
+ GraphNavigatorSteps.closeSettings();
283
+ GraphNavigatorSteps.openSettings();
284
+
285
+ // Then I expect the file and its errors to be kept.
286
+ GraphNavigatorSteps.getSelectedSettingsFile(INVALID_SETTINGS_FILE_NAME).should('exist');
287
+ GraphNavigatorSteps.getUploadErrors().should('be.visible')
288
+ .and('contain', '3 validation errors');
289
+
290
+ // When I remove the file.
291
+ GraphNavigatorSteps.clickCancelFile();
292
+
293
+ // Then I expect the errors to be cleared.
294
+ GraphNavigatorSteps.getUploadErrors().should('not.exist');
295
+ });
296
+
297
+ it('should ask for confirmation before resetting', () => {
298
+ // Given the repository has uploaded settings.
299
+ GraphNavigatorSteps.visit();
300
+ GraphNavigatorSteps.openSettings();
301
+ GraphNavigatorSteps.selectSettingsFile(SETTINGS_FILE);
302
+ GraphNavigatorSteps.clickUpload();
303
+ GraphNavigatorSteps.confirmDialog();
304
+ ToasterSteps.verifySuccess('The settings were uploaded');
305
+ // Wait for the toast to go, so it does not detach while the reset toast is verified.
306
+ ToasterSteps.getToast().should('not.exist');
307
+
308
+ // When I close the settings.
309
+ GraphNavigatorSteps.closeSettings();
310
+
311
+ // Then I expect the sidebar to close.
312
+ GraphNavigatorSteps.getSettingsSidebar().should('not.exist');
313
+
314
+ // When I reset them.
315
+ GraphNavigatorSteps.openSettings();
316
+ GraphNavigatorSteps.getResetButton().should('be.enabled');
317
+ GraphNavigatorSteps.clickReset();
318
+
319
+ // Then I expect a confirmation that warns the diagram may behave unexpectedly.
320
+ GraphNavigatorSteps.getConfirmDialog().should('be.visible')
321
+ .and('contain', 'The diagram might behave unexpectedly with the default settings.');
322
+
323
+ // When I confirm.
324
+ GraphNavigatorSteps.confirmDialog();
325
+
326
+ // Then I expect a success message and the diagram to be rendered.
327
+ ToasterSteps.verifySuccess('The settings were reset to the defaults');
328
+ GraphNavigatorSteps.getWorkspace().should('exist');
329
+ });
330
+
331
+ it('should export the current settings as a .ttl file', () => {
332
+ // Given I open the settings.
333
+ GraphNavigatorSteps.visit();
334
+ GraphNavigatorSteps.openSettings();
335
+
336
+ // When I export them.
337
+ GraphNavigatorSteps.clickExport();
338
+
339
+ // Then I expect a .ttl file named after the repository to be downloaded.
340
+ GraphNavigatorSteps.verifyFileDownloaded(`graph-navigator-settings-${repositoryId}.ttl`);
341
+ });
342
+ });
343
+
344
+ describe('Autocomplete warning', () => {
345
+ beforeEach(() => {
346
+ GraphNavigatorStubs.stubSettingsWithAutocomplete();
347
+ });
348
+
349
+ it('should warn once that autocomplete is off', () => {
350
+ // Given the settings use autocomplete, but autocomplete is off.
351
+ GraphNavigatorStubs.spyEntityLookup(SEED_RESOURCE_LABEL);
352
+ GraphNavigatorSteps.visit();
353
+ cy.wait('@graph-navigator-settings');
354
+
355
+ // When I search for entities.
356
+ GraphNavigatorSteps.searchEntities(SEED_RESOURCE_LABEL);
357
+ cy.wait('@entity-lookup');
358
+
359
+ // Then I expect a warning that autocomplete is off.
360
+ ToasterSteps.getWarningToast().should('be.visible').and('contain', 'Autocomplete is OFF');
361
+
362
+ // When the warning is gone and I search for entities again.
363
+ ToasterSteps.getToast().should('not.exist');
364
+ GraphNavigatorSteps.searchEntities(SEED_RESOURCE_LABEL);
365
+ cy.wait('@entity-lookup');
366
+
367
+ // Then I expect no new warning.
368
+ ToasterSteps.getToast().should('not.exist');
369
+ });
370
+
371
+ it('should redirect to the autocomplete view when the warning is clicked', () => {
372
+ // Given the settings use autocomplete, but autocomplete is off.
373
+ GraphNavigatorSteps.visit();
374
+ cy.wait('@graph-navigator-settings');
375
+
376
+ // When I search for entities and click the warning.
377
+ GraphNavigatorSteps.searchEntities(SEED_RESOURCE_LABEL);
378
+ ToasterSteps.getWarningToast().should('be.visible').and('contain', 'Autocomplete is OFF');
379
+ ToasterSteps.getWarningToast().click();
380
+
381
+ // Then I expect to be redirected to the autocomplete view.
382
+ cy.url().should('include', '/autocomplete');
383
+ });
384
+ });
385
+
386
+ describe('Repository switch', () => {
387
+ let secondRepositoryId;
388
+
389
+ beforeEach(() => {
390
+ secondRepositoryId = 'repository-second-' + Date.now();
391
+ cy.createRepository({id: secondRepositoryId});
392
+ });
393
+
394
+ afterEach(() => {
395
+ cy.deleteRepository(secondRepositoryId);
396
+ });
397
+
398
+ it('should clear the canvas when the repository is switched', () => {
399
+ // Given the Graph Navigator view is opened with a start resource that gets seeded on the canvas.
400
+ GraphNavigatorSteps.visit(SEED_RESOURCE_ENCODED);
401
+ GraphNavigatorSteps.getElements().should('have.length', 1);
402
+
403
+ // When I switch to another repository.
404
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
405
+
406
+ // Then I expect a confirmation that warns the diagram will be cleared, and that it can be exported first.
407
+ GraphNavigatorSteps.getConfirmDialog().should('be.visible')
408
+ .and('contain', 'The diagram will be cleared.')
409
+ .and('contain', 'Export to JSON');
410
+
411
+ // When I cancel.
412
+ GraphNavigatorSteps.cancelDialog();
413
+
414
+ // Then I expect the repository, the canvas and the start resource in the URL to be kept.
415
+ GraphNavigatorSteps.getElements().should('have.length', 1);
416
+ GraphNavigatorSteps.verifyStartResourceUri(decodeURIComponent(SEED_RESOURCE_ENCODED));
417
+
418
+ // When I switch to another repository and confirm.
419
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
420
+ GraphNavigatorSteps.confirmDialog();
421
+
422
+ // Then I expect the workspace to still be mounted, but the canvas to be cleared.
423
+ GraphNavigatorSteps.getWorkspace().should('exist');
424
+ GraphNavigatorSteps.getElements().should('not.exist');
425
+
426
+ // And I expect the URL to hold only the new repository.
427
+ GraphNavigatorSteps.verifyOnlyRepositoryParam(secondRepositoryId);
428
+
429
+ // When I refresh the page.
430
+ cy.reload();
431
+
432
+ // Then I expect the canvas to stay empty, because the start resource is no longer in the URL.
433
+ GraphNavigatorSteps.getWorkspace().should('exist');
434
+ GraphNavigatorSteps.getElements().should('not.exist');
435
+ GraphNavigatorSteps.verifyOnlyRepositoryParam(secondRepositoryId);
436
+ });
437
+
438
+ it('should ask what to do with the diagram when the repository is switched on another view', () => {
439
+ // Given the Graph Navigator view is opened with a start resource that gets seeded on the canvas.
440
+ GraphNavigatorSteps.visit(SEED_RESOURCE_ENCODED);
441
+ GraphNavigatorSteps.getElements().should('have.length', 1);
442
+
443
+ // When I switch to another repository on another view and return to the Graph Navigator view.
444
+ switchRepositoryOnAnotherViewAndReturn(secondRepositoryId);
445
+
446
+ // Then I expect to be asked about the diagram, which was drawn in the first repository.
447
+ GraphNavigatorSteps.getConfirmDialog().should('be.visible')
448
+ .and('contain', 'Diagram of another repository')
449
+ .and('contain', repositoryId);
450
+ // And I expect the diagram not to be shown until I answer.
451
+ GraphNavigatorSteps.getComponent().should('not.exist');
452
+
453
+ // When I close the dialog with Escape.
454
+ GraphNavigatorSteps.typeEscapeKey();
455
+
456
+ // Then I expect the diagram to be kept and shown with the data of the selected repository.
457
+ GraphNavigatorSteps.getWorkspace().should('exist');
458
+ GraphNavigatorSteps.getElements().should('have.length', 1);
459
+
460
+ // When I switch back to the first repository on another view and return.
461
+ switchRepositoryOnAnotherViewAndReturn(repositoryId);
462
+
463
+ // Then I expect to be asked again, because the kept diagram now belongs to the second repository.
464
+ GraphNavigatorSteps.getConfirmDialog().should('be.visible').and('contain', secondRepositoryId);
465
+
466
+ // When I keep the diagram.
467
+ GraphNavigatorSteps.keepDiagramOfAnotherRepository();
468
+
469
+ // Then I expect it to be shown with the data of the selected repository.
470
+ GraphNavigatorSteps.getWorkspace().should('exist');
471
+ GraphNavigatorSteps.getElements().should('have.length', 1);
472
+
473
+ // When I switch to the second repository on another view and return.
474
+ switchRepositoryOnAnotherViewAndReturn(secondRepositoryId);
475
+
476
+ // Then I expect to be asked again, because the kept diagram now belongs to the first repository.
477
+ GraphNavigatorSteps.getConfirmDialog().should('be.visible').and('contain', repositoryId);
478
+
479
+ // When I discard the diagram.
480
+ GraphNavigatorSteps.discardDiagramOfAnotherRepository();
481
+
482
+ // Then I expect the canvas to be empty.
483
+ GraphNavigatorSteps.getWorkspace().should('exist');
484
+ GraphNavigatorSteps.getElements().should('not.exist');
485
+ });
486
+
487
+ it('should warn that autocomplete is off once per repository selection', () => {
488
+ // Given the settings use autocomplete, but autocomplete is off.
489
+ GraphNavigatorStubs.stubSettingsWithAutocomplete();
490
+ GraphNavigatorSteps.visit();
491
+ cy.wait('@graph-navigator-settings');
492
+
493
+ // When I search for entities.
494
+ GraphNavigatorSteps.searchEntities(SEED_RESOURCE_LABEL);
495
+
496
+ // Then I expect a warning that autocomplete is off.
497
+ ToasterSteps.getWarningToast().should('be.visible').and('contain', 'Autocomplete is OFF');
498
+
499
+ // When the warning is gone and I switch to another repository and search for entities.
500
+ ToasterSteps.getToast().should('not.exist');
501
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
502
+ GraphNavigatorSteps.confirmDialog();
503
+ cy.wait('@graph-navigator-settings');
504
+ GraphNavigatorSteps.searchEntities(SEED_RESOURCE_LABEL);
505
+
506
+ // Then I expect a new warning, for the new repository.
507
+ ToasterSteps.getWarningToast().should('be.visible').and('contain', 'Autocomplete is OFF');
508
+
509
+ // When the warning is gone and I switch back to the first repository and search for entities.
510
+ ToasterSteps.getToast().should('not.exist');
511
+ RepositorySelectorSteps.selectRepository(repositoryId);
512
+ GraphNavigatorSteps.confirmDialog();
513
+ cy.wait('@graph-navigator-settings');
514
+ GraphNavigatorSteps.searchEntities(SEED_RESOURCE_LABEL);
515
+
516
+ // Then I expect a new warning, because the repository was selected again.
517
+ ToasterSteps.getWarningToast().should('be.visible').and('contain', 'Autocomplete is OFF');
518
+ });
519
+ });
520
+ });
@@ -33,7 +33,7 @@ describe('Confirm duplicate RDF file', () => {
33
33
  GuideDialogSteps.assertDialogWithTitleIsVisible('Import file');
34
34
  GuideDialogSteps.assertDialogWithContentIsVisible('Click on the Import button.');
35
35
  ImportSettingsDialogSteps.import();
36
- ImportUserDataSteps.checkImportedResource(0, GUIDE_RESOURCE_FILE);
36
+ ImportUserDataSteps.checkImportedResourceByIndex(0, GUIDE_RESOURCE_FILE);
37
37
 
38
38
  // WHEN: I run a guide that includes the Import RDF File step.
39
39
  GuideDialogSteps.assertDialogWithTitleIsVisible('Import file — 1/6');
@@ -106,17 +106,13 @@ describe('Main Menu Guide steps', () => {
106
106
  BaseSteps.validateUrl('/sparql');
107
107
 
108
108
  // TTYG
109
- GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 1/3');
110
- GuideDialogSteps.assertDialogWithContentIsVisible('The following steps show how to use the Talk to Your Graph view to create an agen');
109
+ GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 1/2');
110
+ GuideDialogSteps.assertDialogWithContentIsVisible('The following steps show how to use the Talk to Your Graph view to create an agent.');
111
111
  GuideDialogSteps.clickOnNextButton();
112
112
 
113
- GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 2/3');
114
- GuideDialogSteps.assertDialogWithContentIsVisible('Click on the Lab menu.');
115
- MainMenuSteps.clickOnMenuLab();
116
-
117
- GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 3/3');
113
+ GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 2/2');
118
114
  GuideDialogSteps.assertDialogWithContentIsVisible('Click on the Talk to Your Graph menu.');
119
- MainMenuSteps.clickOnTTYGSubmenu();
115
+ MainMenuSteps.clickOnMenuTTYG();
120
116
  BaseSteps.validateUrl('/ttyg');
121
117
 
122
118
  // Autocomplete
@@ -249,15 +245,11 @@ describe('Main Menu Guide steps', () => {
249
245
  BaseSteps.validateUrl('/sparql');
250
246
 
251
247
  // TTYG
252
- GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 1/3');
248
+ GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 1/2');
253
249
  GuideDialogSteps.assertDialogWithContentIsVisible('The following steps show how to use the Talk to Your Graph view to create an agen');
254
250
  GuideDialogSteps.clickOnNextButton();
255
251
 
256
- GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 2/3');
257
- GuideDialogSteps.assertDialogWithContentIsVisible('Click on the Lab menu.');
258
- GuideDialogSteps.clickOnNextButton();
259
-
260
- GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 3/3');
252
+ GuideDialogSteps.assertDialogWithTitleIsVisible('Create an agent — 2/2');
261
253
  GuideDialogSteps.assertDialogWithContentIsVisible('Click on the Talk to Your Graph menu.');
262
254
  GuideDialogSteps.clickOnNextButton();
263
255
  BaseSteps.validateUrl('/ttyg');