graphdb-workbench-tests 2.6.4 → 2.7.0-RC10

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 (73) hide show
  1. package/Dockerfile +3 -1
  2. package/fixtures/cluster/3-nodes-cluster-group-status-receiving-snapshot.json +7 -7
  3. package/fixtures/graphdb-import/0007-import-file.jsonld +27 -0
  4. package/fixtures/graphdb-import/more-files/jsonld-file.jsonld +8 -0
  5. package/fixtures/graphdb-import/more-files/rdfxml.rdf +15 -0
  6. package/fixtures/graphdb-import/more-files-with-error/import-resource-with-correct-data.jsonld +8 -0
  7. package/fixtures/graphdb-import/more-files-with-error/import-resource-with-incorrect-data.rdf +13 -0
  8. package/fixtures/graphdb-import/more-files-with-error/import-resource-with-long-error.rdf +13 -0
  9. package/fixtures/graphdb-import/sample-jsonld.json +8 -0
  10. package/fixtures/locale-en.json +251 -111
  11. package/fixtures/url-import-template.json +1 -0
  12. package/integration/cluster/cluster-legend.spec.js +36 -0
  13. package/integration/cluster/cluster-management.spec.js +4 -92
  14. package/integration/cluster/cluster-states.spec.js +117 -0
  15. package/integration/explore/graphs.overview.spec.js +62 -0
  16. package/integration/explore/similarity.spec.js +20 -2
  17. package/integration/guides/movies-interactive-guide.spec.js +1 -1
  18. package/integration/guides/star-wars-interactive-guide.js +1 -0
  19. package/integration/import/import-server-files-batch-operations.spec.js +121 -0
  20. package/integration/import/import-server-files.spec.js +147 -0
  21. package/integration/import/import-user-data-file-upload.spec.js +194 -0
  22. package/integration/import/import-user-data-settings-dialog.spec.js +70 -0
  23. package/integration/import/import-user-data-text-snippet.spec.js +246 -0
  24. package/integration/import/import-user-data-url.spec.js +70 -0
  25. package/integration/import/import-user-data.spec.js +119 -0
  26. package/integration/import/import-view.spec.js +108 -0
  27. package/integration/monitor/global-operation-statuses-component.spec.js +2 -2
  28. package/integration/repository/repositories.spec.js +20 -17
  29. package/integration/resource/resource.spec.js +40 -0
  30. package/integration/setup/aclmanagement/create-rule.spec.js +15 -0
  31. package/integration/setup/sparql-template-create.js +4 -4
  32. package/integration/setup/user-and-access.spec.js +98 -138
  33. package/integration/sparql-editor/internationalization.spec.js +62 -12
  34. package/integration/sparql-editor/yasgui-tabs.spec.js +15 -1
  35. package/integration/sparql-editor/yasr/download-as.spec.js +71 -0
  36. package/integration-flaky/import/import-server-files-operations.spec.js +142 -0
  37. package/integration-flaky/import/import-user-data-batch-operations.spec.js +185 -0
  38. package/integration-flaky/import/import.server.files.spec.js +3 -2
  39. package/integration-flaky/setup/sparql-template-create.js +1 -1
  40. package/integration-flaky/sparql-editor/actions/share-query.spec.js +1 -1
  41. package/npm-shrinkwrap.json +3198 -0
  42. package/package.json +10 -11
  43. package/steps/cluster/cluster-configuration-steps.js +17 -0
  44. package/steps/cluster/cluster-page-steps.js +20 -8
  45. package/steps/cluster/cluster-view-steps.js +6 -2
  46. package/steps/explore/graphs-overview-steps.js +32 -0
  47. package/steps/explore/similarity-indexes-steps.js +26 -0
  48. package/steps/guides/guide-steps.js +5 -19
  49. package/steps/home-steps.js +4 -0
  50. package/steps/import/file-overwrite-dialog-steps.js +16 -0
  51. package/steps/import/import-resource-message-dialog.js +46 -0
  52. package/steps/import/import-server-files-steps.js +36 -0
  53. package/steps/import/import-settings-dialog-steps.js +60 -0
  54. package/steps/import/import-steps.js +463 -0
  55. package/steps/import/import-user-data-steps.js +167 -0
  56. package/steps/json-ld-modal-steps.js +41 -0
  57. package/steps/language-selector-steps.js +12 -0
  58. package/steps/main-menu-steps.js +4 -0
  59. package/steps/resource/resource-steps.js +7 -2
  60. package/steps/setup/acl-management-steps.js +4 -0
  61. package/steps/setup/user-and-access-steps.js +189 -0
  62. package/steps/sparql-steps.js +1 -1
  63. package/steps/yasgui/yasgui-steps.js +6 -0
  64. package/steps/yasgui/yasr-steps.js +5 -0
  65. package/stubs/yasgui/query-stubs.js +4 -0
  66. package/support/commands.js +23 -0
  67. package/support/import-commands.js +10 -0
  68. package/support/sparql-commands.js +1 -1
  69. package/bin/graphdb-workbench-cypress +0 -29
  70. package/integration/help/rest-api.spec.js +0 -121
  71. package/integration/import/import.server.files.spec.js +0 -69
  72. package/integration/import/import.user.data.spec.js +0 -338
  73. package/steps/import-steps.js +0 -277
