graphdb-workbench-tests 3.5.2 → 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
@@ -2,6 +2,7 @@ import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dial
2
2
  import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
3
3
  import {FileOverwriteDialogSteps} from "../../steps/import/file-overwrite-dialog-steps";
4
4
  import {HeaderSteps} from '../../steps/header-steps.js';
5
+ import {ModalDialogSteps} from '../../steps/modal-dialog-steps.js';
5
6
 
6
7
  const bnodes = `_:node0 <http://purl.org/dc/elements/1.1/title> "A new book" ;
7
8
  \t<http://purl.org/dc/elements/1.1/creator> "A.N.Other" .`;
@@ -14,12 +15,15 @@ const jsonld = JSON.stringify({
14
15
  "ab:email": "richard491@hotmail.com"
15
16
  });
16
17
 
18
+ const htmlFileName = '<img src="x" class="injected-html">bnodes.ttl';
19
+
17
20
  describe('Import user data: File upload', () => {
18
21
  let repositoryId;
19
22
  const testFiles = [
20
23
  'bnodes.ttl',
21
24
  'jsonld.jsonld',
22
- 'invalid-format.json'
25
+ 'invalid-format.json',
26
+ htmlFileName
23
27
  ];
24
28
 
25
29
  beforeEach(() => {
@@ -46,7 +50,7 @@ describe('Import user data: File upload', () => {
46
50
  ImportSettingsDialogSteps.getDialog().should('not.exist');
47
51
  // Then I should see the uploaded file
48
52
  ImportUserDataSteps.getResources().should('have.length', 1);
49
- ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
53
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
50
54
  // When I try to import the same file again
51
55
  ImportUserDataSteps.importFile(0);
52
56
  // Then I should not see the upload only option
@@ -56,7 +60,7 @@ describe('Import user data: File upload', () => {
56
60
  ImportSettingsDialogSteps.import();
57
61
  ImportSettingsDialogSteps.getDialog().should('not.exist');
58
62
  ImportUserDataSteps.getResources().should('have.length', 1);
59
- ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
63
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
60
64
  });
61
65
 
62
66
  it('Should be able to cancel the file upload', () => {
@@ -106,15 +110,15 @@ describe('Import user data: File upload', () => {
106
110
  ImportSettingsDialogSteps.getDialog().should('be.visible');
107
111
  ImportSettingsDialogSteps.import();
108
112
  // Then I should see the uploaded file
109
- ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
113
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
110
114
  // When I upload another file
111
115
  const file2 = ImportUserDataSteps.createFile(testFiles[1], jsonld);
112
116
  ImportUserDataSteps.selectFile(file2);
113
117
  ImportSettingsDialogSteps.getDialog().should('be.visible');
114
118
  ImportSettingsDialogSteps.import();
115
119
  // Then I should see the uploaded file - it becomes first in the list
116
- ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
117
- ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
120
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'jsonld.jsonld');
121
+ ImportUserDataSteps.checkImportedResourceByIndex(1, 'bnodes.ttl');
118
122
  // When I override the first file
119
123
  const file3 = ImportUserDataSteps.createFile(testFiles[0], bnodes);
120
124
  ImportUserDataSteps.selectFile(file3);
@@ -122,17 +126,16 @@ describe('Import user data: File upload', () => {
122
126
  ImportSettingsDialogSteps.getDialog().should('be.visible');
123
127
  ImportSettingsDialogSteps.import();
124
128
  // Then I should see the uploaded file - it becomes first in the list
125
- // TODO: timestamps currently seems to not be changed on reimport
126
- ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
127
- ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
129
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
130
+ ImportUserDataSteps.checkImportedResourceByIndex(1, 'jsonld.jsonld');
128
131
  // When I override the second file
129
132
  ImportUserDataSteps.selectFile(file2);
130
133
  FileOverwriteDialogSteps.overwrite();
131
134
  ImportSettingsDialogSteps.getDialog().should('be.visible');
132
135
  ImportSettingsDialogSteps.import();
133
136
  // Then I should see the uploaded file - it becomes first in the list
134
- ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
135
- ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
137
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'jsonld.jsonld');
138
+ ImportUserDataSteps.checkImportedResourceByIndex(1, 'bnodes.ttl');
136
139
  });
137
140
 
138
141
  it('should be able to only upload a single file without importing it', () => {
@@ -153,6 +156,32 @@ describe('Import user data: File upload', () => {
153
156
  ImportUserDataSteps.getResources().should('have.length', 1);
154
157
  });
155
158
 
159
+ it('Should give the controls on the page accessible names', () => {
160
+ // Given I have uploaded a file without importing it
161
+ const file = ImportUserDataSteps.createFile(testFiles[0], bnodes);
162
+ ImportUserDataSteps.selectFile(file);
163
+ ImportSettingsDialogSteps.uploadOnly();
164
+ ImportUserDataSteps.getResources().should('have.length', 1);
165
+ // Then the icon-only buttons and the row checkbox should have accessible names
166
+ ImportUserDataSteps.getHelpToggleButton().should('have.attr', 'aria-label', 'Get help on import');
167
+ ImportUserDataSteps.getStatusSelectMenuToggle().should('have.attr', 'aria-label', 'Select resources by status');
168
+ ImportUserDataSteps.getResourceSelectCheckbox('bnodes.ttl').should('have.attr', 'aria-label', 'Select bnodes.ttl');
169
+ ImportUserDataSteps.getResourceImportButton('bnodes.ttl').should('have.attr', 'aria-label', 'Import bnodes.ttl');
170
+ ImportUserDataSteps.getResourceRemoveButton('bnodes.ttl').should('have.attr', 'aria-label', 'Remove bnodes.ttl');
171
+ // And no empty context link should be rendered
172
+ ImportUserDataSteps.getResourceContextLink('bnodes.ttl').should('not.exist');
173
+ // And the filter field should have a screen reader label
174
+ ImportUserDataSteps.getFilterFieldLabel()
175
+ .should('have.class', 'sr-only')
176
+ .and('contain.text', 'Filter by name');
177
+ // When I import the file
178
+ ImportUserDataSteps.importFile(0);
179
+ ImportSettingsDialogSteps.import();
180
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
181
+ // Then the reset status button should have an accessible name
182
+ ImportUserDataSteps.getResourceResetButton('bnodes.ttl').should('have.attr', 'aria-label', 'Reset status of bnodes.ttl');
183
+ });
184
+
156
185
  it('Should be able to upload multiple unique files', () => {
157
186
  // Given there are no files uploaded yet
158
187
  ImportUserDataSteps.getResourcesTable().should('be.hidden');
@@ -165,8 +194,8 @@ describe('Import user data: File upload', () => {
165
194
  ImportSettingsDialogSteps.import();
166
195
  // Then I should see the uploaded file
167
196
  ImportUserDataSteps.getResources().should('have.length', 2);
168
- ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
169
- ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
197
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'jsonld.jsonld');
198
+ ImportUserDataSteps.checkImportedResourceByIndex(1, 'bnodes.ttl');
170
199
  // And the files should really be there
171
200
  HeaderSteps.openHomePage();
172
201
  ImportUserDataSteps.visit();
@@ -182,7 +211,7 @@ describe('Import user data: File upload', () => {
182
211
  ImportSettingsDialogSteps.getDialog().should('be.visible');
183
212
  ImportSettingsDialogSteps.import();
184
213
  ImportUserDataSteps.getResources().should('have.length', 1);
185
- ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
214
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
186
215
  // When I upload a file with the same name
187
216
  ImportUserDataSteps.selectFile(file1);
188
217
  // Then I should see a file override confirmation dialog
@@ -193,7 +222,38 @@ describe('Import user data: File upload', () => {
193
222
  ImportSettingsDialogSteps.import();
194
223
  // Then The file should be overridden
195
224
  ImportUserDataSteps.getResources().should('have.length', 1);
196
- ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
225
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
226
+ });
227
+
228
+ it('should show HTML in the duplicated file name as text in the file override confirmation dialog', () => {
229
+ // Given I have uploaded a file which name contains HTML
230
+ const file = ImportUserDataSteps.createFile(htmlFileName, bnodes);
231
+ ImportUserDataSteps.selectFile(file);
232
+ ImportSettingsDialogSteps.getDialog().should('be.visible');
233
+ ImportSettingsDialogSteps.import();
234
+ ImportUserDataSteps.getResources().should('have.length', 1);
235
+ // When I upload a file with the same name
236
+ ImportUserDataSteps.selectFile(file);
237
+ // Then I expect the file name to be displayed as text in the file override confirmation dialog
238
+ FileOverwriteDialogSteps.getDialog().should('be.visible');
239
+ FileOverwriteDialogSteps.getDialogBody().should('contain.text', htmlFileName);
240
+ FileOverwriteDialogSteps.getDialogBody().invoke('html').should('not.contain', '<img');
241
+ FileOverwriteDialogSteps.cancel();
242
+ });
243
+
244
+ it('should show HTML in the file name as text in the remove file dialog', () => {
245
+ // Given I have uploaded a file which name contains HTML
246
+ const file = ImportUserDataSteps.createFile(htmlFileName, bnodes);
247
+ ImportUserDataSteps.selectFile(file);
248
+ ImportSettingsDialogSteps.getDialog().should('be.visible');
249
+ ImportSettingsDialogSteps.import();
250
+ ImportUserDataSteps.getResources().should('have.length', 1);
251
+ // When I remove the file
252
+ ImportUserDataSteps.deleteUploadedFile(0);
253
+ // Then I expect the file name to be displayed as text in the remove file dialog
254
+ ModalDialogSteps.getDialogBody().should('contain.text', htmlFileName);
255
+ ModalDialogSteps.getDialogBody().invoke('html').should('not.contain', '<img');
256
+ ModalDialogSteps.clickOnCancelButton();
197
257
  });
198
258
 
199
259
  it('Should be able to upload file with same name and preserve the existing file', () => {
@@ -205,7 +265,7 @@ describe('Import user data: File upload', () => {
205
265
  ImportSettingsDialogSteps.getDialog().should('be.visible');
206
266
  ImportSettingsDialogSteps.import();
207
267
  ImportUserDataSteps.getResources().should('have.length', 1);
208
- ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
268
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
209
269
  // When I upload a file with the same name
210
270
  ImportUserDataSteps.selectFile(file1);
211
271
  // Then I should see a file override confirmation dialog
@@ -215,8 +275,8 @@ describe('Import user data: File upload', () => {
215
275
  ImportSettingsDialogSteps.import();
216
276
  // Then The file should not be overridden but prefixed instead
217
277
  ImportUserDataSteps.getResources().should('have.length', 2);
218
- ImportUserDataSteps.checkImportedResource(0, 'bnodes-0.ttl');
219
- ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
278
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes-0.ttl');
279
+ ImportUserDataSteps.checkImportedResourceByIndex(1, 'bnodes.ttl');
220
280
  // When I upload two files, one with the same name and second new one
221
281
  const file2 = ImportUserDataSteps.createFile(testFiles[1], jsonld);
222
282
  ImportUserDataSteps.selectFile([file1, file2]);
@@ -225,10 +285,10 @@ describe('Import user data: File upload', () => {
225
285
  ImportSettingsDialogSteps.import();
226
286
  // Then The file should not be overridden but prefixed with increased index instead
227
287
  ImportUserDataSteps.getResources().should('have.length', 4);
228
- ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
229
- ImportUserDataSteps.checkImportedResource(1, 'bnodes-1.ttl');
230
- ImportUserDataSteps.checkImportedResource(2, 'bnodes-0.ttl');
231
- ImportUserDataSteps.checkImportedResource(3, 'bnodes.ttl');
288
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'jsonld.jsonld');
289
+ ImportUserDataSteps.checkImportedResourceByIndex(1, 'bnodes-1.ttl');
290
+ ImportUserDataSteps.checkImportedResourceByIndex(2, 'bnodes-0.ttl');
291
+ ImportUserDataSteps.checkImportedResourceByIndex(3, 'bnodes.ttl');
232
292
  });
233
293
 
234
294
  it('should see error message when uploaded file has invalid format', () => {
@@ -242,6 +302,6 @@ describe('Import user data: File upload', () => {
242
302
  ImportSettingsDialogSteps.import();
243
303
  // Then I should see an error message
244
304
  ImportUserDataSteps.getResources().should('have.length', 1);
245
- ImportUserDataSteps.checkImportedResource(0, 'invalid-format.json', 'RDF Parse Error: Invalid file format');
305
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'invalid-format.json', 'RDF Parse Error: Invalid file format');
246
306
  });
247
307
  });
@@ -1,15 +1,14 @@
1
1
  import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
2
+ import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dialog-steps";
2
3
 
3
- const bnodes = `_:node0 <http://purl.org/dc/elements/1.1/title> "A new book" ;
4
- \t<http://purl.org/dc/elements/1.1/creator> "A.N.Other" .`;
5
- const jsonld = JSON.stringify({
6
- "@context": {
7
- "ab": "http://learningsparql.com/ns/addressbook#"
8
- },
9
- "@id": "ab:richard",
10
- "ab:homeTel": "(229)276-5135",
11
- "ab:email": "richard491@hotmail.com"
12
- });
4
+ const RDF_TEXT_SNIPPET = '<urn:s1> <urn:p1> <urn:o1>.';
5
+ const RDF_XML_WITH_DOCTYPE_SNIPPET = '<?xml version="1.0"?>\n' +
6
+ '<!DOCTYPE rdf:RDF [<!ENTITY ex "http://example.com/">]>\n' +
7
+ '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.com/">\n' +
8
+ ' <rdf:Description rdf:about="&ex;subject"><ex:predicate>object</ex:predicate></rdf:Description>\n' +
9
+ '</rdf:RDF>';
10
+ const RDF_XML_FORMAT = 'RDF/XML';
11
+ const TEXT_SNIPPET = 'Text snippet';
13
12
 
14
13
  describe('Import user data: Import settings dialog', () => {
15
14
 
@@ -31,6 +30,78 @@ describe('Import user data: Import settings dialog', () => {
31
30
  cy.deleteRepository(repositoryId);
32
31
  });
33
32
 
33
+ it('Should disallow DOCTYPE declarations by default', () => {
34
+ // Given I have opened the import settings dialog for a text snippet
35
+ ImportUserDataSteps.interceptTextSnippetImport(repositoryId);
36
+ ImportUserDataSteps.openTextSnippetImportSettings(RDF_TEXT_SNIPPET);
37
+ // When I expand the advanced settings
38
+ ImportSettingsDialogSteps.expandAdvancedSettings();
39
+ // Then the DOCTYPE declarations option should be checked
40
+ ImportSettingsDialogSteps.getDisallowDoctypeDeclCheckbox().should('be.checked');
41
+ // When I start the import
42
+ ImportSettingsDialogSteps.import();
43
+ // Then DOCTYPE declarations should be disallowed in the request
44
+ ImportUserDataSteps.waitForTextSnippetImportSettings()
45
+ .its('parserSettings.disallowDoctypeDecl').should('equal', true);
46
+ });
47
+
48
+ it('Should allow DOCTYPE declarations when the option is unchecked', () => {
49
+ // Given I have opened the import settings dialog for a text snippet
50
+ ImportUserDataSteps.interceptTextSnippetImport(repositoryId);
51
+ ImportUserDataSteps.openTextSnippetImportSettings(RDF_TEXT_SNIPPET);
52
+ ImportSettingsDialogSteps.expandAdvancedSettings();
53
+ // When I uncheck the DOCTYPE declarations option and start the import
54
+ ImportSettingsDialogSteps.allowDoctypeDeclarations();
55
+ ImportSettingsDialogSteps.import();
56
+ // Then DOCTYPE declarations should be allowed in the request
57
+ ImportUserDataSteps.waitForTextSnippetImportSettings()
58
+ .its('parserSettings.disallowDoctypeDecl').should('equal', false);
59
+ });
60
+
61
+ it('Should restore the DOCTYPE declarations option to its default', () => {
62
+ // Given I have opened the import settings dialog for a text snippet
63
+ ImportUserDataSteps.openTextSnippetImportSettings(RDF_TEXT_SNIPPET);
64
+ ImportSettingsDialogSteps.expandAdvancedSettings();
65
+ // And I have unchecked the DOCTYPE declarations option
66
+ ImportSettingsDialogSteps.allowDoctypeDeclarations();
67
+ ImportSettingsDialogSteps.getDisallowDoctypeDeclCheckbox().should('not.be.checked');
68
+ // When I restore the default settings
69
+ ImportSettingsDialogSteps.restoreDefaults();
70
+ // Then the DOCTYPE declarations option should be checked again
71
+ ImportSettingsDialogSteps.getDisallowDoctypeDeclCheckbox().should('be.checked');
72
+ });
73
+
74
+ it('Should reject RDF/XML with a DOCTYPE declaration by default', () => {
75
+ // Given I have opened the import settings dialog for an RDF/XML snippet with a DOCTYPE declaration
76
+ ImportUserDataSteps.openTextSnippetImportSettings(RDF_XML_WITH_DOCTYPE_SNIPPET, RDF_XML_FORMAT);
77
+ // When I start the import with the default settings
78
+ ImportSettingsDialogSteps.import();
79
+ // Then the import should fail, because DOCTYPE declarations are disallowed
80
+ ImportUserDataSteps.checkImportedResourceByIndex(0, TEXT_SNIPPET, 'DOCTYPE is disallowed');
81
+ });
82
+
83
+ it('Should import RDF/XML with a DOCTYPE declaration when DOCTYPE declarations are allowed', () => {
84
+ // Given I have opened the import settings dialog for an RDF/XML snippet with a DOCTYPE declaration
85
+ ImportUserDataSteps.openTextSnippetImportSettings(RDF_XML_WITH_DOCTYPE_SNIPPET, RDF_XML_FORMAT);
86
+ ImportSettingsDialogSteps.expandAdvancedSettings();
87
+ // When I allow DOCTYPE declarations and start the import
88
+ ImportSettingsDialogSteps.allowDoctypeDeclarations();
89
+ ImportSettingsDialogSteps.import();
90
+ // Then the import should succeed
91
+ ImportUserDataSteps.checkImportedResourceByIndex(0, TEXT_SNIPPET);
92
+
93
+ // When I open the import settings dialog for the same snippet again
94
+ ImportUserDataSteps.importFile(0);
95
+ ImportSettingsDialogSteps.expandAdvancedSettings();
96
+ // Then the saved DOCTYPE declarations option should be restored
97
+ ImportSettingsDialogSteps.getDisallowDoctypeDeclCheckbox().should('not.be.checked');
98
+
99
+ // When I restore the default settings
100
+ ImportSettingsDialogSteps.restoreDefaults();
101
+ // Then the DOCTYPE declarations option should be reset to the backend default, not to the saved value
102
+ ImportSettingsDialogSteps.getDisallowDoctypeDeclCheckbox().should('be.checked');
103
+ });
104
+
34
105
  it.skip('Should prevent import when there are missing or invalid settings', () => {
35
106
  // Given I have uploaded a file
36
107
 
@@ -21,25 +21,6 @@ describe('Import user data: Text snippet', () => {
21
21
  'ab:richard ab:email "richard49@hotmail.com".\n' +
22
22
  'ab:richard ab:email "richard491@hotmail.com".';
23
23
 
24
- const TURTLESTAR_SNIPPET = '@prefix ex:<http:/base.org/> .\n' +
25
- 'ex:foo ex:pred ex:obj .\n' +
26
- '<<ex:foo rdfs:label "label">> ex:author "guest" .\n' +
27
- 'ex:obj ex:quote <<ex:meta ex:data ex:foo>> .\n' +
28
- '<<<<ex:foo rdfs:label "label">> ex:data ex:foo>> ex:recursive true .';
29
-
30
- const TRIGSTAR_SNIPPET = '@prefix ex: <http://example.com/> .\n' +
31
- '@prefix dct: <http://purl.org/dc/terms/> .\n' +
32
- '@prefix foaf: <http://xmlns.com/foaf/0.1/> .\n' +
33
- '@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n' +
34
- 'graph ex:rdfstar {\n' +
35
- ' ex:bob foaf:knows << ex:alice foaf:knows<<ex:bob dct:created ex:book>> >> .\n' +
36
- ' <<<< ex:bob dct:created ex:book >> foaf:knows ex:alice >> dct:source ex:otherbook .\n' +
37
- ' ex:bobshomepage dct:source<< ex:book dct:creator ex:alice >> .\n' +
38
- ' << ex:book dct:creator ex:alice >> dct:source ex:bobshomepage .\n' +
39
- ' << ex:book dct:creator ex:alice >> dct:requires << ex:alice dct:created ex:book >> .\n' +
40
- ' <<<http://example.org/a>ex:b ex:c>>ex:valid "1999-08-16"^^xsd:date .\n' +
41
- '}';
42
-
43
24
  const JSONLD_TEXT_SNIPPET = '[\n' +
44
25
  ' {\n' +
45
26
  ' "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property",\n' +
@@ -55,8 +36,6 @@ describe('Import user data: Text snippet', () => {
55
36
  const CONTEXT = 'http://example.org/graph';
56
37
  const TEXT_SNIPPET = 'Text snippet';
57
38
  const JSONLD_FORMAT = 'JSON-LD';
58
- const VALID_SNIPPET_TURTLESTAR_FORMAT = 'Turtle*';
59
- const VALID_SNIPPET_TRIGSTAR_FORMAT = 'TriG*';
60
39
  const VALID_SNIPPET_RDF_FORMAT = 'Turtle';
61
40
  const RDF_ERROR_MESSAGE = 'RDF Parse Error:';
62
41
 
@@ -75,7 +54,7 @@ describe('Import user data: Text snippet', () => {
75
54
  ImportUserDataSteps.fillRDFTextSnippet(RDF_TEXT_SNIPPET_1);
76
55
  ImportUserDataSteps.clickImportTextSnippetButton();
77
56
  ImportSettingsDialogSteps.import();
78
- ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
57
+ ImportUserDataSteps.checkImportedResourceByIndex(0, TEXT_SNIPPET);
79
58
  });
80
59
 
81
60
  it('Should import RDF text snippet with invalid RDF format selected', () => {
@@ -84,7 +63,7 @@ describe('Import user data: Text snippet', () => {
84
63
  ImportUserDataSteps.selectRDFFormat(JSONLD_FORMAT);
85
64
  ImportUserDataSteps.clickImportTextSnippetButton();
86
65
  ImportSettingsDialogSteps.import();
87
- ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET, RDF_ERROR_MESSAGE);
66
+ ImportUserDataSteps.checkImportedResourceByIndex(0, TEXT_SNIPPET, RDF_ERROR_MESSAGE);
88
67
  });
89
68
 
90
69
  it('Should import RDF text snippet successfully with valid RDF format selected', () => {
@@ -93,25 +72,7 @@ describe('Import user data: Text snippet', () => {
93
72
  ImportUserDataSteps.selectRDFFormat(VALID_SNIPPET_RDF_FORMAT);
94
73
  ImportUserDataSteps.clickImportTextSnippetButton();
95
74
  ImportSettingsDialogSteps.import();
96
- ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
97
- });
98
-
99
- it('Should import Turtle* text snippet successfully with valid RDF star format selected', () => {
100
- ImportUserDataSteps.openImportTextSnippetDialog();
101
- ImportUserDataSteps.fillRDFTextSnippet(TURTLESTAR_SNIPPET);
102
- ImportUserDataSteps.selectRDFFormat(VALID_SNIPPET_TURTLESTAR_FORMAT);
103
- ImportUserDataSteps.clickImportTextSnippetButton();
104
- ImportSettingsDialogSteps.import();
105
- ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
106
- });
107
-
108
- it('Should import TriG* text snippet successfully with valid RDF star format selected', () => {
109
- ImportUserDataSteps.openImportTextSnippetDialog();
110
- ImportUserDataSteps.fillRDFTextSnippet(TRIGSTAR_SNIPPET);
111
- ImportUserDataSteps.selectRDFFormat(VALID_SNIPPET_TRIGSTAR_FORMAT);
112
- ImportUserDataSteps.clickImportTextSnippetButton();
113
- ImportSettingsDialogSteps.import();
114
- ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
75
+ ImportUserDataSteps.checkImportedResourceByIndex(0, TEXT_SNIPPET);
115
76
  });
116
77
 
117
78
  it('Should import RDF text snippet successfully with filled base URI and context', () => {
@@ -123,7 +84,7 @@ describe('Import user data: Text snippet', () => {
123
84
  ImportSettingsDialogSteps.selectNamedGraph();
124
85
  ImportSettingsDialogSteps.fillNamedGraph(CONTEXT);
125
86
  ImportSettingsDialogSteps.import();
126
- ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
87
+ ImportUserDataSteps.checkImportedResourceByIndex(0, TEXT_SNIPPET);
127
88
 
128
89
  // Go to Graphs overview
129
90
  cy.visit('/graphs');
@@ -211,7 +172,7 @@ describe('Import user data: Text snippet', () => {
211
172
  ImportSettingsDialogSteps.selectNamedGraph();
212
173
  ImportSettingsDialogSteps.fillNamedGraph(CONTEXT);
213
174
  ImportSettingsDialogSteps.import();
214
- ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
175
+ ImportUserDataSteps.checkImportedResourceByIndex(0, TEXT_SNIPPET);
215
176
 
216
177
  // Go to Graphs overview
217
178
  cy.visit('/graphs');
@@ -235,7 +196,7 @@ describe('Import user data: Text snippet', () => {
235
196
  ImportSettingsDialogSteps.fillContextLink('https://w3c.github.io/json-ld-api/tests/compact/0007-context.jsonld');
236
197
  // ImportUserDataSteps.importFromSettingsDialog();
237
198
  ImportSettingsDialogSteps.import();
238
- ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
199
+ ImportUserDataSteps.checkImportedResourceByIndex(0, TEXT_SNIPPET);
239
200
  const graphName = CONTEXT.slice(0, CONTEXT.lastIndexOf('.'));
240
201
  // Verify that created graph can be found
241
202
  ImportUserDataSteps.verifyGraphData(graphName, "rdf:Property", "rdf:Property", "rdf:Property", "http://example.org/graph", false);
@@ -9,7 +9,6 @@ describe('Import user data: URL import', () => {
9
9
  const JSONLD_FORMAT = 'JSON-LD';
10
10
  const VALID_URL_RDF_FORMAT = 'RDF/XML';
11
11
  const RDF_ERROR_MESSAGE = 'RDF Parse Error:';
12
- const IMPORT_JSONLD_URL = 'https://example.com/0007-context.jsonld';
13
12
 
14
13
  beforeEach(() => {
15
14
  repositoryId = 'user-import-' + Date.now();
@@ -57,9 +56,11 @@ describe('Import user data: URL import', () => {
57
56
  it('Test import file via URL successfully with Auto format selected', () => {
58
57
  ImportUserDataSteps.openImportURLDialog(IMPORT_URL);
59
58
  ImportUserDataSteps.clickImportUrlButton();
60
- // Without changing settings
59
+ // wine.rdf contains a DOCTYPE declaration, which is disallowed by default
60
+ ImportSettingsDialogSteps.expandAdvancedSettings();
61
+ ImportSettingsDialogSteps.allowDoctypeDeclarations();
61
62
  ImportSettingsDialogSteps.import();
62
- ImportUserDataSteps.checkImportedResource(0, IMPORT_URL);
63
+ ImportUserDataSteps.checkImportedResourceByIndex(0, IMPORT_URL);
63
64
  });
64
65
 
65
66
  it('Test import file via URL with invalid RDF format selected', () => {
@@ -67,14 +68,17 @@ describe('Import user data: URL import', () => {
67
68
  ImportUserDataSteps.selectRDFFormat(JSONLD_FORMAT);
68
69
  ImportUserDataSteps.clickImportUrlButton();
69
70
  ImportSettingsDialogSteps.import();
70
- ImportUserDataSteps.checkImportedResource(0, IMPORT_URL, RDF_ERROR_MESSAGE);
71
+ ImportUserDataSteps.checkImportedResourceByIndex(0, IMPORT_URL, RDF_ERROR_MESSAGE);
71
72
  });
72
73
 
73
74
  it('Test import file via URL successfully with valid RDF format selected', () => {
74
75
  ImportUserDataSteps.openImportURLDialog(IMPORT_URL);
75
76
  ImportUserDataSteps.selectRDFFormat(VALID_URL_RDF_FORMAT);
76
77
  ImportUserDataSteps.clickImportUrlButton();
78
+ // wine.rdf contains a DOCTYPE declaration, which is disallowed by default
79
+ ImportSettingsDialogSteps.expandAdvancedSettings();
80
+ ImportSettingsDialogSteps.allowDoctypeDeclarations();
77
81
  ImportSettingsDialogSteps.import();
78
- ImportUserDataSteps.checkImportedResource(0, IMPORT_URL);
82
+ ImportUserDataSteps.checkImportedResourceByIndex(0, IMPORT_URL);
79
83
  });
80
84
  });
@@ -49,22 +49,22 @@ describe('Import user data', () => {
49
49
  ImportUserDataSteps.getUploadTextSnippetButton().should('be.visible');
50
50
  });
51
51
 
52
- it('Should show the file size limit warning', () => {
52
+ it('Should show the file size limit info', () => {
53
53
  // Given I have visited the import page
54
54
  ImportUserDataSteps.visit();
55
55
  // When the page is loaded
56
- // Then I should see the file size limit warning
57
- ImportUserDataSteps.getFileSizeLimitWarning().should('be.visible');
58
- // When I click the server files tab through the link in the warning
59
- ImportUserDataSteps.openServerFilesTabFromWarning();
56
+ // Then I should see the file size limit info
57
+ ImportUserDataSteps.getFileSizeLimitInfo().should('be.visible');
58
+ // When I click the server files tab through the link in the info
59
+ ImportUserDataSteps.openServerFilesTabFromInfo();
60
60
  // Then I should see the server files tab
61
61
  ImportUserDataSteps.getActiveTab().should('have.text', 'Server files');
62
62
  cy.url().should('include', '/import').and('include', '#server');
63
63
  ImportUserDataSteps.getServerFilesTab().should('be.visible');
64
- // When I click on the API link in the warning
64
+ // When I click on the API link in the info
65
65
  ImportUserDataSteps.openUserDataTab();
66
66
  ImportUserDataSteps.getUserDataTab().should('be.visible');
67
- ImportUserDataSteps.openAPIViewFromWarning();
67
+ ImportUserDataSteps.openAPIViewFromInfo();
68
68
  // Then I should see the API view
69
69
  cy.url().should('include', '/webapi');
70
70
  });
@@ -80,7 +80,7 @@ describe('Import user data', () => {
80
80
  // Then the help should disappear
81
81
  ImportUserDataSteps.getHelpMessage().should('not.exist');
82
82
  // When I visit the import page again the help should appear again in the empty state
83
- ImportUserDataSteps.openAPIViewFromWarning();
83
+ ImportUserDataSteps.openAPIViewFromInfo();
84
84
  cy.url().should('include', '/webapi');
85
85
  ImportUserDataSteps.visit();
86
86
  ImportUserDataSteps.getHelpMessage().should('be.visible');
@@ -46,7 +46,7 @@ describe('Import view', () => {
46
46
  // Then I should see the uploaded file
47
47
  ImportUserDataSteps.getResources().should('have.length', 1);
48
48
  ImportUserDataSteps.getResourceByName('bnodes.ttl').should('be.visible');
49
- ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
49
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
50
50
  });
51
51
 
52
52
  it('Should display/hide help message depends on resource result', () => {
@@ -108,7 +108,7 @@ describe('Import view', () => {
108
108
  ImportSettingsDialogSteps.getDialog().should('be.visible');
109
109
  ImportSettingsDialogSteps.import();
110
110
  ImportUserDataSteps.getResources().should('have.length', 1);
111
- ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
111
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'bnodes.ttl');
112
112
 
113
113
  // Then I expect the help message not exist, because user because there are resource displayed
114
114
  ImportUserDataSteps.getHelpMessage().should('not.exist');
@@ -44,7 +44,7 @@ describe('Initial state of the import view with a selected repository', () => {
44
44
  ImportSteps.getUploadRdfFilesButton().should('be.visible');
45
45
  ImportSteps.getUploadFromUrlButton().should('be.visible');
46
46
  ImportSteps.getUploadTextSnippetButton().should('be.visible');
47
- ImportUserDataSteps.getFileSizeLimitationWarningMessage().should('be.visible');
47
+ ImportUserDataSteps.getFileSizeLimitationInfoMessage().should('be.visible');
48
48
  ImportUserDataSteps.getHelpMessage().should('not.exist');
49
49
  ImportUserDataSteps.getResourcesTable().should('be.visible');
50
50
  };
@@ -38,7 +38,7 @@ describe('Initial state of the import view with a selected repository and no imp
38
38
  ImportSteps.getUploadRdfFilesButton().should('be.visible');
39
39
  ImportSteps.getUploadFromUrlButton().should('be.visible');
40
40
  ImportSteps.getUploadTextSnippetButton().should('be.visible');
41
- ImportUserDataSteps.getFileSizeLimitationWarningMessage().should('be.visible');
41
+ ImportUserDataSteps.getFileSizeLimitationInfoMessage().should('be.visible');
42
42
  ImportUserDataSteps.getHelpMessage().should('be.visible');
43
43
  ImportUserDataSteps.getResourcesTable().should('be.hidden');
44
44
  };