@@ -0,0 +1,147 @@
1
+ import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
2
+ import {ImportServerFilesSteps} from "../../steps/import/import-server-files-steps";
3
+ import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dialog-steps";
4
+ import {ImportResourceMessageDialog} from "../../steps/import/import-resource-message-dialog";
5
+ import {ApplicationSteps} from "../../steps/application-steps";
6
+
7
+ describe('Import server files', () => {
8
+
9
+ let repositoryId;
10
+
11
+ const JSONLD_FILE_FOR_IMPORT = '0007-import-file.jsonld';
12
+
13
+ beforeEach(() => {
14
+ repositoryId = 'server-import-' + Date.now();
15
+ cy.createRepository({id: repositoryId});
16
+ ImportServerFilesSteps.visitServerImport(repositoryId);
17
+ ImportServerFilesSteps.getResources().should('have.length', 18);
18
+ });
19
+
20
+ afterEach(() => {
21
+ cy.deleteRepository(repositoryId);
22
+ });
23
+
24
+ it('Should be able to open the server files tab through a click on the tab', () => {
25
+ // Given I have visited the import page
26
+ ImportUserDataSteps.visit();
27
+ ImportUserDataSteps.getActiveTab().should('have.text', 'User data');
28
+ // When I switch to the server files tab
29
+ ImportUserDataSteps.openServerFilesTab();
30
+ // Then Server files tab should be active
31
+ cy.url().should('include', '/import#server');
32
+ ImportServerFilesSteps.getActiveTab().should('have.text', 'Server files');
33
+ ImportServerFilesSteps.getResourcesTable().should('be.visible');
34
+ });
35
+
36
+ it('Should be able to open the server files tab through a link', () => {
37
+ // When I visit the import page through a direct link to the server files tab
38
+ cy.visit('/import#server');
39
+ // Then Server files tab should be active
40
+ cy.url().should('include', '/import#server');
41
+ ImportServerFilesSteps.getActiveTab().should('have.text', 'Server files');
42
+ ImportServerFilesSteps.getResourcesTable().should('be.visible');
43
+ });
44
+
45
+ it('Should be able to toggle the server file import help', () => {
46
+ // When the page is loaded
47
+ // Then I should not see the server files import help
48
+ ImportServerFilesSteps.getHelpMessage().should('not.exist');
49
+ // When I open the help
50
+ ImportServerFilesSteps.toggleHelpMessage();
51
+ // Then the help should disappear
52
+ ImportServerFilesSteps.getHelpMessage().should('be.visible');
53
+ });
54
+
55
+ it('Should be able to filter the files', () => {
56
+ // When the server files tab is loaded
57
+ // Then I should see all the files
58
+ // When I type in the filter filed
59
+ ImportServerFilesSteps.typeInFilterField('007');
60
+ // Then I should see only the files matching the filter
61
+ ImportServerFilesSteps.getResources().should('have.length', 1);
62
+ ImportServerFilesSteps.getResourceByName(JSONLD_FILE_FOR_IMPORT).should('be.visible');
63
+ });
64
+
65
+ it('Should be able to switch between files, folders and mixed list', () => {
66
+ // When the server files tab is loaded
67
+ // Then I should see all the files and folders by default
68
+ ImportServerFilesSteps.getShowAllResourceTypesButton().should('have.class', 'active');
69
+ ImportServerFilesSteps.getResources().should('have.length', 18);
70
+ // When I select the folders only filter
71
+ ImportServerFilesSteps.selectFoldersOnlyFilter();
72
+ // Then I should see only the folders
73
+ ImportServerFilesSteps.getShowOnlyFoldersButton().should('have.class', 'active');
74
+ ImportServerFilesSteps.getResources().should('have.length', 2);
75
+ // When I select the files only filter
76
+ ImportServerFilesSteps.selectFilesOnlyFilter();
77
+ // Then I should see only the files
78
+ ImportServerFilesSteps.getResources().should('have.length', 16);
79
+ });
80
+
81
+ it('should be able to import the whole directory', () => {
82
+ // When the server files tab is loaded
83
+ // When I try to import a directory that contains resources with correct rdf data.
84
+ ImportServerFilesSteps.importResourceByName('more-files');
85
+ ImportSettingsDialogSteps.import();
86
+
87
+ // Then I expect all files to be successfully imported.
88
+ // TODO: this check is failing right now because the fix https://ontotext.atlassian.net/browse/GDB-10295 is not yet completed.
89
+ // ImportServerFilesSteps.checkImportedResource(0, 'more-files', 'Imported successfully in');
90
+ ImportServerFilesSteps.checkImportedResource(1, 'jsonld-file.jsonld', 'Imported successfully in');
91
+ ImportServerFilesSteps.checkImportedResource(2, 'rdfxml.rdf', 'Imported successfully in');
92
+
93
+ // When I try to import a directory that contains resources with incorrect rdf data.
94
+ ImportServerFilesSteps.importResourceByName('more-files-with-error');
95
+ ImportSettingsDialogSteps.import();
96
+ // Then I expect no one file be imported.
97
+ // TODO: this check is failing right now because the fix https://ontotext.atlassian.net/browse/GDB-10295 is not yet completed.
98
+ // ImportServerFilesSteps.checkImportedResource(0, 'more-files-with-error', 'RDF Parse Error: The element type "ex:editor" must be terminated by the matching end-ta');
99
+ ImportServerFilesSteps.checkImportedStatusIsEmpty('import-resource-with-correct-data.jsonld');
100
+ ImportServerFilesSteps.checkImportedStatusIsEmpty('import-resource-with-incorrect-data.rdf');
101
+
102
+ // When I click on a directory reset status button
103
+ ImportServerFilesSteps.resetResourceStatusByName('more-files');
104
+
105
+ // Then I expect all sub-resource statuses to be reset.
106
+ ImportServerFilesSteps.checkImportedStatusIsEmpty('more-files');
107
+ // TODO: When the status of a given folder is reset, all sub-folder/file statuses should be reset. This works correctly
108
+ // when the scenario is executed manually or if the test is run locally. For some reason, in the Jenkins environment, the status is cleared
109
+ // only for the folder. The next two lines are correct but are commented out to be tried again later.
110
+ // ImportServerFilesSteps.checkImportedStatusIsEmpty('jsonld-file.jsonld');
111
+ // ImportServerFilesSteps.checkImportedStatusIsEmpty('rdfxml.rdf');
112
+ });
113
+
114
+ it('should open error dialog', () => {
115
+ const importResourceName = 'import-resource-with-long-error.rdf';
116
+ // When I visited the server import tab,
117
+ // and try to import a file with wrong data that causes server to generate long error message.
118
+ ImportServerFilesSteps.importResourceByName(importResourceName);
119
+ ImportSettingsDialogSteps.import();
120
+
121
+ // I expect only part of the error be displayed,
122
+ ImportServerFilesSteps.checkImportedResource(0, importResourceName, 'RDF Parse Error: The element type ');
123
+ // and when click on that error
124
+ ImportServerFilesSteps.openErrorDialog(importResourceName);
125
+
126
+ // Then I expect to see dialog,
127
+ ImportSettingsDialogSteps.getDialog().should('be.visible');
128
+
129
+ // with full error message
130
+ ImportResourceMessageDialog.getMessage().should('have.value', 'RDF Parse Error: The element type "ex:looooooooooooooooooooooooooooooooongTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame" must be terminated by the matching end-tag "</ex:looooooooooooooooooooooooooooooooongTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame>". [line 9, column 6]');
131
+
132
+ // When I click on corner close button.
133
+ ImportResourceMessageDialog.clickOnCornerCloseButton();
134
+
135
+ // // Then I expect the dialog closed
136
+ ImportResourceMessageDialog.getDialog().should('not.exist');
137
+
138
+ // When error dialog is opened,
139
+ ImportServerFilesSteps.openErrorDialog(importResourceName);
140
+ ImportResourceMessageDialog.getDialog().should('be.visible');
141
+ // and I click one close button
142
+ ImportResourceMessageDialog.clickOnCloseButton();
143
+
144
+ // Then I expect the dialog closed
145
+ ImportResourceMessageDialog.getDialog().should('not.exist');
146
+ });
147
+ });
@@ -0,0 +1,194 @@
1
+ import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dialog-steps";
2
+ import {MainMenuSteps} from "../../steps/main-menu-steps";
3
+ import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
4
+ import {FileOverwriteDialogSteps} from "../../steps/import/file-overwrite-dialog-steps";
5
+
6
+ const bnodes = `_:node0 <http://purl.org/dc/elements/1.1/title> "A new book" ;
7
+ \t<http://purl.org/dc/elements/1.1/creator> "A.N.Other" .`;
8
+ const jsonld = JSON.stringify({
9
+ "@context": {
10
+ "ab": "http://learningsparql.com/ns/addressbook#"
11
+ },
12
+ "@id": "ab:richard",
13
+ "ab:homeTel": "(229)276-5135",
14
+ "ab:email": "richard491@hotmail.com"
15
+ });
16
+
17
+ describe('Import user data: File upload', () => {
18
+
19
+ let repositoryId;
20
+ const testFiles = [
21
+ 'bnodes.ttl',
22
+ 'jsonld.jsonld',
23
+ 'invalid-format.json'
24
+ ];
25
+
26
+ beforeEach(() => {
27
+ repositoryId = 'user-import-' + Date.now();
28
+ cy.createRepository({id: repositoryId});
29
+ cy.presetRepository(repositoryId);
30
+ ImportUserDataSteps.visitImport('user', repositoryId);
31
+ });
32
+
33
+ afterEach(() => {
34
+ cy.deleteUploadedFile(repositoryId, testFiles);
35
+ cy.deleteRepository(repositoryId);
36
+ });
37
+
38
+ it('Should be able to upload and import a single unique file', () => {
39
+ // Given there are no files uploaded yet
40
+ ImportUserDataSteps.getResourcesTable().should('be.hidden');
41
+ // When I start to upload a file
42
+ ImportUserDataSteps.selectFile(ImportUserDataSteps.createFile(testFiles[0], bnodes));
43
+ // Then the import settings dialog should open automatically
44
+ ImportSettingsDialogSteps.getDialog().should('be.visible');
45
+ ImportSettingsDialogSteps.import();
46
+ ImportSettingsDialogSteps.getDialog().should('not.exist');
47
+ // Then I should see the uploaded file
48
+ ImportUserDataSteps.getResources().should('have.length', 1);
49
+ ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
50
+ });
51
+
52
+ it('Should allow replacing graph when uploading and importing single file', () => {
53
+ // Given there are no files uploaded yet
54
+ ImportUserDataSteps.getResourcesTable().should('be.hidden');
55
+ // When I start to upload a file
56
+ ImportUserDataSteps.selectFile(ImportUserDataSteps.createFile(testFiles[0], bnodes));
57
+ // Then the import settings dialog should open automatically
58
+ ImportSettingsDialogSteps.getDialog().should('be.visible');
59
+ // And the option for replace graph should be active
60
+ ImportSettingsDialogSteps.getReplaceExistingDataCheckbox().should('be.enabled').and('not.be.checked');
61
+ });
62
+
63
+ it('Should be able to upload and import files one after the other and then override them', () => {
64
+ // Given there are no files uploaded yet
65
+ ImportUserDataSteps.getResourcesTable().should('be.hidden');
66
+ // When I upload a file
67
+ ImportUserDataSteps.selectFile(ImportUserDataSteps.createFile(testFiles[0], bnodes));
68
+ ImportSettingsDialogSteps.import();
69
+ // Then I should see the uploaded file
70
+ ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
71
+ // When I upload another file
72
+ ImportUserDataSteps.selectFile(ImportUserDataSteps.createFile(testFiles[1], jsonld));
73
+ ImportSettingsDialogSteps.import();
74
+ // Then I should see the uploaded file - it becomes first in the list
75
+ ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
76
+ ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
77
+ // When I override the first file
78
+ ImportUserDataSteps.selectFile(ImportUserDataSteps.createFile(testFiles[0], bnodes));
79
+ FileOverwriteDialogSteps.overwrite();
80
+ ImportSettingsDialogSteps.import();
81
+ // Then I should see the uploaded file - it becomes first in the list
82
+ // TODO: timestamps currently seems to not be changed on reimport
83
+ ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
84
+ ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
85
+ // When I override the second file
86
+ ImportUserDataSteps.selectFile(ImportUserDataSteps.createFile(testFiles[1], jsonld));
87
+ FileOverwriteDialogSteps.overwrite();
88
+ ImportSettingsDialogSteps.import();
89
+ // Then I should see the uploaded file - it becomes first in the list
90
+ ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
91
+ ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
92
+ });
93
+
94
+ it('should be able to only upload a single file without importing it', () => {
95
+ // Given there are no files uploaded yet
96
+ ImportUserDataSteps.getResourcesTable().should('be.hidden');
97
+ // When I start to upload a file
98
+ ImportUserDataSteps.selectFile(ImportUserDataSteps.createFile(testFiles[0], bnodes));
99
+ // Then the import settings dialog should open automatically
100
+ ImportSettingsDialogSteps.cancelImport();
101
+ // Then I should see the uploaded file
102
+ ImportUserDataSteps.getResources().should('have.length', 1);
103
+ ImportUserDataSteps.checkUserDataUploadedResource(0, 'bnodes.ttl');
104
+ // And the file should really be there
105
+ MainMenuSteps.openHomePage();
106
+ ImportUserDataSteps.visit();
107
+ ImportUserDataSteps.getResources().should('have.length', 1);
108
+ });
109
+
110
+ it('Should be able to upload multiple unique files', () => {
111
+ // Given there are no files uploaded yet
112
+ ImportUserDataSteps.getResourcesTable().should('be.hidden');
113
+ // When I upload a file
114
+ const file1 = ImportUserDataSteps.createFile(testFiles[0], bnodes);
115
+ const file2 = ImportUserDataSteps.createFile(testFiles[1], jsonld);
116
+ ImportUserDataSteps.selectFile([file1, file2]);
117
+ // Then the import settings dialog should open automatically
118
+ ImportSettingsDialogSteps.import();
119
+ // Then I should see the uploaded file
120
+ ImportUserDataSteps.getResources().should('have.length', 2);
121
+ ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
122
+ ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
123
+ // And the files should really be there
124
+ MainMenuSteps.openHomePage();
125
+ ImportUserDataSteps.visit();
126
+ ImportUserDataSteps.getResources().should('have.length', 2);
127
+ });
128
+
129
+ it('Should be able to override a single file', () => {
130
+ // Given I have uploaded a file
131
+ ImportUserDataSteps.getResourcesTable().should('be.hidden');
132
+ const file1 = ImportUserDataSteps.createFile(testFiles[0], bnodes);
133
+ ImportUserDataSteps.selectFile(file1);
134
+ ImportSettingsDialogSteps.import();
135
+ ImportUserDataSteps.getResources().should('have.length', 1);
136
+ ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
137
+ // When I upload a file with the same name
138
+ ImportUserDataSteps.selectFile(file1);
139
+ // Then I should see a file override confirmation dialog
140
+ FileOverwriteDialogSteps.getDialog().should('be.visible');
141
+ // When I confirm the file override
142
+ FileOverwriteDialogSteps.overwrite();
143
+ // Then the import settings dialog should open automatically
144
+ ImportSettingsDialogSteps.import();
145
+ // Then The file should be overridden
146
+ ImportUserDataSteps.getResources().should('have.length', 1);
147
+ ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
148
+ });
149
+
150
+ it('Should be able to upload file with same name and preserve the existing file', () => {
151
+ // Given I have uploaded a file
152
+ ImportUserDataSteps.getResourcesTable().should('be.hidden');
153
+ const file1 = ImportUserDataSteps.createFile(testFiles[0], bnodes);
154
+ ImportUserDataSteps.selectFile(file1);
155
+ ImportSettingsDialogSteps.import();
156
+ ImportUserDataSteps.getResources().should('have.length', 1);
157
+ ImportUserDataSteps.checkImportedResource(0, 'bnodes.ttl');
158
+ // When I upload a file with the same name
159
+ ImportUserDataSteps.selectFile(file1);
160
+ // Then I should see a file override confirmation dialog
161
+ FileOverwriteDialogSteps.getDialog().should('be.visible');
162
+ // When I cancel the file override
163
+ FileOverwriteDialogSteps.keepBoth();
164
+ ImportSettingsDialogSteps.import();
165
+ // Then The file should not be overridden but prefixed instead
166
+ ImportUserDataSteps.getResources().should('have.length', 2);
167
+ ImportUserDataSteps.checkImportedResource(0, 'bnodes-0.ttl');
168
+ ImportUserDataSteps.checkImportedResource(1, 'bnodes.ttl');
169
+ // When I upload two files, one with the same name and second new one
170
+ const file2 = ImportUserDataSteps.createFile(testFiles[1], jsonld);
171
+ ImportUserDataSteps.selectFile([file1, file2]);
172
+ FileOverwriteDialogSteps.getDialog().should('be.visible');
173
+ FileOverwriteDialogSteps.keepBoth();
174
+ ImportSettingsDialogSteps.import();
175
+ // Then The file should not be overridden but prefixed with increased index instead
176
+ ImportUserDataSteps.getResources().should('have.length', 4);
177
+ ImportUserDataSteps.checkImportedResource(0, 'jsonld.jsonld');
178
+ ImportUserDataSteps.checkImportedResource(1, 'bnodes-1.ttl');
179
+ ImportUserDataSteps.checkImportedResource(2, 'bnodes-0.ttl');
180
+ ImportUserDataSteps.checkImportedResource(3, 'bnodes.ttl');
181
+ });
182
+
183
+ it('should see error message when uploaded file has invalid format', () => {
184
+ // Given I don't have any files uploaded yet
185
+
186
+ // When I upload a file with invalid format
187
+ const file1 = ImportUserDataSteps.createFile(testFiles[2], jsonld);
188
+ ImportUserDataSteps.selectFile(file1);
189
+ ImportSettingsDialogSteps.import();
190
+ // Then I should see an error message
191
+ ImportUserDataSteps.getResources().should('have.length', 1);
192
+ ImportUserDataSteps.checkImportedResource(0, 'invalid-format.json', 'RDF Parse Error: Invalid file format');
193
+ });
194
+ });
@@ -0,0 +1,70 @@
1
+ import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
2
+
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
+ });
13
+
14
+ describe('Import user data: Import settings dialog', () => {
15
+
16
+ let repositoryId;
17
+ const testFiles = [
18
+ 'bnodes.ttl',
19
+ 'jsonld.json'
20
+ ];
21
+
22
+ beforeEach(() => {
23
+ repositoryId = 'user-import-' + Date.now();
24
+ cy.createRepository({id: repositoryId});
25
+ cy.presetRepository(repositoryId);
26
+ ImportUserDataSteps.visitImport('user', repositoryId);
27
+ });
28
+
29
+ afterEach(() => {
30
+ cy.deleteUploadedFile(repositoryId, testFiles);
31
+ cy.deleteRepository(repositoryId);
32
+ });
33
+
34
+ it.skip('Should prevent import when there are missing or invalid settings', () => {
35
+ // Given I have uploaded a file
36
+
37
+ // When the settings dialog appears
38
+
39
+ // Then I should be able to start the import because the form is valid
40
+
41
+ // When I switch target graph to named graph
42
+
43
+ // Then context field should become enabled and invalid because it is required
44
+
45
+ // And the import button should become disabled
46
+
47
+ // When I fill in valid IRI for context
48
+
49
+ // Then The field should become valid
50
+
51
+ // And the import button should become enabled
52
+
53
+ // When I fill in invalid IRI for jsonld context link
54
+
55
+ // Then the field should become invalid
56
+
57
+ // When I fill in valid IRI for jsonld context link
58
+
59
+ // Then the jsonld context link should become valid
60
+
61
+ // When I fill in invalid IRI for base IRI
62
+
63
+ // Then the base IRI should become invalid
64
+
65
+ // When I fill in valid IRI for base IRI
66
+
67
+ // Then the base IRI should become valid
68
+
69
+ });
70
+ });
@@ -0,0 +1,246 @@
1
+ import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
2
+ import {ImportSettingsDialogSteps} from "../../steps/import/import-settings-dialog-steps";
3
+
4
+ describe('Import user data: Text snippet', () => {
5
+
6
+ let repositoryId;
7
+ const INITIAL_DATA = "<urn:s1> <urn:p1> <urn:o1>.";
8
+ const REPLACEMENT_DATA = "<urn:replaced-s1> <urn:replaced-p1> <urn:replaced-o1>.";
9
+ const PRE_DEFINED_INITIAL_GRAPH_DATA = "<urn:graph1> {<urn:s1-custom> <urn:p1-custom> <urn:o1-custom>.}";
10
+ const PRE_DEFINED_REPLACED_GRAPH_DATA = "<urn:graph1> {<urn:replaced-s1-custom> <urn:replaced-p1-custom> <urn:replaced-o1-custom>.}";
11
+
12
+ const RDF_TEXT_SNIPPET_1 = '@prefix d:<http://learningsparql.com/ns/data#>.\n' +
13
+ '@prefix dm:<http://learningsparql.com/ns/demo#>.\n\n' +
14
+ 'd:item342 dm:shipped "2011-02-14"^^<http://www.w3.org/2001/XMLSchema#date>.\n' +
15
+ 'd:item342 dm:quantity 4.\n' +
16
+ 'd:item342 dm:invoiced true.\n' +
17
+ 'd:item342 dm:costPerItem 3.50.';
18
+
19
+ const RDF_TEXT_SNIPPET_2 = '@prefix ab:<http://learningsparql.com/ns/addressbook#>.\n\n' +
20
+ 'ab:richard ab:homeTel "(229)276-5135".\n' +
21
+ 'ab:richard ab:email "richard49@hotmail.com".\n' +
22
+ 'ab:richard ab:email "richard491@hotmail.com".';
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
+ const JSONLD_TEXT_SNIPPET = '[\n' +
44
+ ' {\n' +
45
+ ' "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property",\n' +
46
+ ' "@type": [\n' +
47
+ ' "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property",\n' +
48
+ ' "http://www.w3.org/2000/01/rdf-schema#Datatype",\n' +
49
+ ' "http://www.w3.org/2000/01/rdf-schema#ContainerMembershipProperty"\n' +
50
+ ' ]\n' +
51
+ ' }' +
52
+ ']';
53
+
54
+ const BASE_URI = 'http://purl.org/dc/elements/1.1/';
55
+ const CONTEXT = 'http://example.org/graph';
56
+ const TEXT_SNIPPET = 'Text snippet';
57
+ const JSONLD_FORMAT = 'JSON-LD';
58
+ const VALID_SNIPPET_TURTLESTAR_FORMAT = 'Turtle*';
59
+ const VALID_SNIPPET_TRIGSTAR_FORMAT = 'TriG*';
60
+ const VALID_SNIPPET_RDF_FORMAT = 'Turtle';
61
+ const RDF_ERROR_MESSAGE = 'RDF Parse Error:';
62
+
63
+ beforeEach(() => {
64
+ repositoryId = 'user-import-' + Date.now();
65
+ cy.createRepository({id: repositoryId});
66
+ ImportUserDataSteps.visitUserImport(repositoryId);
67
+ });
68
+
69
+ afterEach(() => {
70
+ cy.deleteRepository(repositoryId);
71
+ });
72
+
73
+ it('Should import RDF text snippet successfully with Auto format selected', () => {
74
+ ImportUserDataSteps.openImportTextSnippetDialog();
75
+ ImportUserDataSteps.fillRDFTextSnippet(RDF_TEXT_SNIPPET_1);
76
+ ImportUserDataSteps.clickImportTextSnippetButton();
77
+ ImportSettingsDialogSteps.import();
78
+ ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
79
+ });
80
+
81
+ it('Should import RDF text snippet with invalid RDF format selected', () => {
82
+ ImportUserDataSteps.openImportTextSnippetDialog();
83
+ ImportUserDataSteps.fillRDFTextSnippet(RDF_TEXT_SNIPPET_1);
84
+ ImportUserDataSteps.selectRDFFormat(JSONLD_FORMAT);
85
+ ImportUserDataSteps.clickImportTextSnippetButton();
86
+ ImportSettingsDialogSteps.import();
87
+ ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET, RDF_ERROR_MESSAGE);
88
+ });
89
+
90
+ it('Should import RDF text snippet successfully with valid RDF format selected', () => {
91
+ ImportUserDataSteps.openImportTextSnippetDialog();
92
+ ImportUserDataSteps.fillRDFTextSnippet(RDF_TEXT_SNIPPET_1);
93
+ ImportUserDataSteps.selectRDFFormat(VALID_SNIPPET_RDF_FORMAT);
94
+ ImportUserDataSteps.clickImportTextSnippetButton();
95
+ 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);
115
+ });
116
+
117
+ it('Should import RDF text snippet successfully with filled base URI and context', () => {
118
+ ImportUserDataSteps.openImportTextSnippetDialog();
119
+ ImportUserDataSteps.fillRDFTextSnippet(RDF_TEXT_SNIPPET_2);
120
+ ImportUserDataSteps.clickImportTextSnippetButton();
121
+ ImportSettingsDialogSteps.expandAdvancedSettings();
122
+ ImportSettingsDialogSteps.fillBaseURI(BASE_URI);
123
+ ImportSettingsDialogSteps.selectNamedGraph();
124
+ ImportSettingsDialogSteps.fillNamedGraph(CONTEXT);
125
+ ImportSettingsDialogSteps.import();
126
+ ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
127
+
128
+ // Go to Graphs overview
129
+ cy.visit('/graphs');
130
+ cy.get('.ot-splash').should('not.be.visible');
131
+
132
+ const graphName = CONTEXT.slice(0, CONTEXT.lastIndexOf('.'));
133
+
134
+ // Verify that created graph can be found
135
+ cy.get('.search-graphs').type(graphName).should('have.value', graphName);
136
+ cy.get('#export-graphs').should('be.visible').should('contain', graphName);
137
+ });
138
+
139
+ it('Should import RDF snippet in the default graph (from data) and replace data in the default graph', () => {
140
+ ImportUserDataSteps.openImportTextSnippetDialog();
141
+ ImportUserDataSteps.fillRDFTextSnippet(INITIAL_DATA);
142
+ ImportUserDataSteps.selectRDFFormat("TriG");
143
+ ImportUserDataSteps.clickImportTextSnippetButton();
144
+ ImportUserDataSteps.importFromData(false, "http://www.openrdf.org/schema/sesame#nil");
145
+ ImportUserDataSteps.getDeleteImportEntryButton().click();
146
+ ImportUserDataSteps.verifyGraphData("The default graph", "urn:s1", "urn:p1", "urn:o1", "http://www.ontotext.com/explicit", false, "urn:s1");
147
+ ImportUserDataSteps.visitUserImport(repositoryId);
148
+ ImportUserDataSteps.openImportTextSnippetDialog();
149
+ ImportUserDataSteps.fillRDFTextSnippet(REPLACEMENT_DATA);
150
+ ImportUserDataSteps.selectRDFFormat("TriG");
151
+ ImportUserDataSteps.clickImportTextSnippetButton();
152
+ ImportUserDataSteps.importFromData(true, "http://www.openrdf.org/schema/sesame#nil");
153
+ ImportUserDataSteps.verifyGraphData("The default graph", "urn:replaced-s1", "urn:replaced-p1", "urn:replaced-o1", "http://www.ontotext.com/explicit", true, "urn:s1");
154
+ });
155
+
156
+ it('Should import RDF snippet with a custom graph (from data) and replace data in the custom graph', () => {
157
+ ImportUserDataSteps.openImportTextSnippetDialog();
158
+ ImportUserDataSteps.fillRDFTextSnippet(PRE_DEFINED_INITIAL_GRAPH_DATA);
159
+ ImportUserDataSteps.selectRDFFormat("TriG");
160
+ ImportUserDataSteps.clickImportTextSnippetButton();
161
+ ImportUserDataSteps.importFromData(false, "http://www.openrdf.org/schema/sesame#nil");
162
+ ImportUserDataSteps.getDeleteImportEntryButton().click();
163
+ ImportUserDataSteps.verifyGraphData("urn:graph1", "urn:s1-custom", "urn:p1-custom", "urn:o1-custom", "urn:graph1", false, "urn:s1-custom");
164
+ ImportUserDataSteps.visitUserImport(repositoryId);
165
+ ImportUserDataSteps.openImportTextSnippetDialog();
166
+ ImportUserDataSteps.fillRDFTextSnippet(PRE_DEFINED_REPLACED_GRAPH_DATA);
167
+ ImportUserDataSteps.selectRDFFormat("TriG");
168
+ ImportUserDataSteps.clickImportTextSnippetButton();
169
+ ImportUserDataSteps.importFromData(true, "urn:graph1");
170
+ ImportUserDataSteps.verifyGraphData("urn:graph1", "urn:replaced-s1-custom", "urn:replaced-p1-custom", "urn:replaced-o1-custom", "urn:graph1", true, "urn:s1-custom");
171
+ });
172
+
173
+ it('Should import RDF snippet in the default graph (The default graph) and replace data in the default graph', () => {
174
+ ImportUserDataSteps.openImportTextSnippetDialog();
175
+ ImportUserDataSteps.fillRDFTextSnippet(INITIAL_DATA);
176
+ ImportUserDataSteps.selectRDFFormat("TriG");
177
+ ImportUserDataSteps.clickImportTextSnippetButton();
178
+ ImportUserDataSteps.importInTheDefaultGraph(false);
179
+ ImportUserDataSteps.getDeleteImportEntryButton().click();
180
+ ImportUserDataSteps.verifyGraphData("The default graph", "urn:s1", "urn:p1", "urn:o1", "http://www.ontotext.com/explicit", false, "urn:s1");
181
+ ImportUserDataSteps.visitUserImport(repositoryId);
182
+ ImportUserDataSteps.openImportTextSnippetDialog();
183
+ ImportUserDataSteps.fillRDFTextSnippet(REPLACEMENT_DATA);
184
+ ImportUserDataSteps.selectRDFFormat("TriG");
185
+ ImportUserDataSteps.clickImportTextSnippetButton();
186
+ ImportUserDataSteps.importInTheDefaultGraph(true);
187
+ ImportUserDataSteps.verifyGraphData("The default graph", "urn:replaced-s1", "urn:replaced-p1", "urn:replaced-o1", "http://www.ontotext.com/explicit", true, "urn:s1");
188
+ });
189
+
190
+ it('Should import RDF snippet in a named graph (Named graph) and replace data in the named graph', () => {
191
+ ImportUserDataSteps.openImportTextSnippetDialog();
192
+ ImportUserDataSteps.fillRDFTextSnippet(INITIAL_DATA);
193
+ ImportUserDataSteps.selectRDFFormat("TriG");
194
+ ImportUserDataSteps.clickImportTextSnippetButton();
195
+ ImportUserDataSteps.importInNamedGraph(false, "http://graph1");
196
+ ImportUserDataSteps.getDeleteImportEntryButton().click();
197
+ ImportUserDataSteps.verifyGraphData("http://graph1", "urn:s1", "urn:p1", "urn:o1", "http://graph1", false, "urn:s1");
198
+ ImportUserDataSteps.visitUserImport(repositoryId);
199
+ ImportUserDataSteps.openImportTextSnippetDialog();
200
+ ImportUserDataSteps.fillRDFTextSnippet(REPLACEMENT_DATA);
201
+ ImportUserDataSteps.selectRDFFormat("TriG");
202
+ ImportUserDataSteps.clickImportTextSnippetButton();
203
+ ImportUserDataSteps.importInNamedGraph(true, "http://graph1");
204
+ ImportUserDataSteps.verifyGraphData("http://graph1", "urn:replaced-s1", "urn:replaced-p1", "urn:replaced-o1", "http://graph1", true, "urn:s1");
205
+ });
206
+
207
+ it('Should import JSON-LD text snippet successfully without URI', () => {
208
+ ImportUserDataSteps.openImportTextSnippetDialog();
209
+ ImportUserDataSteps.fillRDFTextSnippet(JSONLD_TEXT_SNIPPET);
210
+ ImportUserDataSteps.selectRDFFormat(JSONLD_FORMAT);
211
+ ImportUserDataSteps.clickImportTextSnippetButton();
212
+ ImportSettingsDialogSteps.selectNamedGraph();
213
+ ImportSettingsDialogSteps.fillNamedGraph(CONTEXT);
214
+ ImportSettingsDialogSteps.import();
215
+ ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
216
+
217
+ // Go to Graphs overview
218
+ cy.visit('/graphs');
219
+ cy.get('.ot-splash').should('not.be.visible');
220
+
221
+ const graphName = CONTEXT.slice(0, CONTEXT.lastIndexOf('.'));
222
+
223
+ // Verify that created graph can be found
224
+ cy.get('.search-graphs').type(graphName).should('have.value', graphName);
225
+ cy.get('#export-graphs').should('be.visible').should('contain', graphName);
226
+ });
227
+
228
+ it('Should import JSON-LD text snippet successfully with URI and context', () => {
229
+ ImportUserDataSteps.openImportTextSnippetDialog();
230
+ ImportUserDataSteps.fillRDFTextSnippet(JSONLD_TEXT_SNIPPET);
231
+ ImportUserDataSteps.selectRDFFormat(JSONLD_FORMAT);
232
+ ImportUserDataSteps.clickImportTextSnippetButton();
233
+ ImportSettingsDialogSteps.expandAdvancedSettings();
234
+ ImportSettingsDialogSteps.fillBaseURI(BASE_URI);
235
+ ImportSettingsDialogSteps.selectNamedGraph();
236
+ ImportSettingsDialogSteps.fillNamedGraph(CONTEXT);
237
+ ImportSettingsDialogSteps.fillContextLink('https://w3c.github.io/json-ld-api/tests/compact/0007-context.jsonld');
238
+ // ImportUserDataSteps.importFromSettingsDialog();
239
+ ImportSettingsDialogSteps.import();
240
+ ImportUserDataSteps.checkImportedResource(0, TEXT_SNIPPET);
241
+ const graphName = CONTEXT.slice(0, CONTEXT.lastIndexOf('.'));
242
+ // Verify that created graph can be found
243
+ ImportUserDataSteps.verifyGraphData(graphName, "rdf:Property", "rdf:Property", "rdf:Property", "http://example.org/graph", false);
244
+ });
245
+ });
246
+