graphdb-workbench-tests 2.6.4 → 2.7.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 (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 +145 -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
@@ -1,3 +1,5 @@
1
+ import {UserAndAccessSteps} from "../../steps/setup/user-and-access-steps";
2
+
1
3
  describe('User and Access', () => {
2
4
 
3
5
  const PASSWORD = "password";
@@ -7,21 +9,21 @@ describe('User and Access', () => {
7
9
  const DEFAULT_ADMIN_PASSWORD = "root";
8
10
 
9
11
  beforeEach(() => {
10
- cy.visit('/users');
12
+ UserAndAccessSteps.visit();
11
13
  cy.window();
12
14
  // Users table should be visible
13
- getUsersTable().should('be.visible');
15
+ UserAndAccessSteps.getUsersTable().should('be.visible');
14
16
  });
15
17
 
16
18
  after(() => {
17
- cy.visit('/users');
18
- getUsersTable().should('be.visible');
19
- cy.get('#wb-users-userInUsers tr').then((table) => {
20
- cy.get('table > tbody > tr').each(($el, index, $list) => {
21
- getUsersTable().should('be.visible');
19
+ UserAndAccessSteps.visit();
20
+ UserAndAccessSteps.getUsersTable().should('be.visible');
21
+ UserAndAccessSteps.getUsersTableRow().then((table) => {
22
+ UserAndAccessSteps.getTableRow().each(($el, index, $list) => {
23
+ UserAndAccessSteps.getUsersTable().should('be.visible');
22
24
  const username = $el.find('.username').text();
23
25
  if (username !=='admin') {
24
- deleteUser(username);
26
+ UserAndAccessSteps.deleteUser(username);
25
27
  }
26
28
  });
27
29
  });
@@ -29,26 +31,22 @@ describe('User and Access', () => {
29
31
 
30
32
  it('Initial state', () => {
31
33
  // Create new user button should be visible
32
- getCreateNewUserButton().should('be.visible');
34
+ UserAndAccessSteps.getCreateNewUserButton().should('be.visible');
33
35
  // Security should be disabled
34
- cy.get('#toggle-security').find('.security-switch-label').should('be.visible')
35
- .and('contain', 'Security is OFF');
36
- cy.get('#toggle-security').find('.switch:checkbox').should('not.be.checked');
36
+ UserAndAccessSteps.getSecuritySwitchLabel().should('be.visible').and('contain', 'Security is OFF');
37
+ UserAndAccessSteps.getSecurityCheckbox().should('not.be.checked');
37
38
  // Only admin user should be created by default
38
- getUsersTable().find('tbody tr').should('have.length', 1);
39
- findUserInTable('admin');
40
- cy.get('@user').find('.user-type').should('be.visible')
41
- .and('contain', 'Administrator');
39
+ UserAndAccessSteps.getTableRow().should('have.length', 1);
40
+ UserAndAccessSteps.findUserInTable('admin');
41
+ UserAndAccessSteps.getUserType().should('be.visible').and('contain', 'Administrator');
42
42
  // The admin should have unrestricted rights
43
- cy.get('@user').find('.repository-rights').should('be.visible')
44
- .and('contain', 'Unrestricted');
43
+ UserAndAccessSteps.getRepositoryRights().should('be.visible').and('contain', 'Unrestricted');
45
44
  // And can be edited
46
- cy.get('@user').find('.edit-user-btn').should('be.visible')
47
- .and('not.be.disabled');
45
+ UserAndAccessSteps.getEditUserButton().should('be.visible').and('not.be.disabled');
48
46
  // And cannot be deleted
49
- cy.get('@user').find('.delete-user-btn').should('not.exist');
47
+ UserAndAccessSteps.getDeleteUserButton().should('not.exist');
50
48
  // Date created should be visible
51
- cy.get('@user').find('.date-created').should('be.visible');
49
+ UserAndAccessSteps.getDateCreated().should('be.visible');
52
50
  });
53
51
 
54
52
  it('Create user', () => {
@@ -72,140 +70,102 @@ describe('User and Access', () => {
72
70
  testForUser(name, true);
73
71
  });
74
72
 
75
- function testForUser(name, isAdmin) {
76
- //enable security
77
- getToggleSecuritySwitch().click();
78
- //login new user
79
- loginWithUser(name, PASSWORD);
80
- //verify permissions
81
- cy.url().should('include', '/users');
82
- if (isAdmin) {
83
- getUsersTable().should('be.visible');
84
- } else {
85
- cy.get('.alert-danger').should('contain',
86
- 'You have no permission to access this functionality with your current credentials.');
87
- }
88
- logout();
89
- //login with the admin
90
- loginWithUser("admin", DEFAULT_ADMIN_PASSWORD);
91
- cy.get('.ot-splash').should('not.be.visible');
92
- getUsersTable().should('be.visible');
93
- //delete new-user
94
- deleteUser(name);
95
- //disable security
96
- getToggleSecuritySwitch().click({force: true});
97
- cy.get('#toggle-security').find('.security-switch-label').should('be.visible')
98
- .and('contain', 'Security is OFF');
99
- getUsersTable().should('be.visible');
100
- }
73
+ it('Create user with custom role', () => {
74
+ const name = "user";
75
+ // When I create a read/write user
76
+ UserAndAccessSteps.clickCreateNewUserButton();
77
+ UserAndAccessSteps.typeUsername(name);
78
+ UserAndAccessSteps.typePassword(PASSWORD);
79
+ UserAndAccessSteps.typeConfirmPasswordField(PASSWORD);
80
+ UserAndAccessSteps.selectRoleRadioButton(ROLE_USER);
81
+ // And add a custom role of 1 letter
82
+ UserAndAccessSteps.addTextToCustomRoleField('A');
83
+ UserAndAccessSteps.getRepositoryRightsList().contains('Any data repository').nextUntil('.write').eq(1).within(() => {
84
+ UserAndAccessSteps.clickWriteAccess();
85
+ });
86
+
87
+ // Then the 'create' button should be disabled
88
+ UserAndAccessSteps.getConfirmUserCreateButton().should('be.disabled');
89
+ // And the field should show an error
90
+ UserAndAccessSteps.getFieldError().should('contain.text', 'Must be at least 2 symbols long');
91
+ // When I add more text to the custom role tag
92
+ UserAndAccessSteps.addTextToCustomRoleField('A{enter}');
93
+ // Then the 'create' button should be enabled
94
+ UserAndAccessSteps.getConfirmUserCreateButton().should('be.enabled');
95
+ // And the field error should not exist
96
+ UserAndAccessSteps.getFieldError().should('not.be.visible');
97
+
98
+ // When I type an invalid tag
99
+ UserAndAccessSteps.addTextToCustomRoleField('B{enter}');
100
+ // And the field shows an error
101
+ UserAndAccessSteps.getFieldError().should('contain.text', 'Must be at least 2 symbols long');
102
+ // When I delete the invalid text
103
+ UserAndAccessSteps.addTextToCustomRoleField('{backspace}');
104
+ // Then the error should not be visible
105
+ UserAndAccessSteps.getFieldError().should('not.be.visible');
106
+ });
101
107
 
102
108
  it('Warn users when setting no password when creating new user admin', () => {
103
- getUsersTable().should('be.visible');
109
+ UserAndAccessSteps.getUsersTable().should('be.visible');
104
110
  createUser("adminWithNoPassword", PASSWORD, ROLE_CUSTOM_ADMIN);
105
- getUsersTable().should('be.visible');
106
- cy.get('.ot-splash').should('not.be.visible');
107
- deleteUser("adminWithNoPassword");
111
+ UserAndAccessSteps.getUsersTable().should('be.visible');
112
+ UserAndAccessSteps.getSplashLoader().should('not.be.visible');
113
+ UserAndAccessSteps.deleteUser("adminWithNoPassword");
108
114
  });
109
115
 
110
- function getCreateNewUserButton() {
111
- return cy.get('#wb-users-userCreateLink');
112
- }
113
-
114
- function getToggleSecuritySwitch() {
115
- return cy.get('#toggle-security span.switch');
116
- }
117
-
118
- function getUsersTable() {
119
- return cy.get('#wb-users-userInUsers');
120
- }
121
-
122
- function findUserInTable(username) {
123
- return getUsersTable().find(`tbody .username:contains(${username})`)
124
- .closest('tr').as('user');
125
- }
126
-
127
- function getUsernameField() {
128
- return cy.get('#wb-user-username');
129
- }
130
-
131
- function getPasswordField() {
132
- return cy.get('#wb-user-password');
133
- }
134
-
135
- function getConfirmPasswordField() {
136
- return cy.get('#wb-user-confirmpassword');
137
- }
138
-
139
- function getConfirmUserCreateButton() {
140
- return cy.get('#wb-user-submit');
141
- }
142
-
143
- function getRoleRadioButton(userRole) {
144
- return cy.get(userRole);
145
- }
146
-
147
- function getRepoitoryRightsList() {
148
- return cy.get('#user-repos');
149
- }
150
-
151
116
  function createUser(username, password, role) {
152
- getCreateNewUserButton().click();
153
- getUsernameField().type(username);
154
- getPasswordField().type(password);
155
- getConfirmPasswordField().type(password);
156
- getRoleRadioButton(role).click();
117
+ UserAndAccessSteps.clickCreateNewUserButton();
118
+ UserAndAccessSteps.typeUsername(username);
119
+ UserAndAccessSteps.typePassword(password);
120
+ UserAndAccessSteps.typeConfirmPasswordField(password);
121
+ UserAndAccessSteps.selectRoleRadioButton(role);
157
122
  if (role === "#roleUser") {
158
- getRepoitoryRightsList().contains('Any data repository').nextUntil('.write').eq(1).within(() => {
159
- cy.get('.write').click();
123
+ UserAndAccessSteps.getRepositoryRightsList().contains('Any data repository').nextUntil('.write').eq(1).within(() => {
124
+ UserAndAccessSteps.clickWriteAccess();
160
125
  });
161
- getConfirmUserCreateButton().click();
126
+ UserAndAccessSteps.confirmUserCreate();
162
127
  } else if (role === "#roleAdmin" && username === "adminWithNoPassword") {
163
- cy.get('#noPassword:checkbox').check()
128
+ UserAndAccessSteps.getNoPasswordCheckbox().check()
164
129
  .then(() => {
165
- cy.get('#noPassword:checkbox')
130
+ UserAndAccessSteps.getNoPasswordCheckbox()
166
131
  .should('be.checked');
167
132
  });
168
- getConfirmUserCreateButton().click()
133
+ UserAndAccessSteps.getConfirmUserCreateButton().click()
169
134
  .then(() => {
170
- cy.get('.modal-dialog').find('.lead').contains('If the password is unset and security is enabled, this administrator will not be ' +
135
+ UserAndAccessSteps.getDialogText().contains('If the password is unset and security is enabled, this administrator will not be ' +
171
136
  'able to log into GraphDB through the workbench. Are you sure that you want to continue?');
172
- cy.get('.modal-dialog').find('.confirm-btn').click();
137
+ UserAndAccessSteps.confirmInDialog();
173
138
  });
174
139
  } else {
175
- getConfirmUserCreateButton().click();
140
+ UserAndAccessSteps.confirmUserCreate();
176
141
  }
177
- cy.get('.ot-splash').should('not.be.visible');
178
- getUsersTable().should('contain', username);
179
- }
180
-
181
- function deleteUser(username) {
182
- findUserInTable(username);
183
- cy.get('@user')
184
- .should('have.length', 1)
185
- .within(() => {
186
- cy.get('.delete-user-btn')
187
- .as('deleteBtn');
188
- });
189
- return cy.waitUntil(() =>
190
- cy.get('@deleteBtn')
191
- .then((deleteBtn) => deleteBtn && Cypress.dom.isAttached(deleteBtn) && deleteBtn.trigger('click')))
192
- .then(() => {
193
- cy.get('.confirm-btn').click();
194
- });
142
+ UserAndAccessSteps.getSplashLoader().should('not.be.visible');
143
+ UserAndAccessSteps.getUsersTable().should('contain', username);
195
144
  }
196
145
 
197
- function loginWithUser(username, password) {
198
- cy.get('#wb-login-username').type(username);
199
- cy.get('#wb-login-password').type(password);
200
- cy.get('#wb-login-submitLogin').click();
201
- }
202
-
203
- function logout() {
204
- cy.get('#btnGroupDrop2').click();
205
- cy.get('.dropdown-item')
206
- .contains('Logout')
207
- .closest('a')
208
- // Force the click because Cypress sometimes determines that the item has 0x0 dimensions
209
- .click({force: true});
146
+ function testForUser(name, isAdmin) {
147
+ //enable security
148
+ UserAndAccessSteps.toggleSecurity();
149
+ //login new user
150
+ UserAndAccessSteps.loginWithUser(name, PASSWORD);
151
+ //verify permissions
152
+ UserAndAccessSteps.getUrl().should('include', '/users');
153
+ if (isAdmin) {
154
+ UserAndAccessSteps.getUsersTable().should('be.visible');
155
+ } else {
156
+ UserAndAccessSteps.getError().should('contain',
157
+ 'You have no permission to access this functionality with your current credentials.');
158
+ }
159
+ UserAndAccessSteps.logout();
160
+ //login with the admin
161
+ UserAndAccessSteps.loginWithUser("admin", DEFAULT_ADMIN_PASSWORD);
162
+ UserAndAccessSteps.getSplashLoader().should('not.be.visible');
163
+ UserAndAccessSteps.getUsersTable().should('be.visible');
164
+ //delete new-user
165
+ UserAndAccessSteps.deleteUser(name);
166
+ //disable security
167
+ UserAndAccessSteps.toggleSecurity();//.click({force: true});
168
+ UserAndAccessSteps.getSecuritySwitchLabel().should('be.visible').and('contain', 'Security is OFF');
169
+ UserAndAccessSteps.getUsersTable().should('be.visible');
210
170
  }
211
171
  });
@@ -1,14 +1,15 @@
1
1
  import {QueryStubs} from "../../stubs/yasgui/query-stubs";
2
- import {YasguiSteps} from "../../steps/yasgui/yasgui-steps";
2
+ import {PluginTabs, YasguiSteps} from "../../steps/yasgui/yasgui-steps";
3
3
  import {LanguageSelectorSteps} from "../../steps/language-selector-steps";
4
4
  import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
5
5
  import {YasrSteps} from "../../steps/yasgui/yasr-steps";
6
6
  import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
7
+ import {ImportUserDataSteps} from "../../steps/import/import-user-data-steps";
7
8
 
8
9
  describe('Internationalization of ontotext-yasgui-web-component', () => {
9
-
10
+ let repositoryId;
10
11
  beforeEach(() => {
11
- const repositoryId = 'sparql-editor-' + Date.now();
12
+ repositoryId = 'sparql-editor-' + Date.now();
12
13
  QueryStubs.stubQueryCountResponse();
13
14
  cy.createRepository({id: repositoryId});
14
15
  cy.presetRepository(repositoryId);
@@ -16,26 +17,75 @@ describe('Internationalization of ontotext-yasgui-web-component', () => {
16
17
  SparqlEditorSteps.visitSparqlEditorPage();
17
18
  });
18
19
 
20
+ afterEach(() => {
21
+ cy.deleteRepository(repositoryId);
22
+ });
23
+
19
24
  it('Should translate labels when language is changed', () => {
20
- // When I load page I expect all labels to be translated on the default English language.
25
+ // When I load page I expect all labels to be translated to the default English language.
26
+ YasguiSteps.getYasguiModeButton().contains('Editor and results');
27
+
28
+ // When I execute a query I expect labels in table plugin to be translated to the default English language.
29
+ YasqeSteps.executeQuery();
30
+
31
+ // Then I expect label in table plugin to be translated to the default English language.
32
+ YasrSteps.getResultFilter().invoke('attr', 'placeholder').should('contain', 'Filter query results');
33
+
34
+ // When I change language to French
35
+ LanguageSelectorSteps.switchToFr();
36
+
37
+ // Then confirm the language change
38
+ LanguageSelectorSteps.confirmLanguageChange();
39
+
40
+ // Then I expect labels to be translated in French language
41
+ PluginTabs.getGoogleChartsTab().should('contain.text', 'Graphique Google');
42
+ YasguiSteps.getYasguiModeButton().contains('Éditeur et résultats');
43
+
44
+ // And I expect label in table plugin to be translated in French language.
45
+ YasrSteps.getResultFilter().invoke('attr', 'placeholder').should('contain', 'Filtrer les résultats des requêtes');
46
+ });
47
+
48
+ it('Should not translate when language change is cancelled', () => {
49
+ // When I load page I expect all labels to be translated on the default English language
21
50
  YasguiSteps.getYasguiModeButton().contains('Editor and results');
22
51
 
23
- // When I execute a query I expect labels in table plugin to be translated on the default English language.
52
+ // When I execute a query I expect labels in table plugin to be translated in the default English language
24
53
  YasqeSteps.executeQuery();
25
54
 
26
- // Then I expect label in table plugin to be translated on the default English language.
55
+ // Then I expect label in table plugin to be translated in the default English language
27
56
  YasrSteps.getResultFilter().invoke('attr', 'placeholder').should('contain', 'Filter query results');
28
57
 
29
- // When I change language to French.
58
+ // When I change language to French
30
59
  LanguageSelectorSteps.switchToFr();
31
- // Yasgui re-renders all DOM elements to shows the new labels. This includes the plugins of yasr which is time-consuming.
32
- // We have to wait a bit because cypress is too fast and grabs the old element (with the old label) and the test fails.
33
- cy.wait(500);
34
60
 
35
- // Then I expect labels to be translated on French language.
61
+ // Then cancel the language change
62
+ LanguageSelectorSteps.cancelLanguageChange();
63
+
64
+ // Then I expect labels to be in English
65
+ YasguiSteps.getYasguiModeButton().contains('Editor and results');
66
+
67
+ // And I expect label in table plugin to remain in English
68
+ YasrSteps.getResultFilter().invoke('attr', 'placeholder').should('contain', 'Filter query results');
69
+ });
70
+
71
+ it('Should translate labels when language is changed in another view', () => {
72
+ // Given I open the Import page
73
+ ImportUserDataSteps.visitImport('user', repositoryId);
74
+
75
+ // When I change language to French
76
+ LanguageSelectorSteps.switchToFr();
77
+
78
+ // And return to the SPARQL view
79
+ SparqlEditorSteps.visitSparqlEditorPage();
80
+
81
+ // When I execute a query
82
+ YasqeSteps.executeQuery();
83
+
84
+ // Then I expect labels to be translated to French
85
+ PluginTabs.getGoogleChartsTab().should('contain.text', 'Graphique Google');
36
86
  YasguiSteps.getYasguiModeButton().contains('Éditeur et résultats');
37
87
 
38
- // And I expect label in table plugin to be translated on French language.
88
+ // And I expect label in table plugin to be translated to French
39
89
  YasrSteps.getResultFilter().invoke('attr', 'placeholder').should('contain', 'Filtrer les résultats des requêtes');
40
90
  });
41
91
  });
@@ -1,9 +1,10 @@
1
1
  import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
2
2
  import {TabContextMenu, YasguiSteps} from "../../steps/yasgui/yasgui-steps";
3
3
  import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
4
- import {YasrSteps} from "../../steps/yasgui/yasr-steps";
5
4
  import {ConfirmationDialogSteps} from "../../steps/yasgui/confirmation-dialog-steps";
6
5
  import {QueryStubs} from "../../stubs/yasgui/query-stubs";
6
+ import {MainMenuSteps} from "../../steps/main-menu-steps";
7
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
7
8
 
8
9
  describe('Yasgui tabs', () => {
9
10
 
@@ -97,6 +98,19 @@ describe('Yasgui tabs', () => {
97
98
  YasguiSteps.getTabs().should('have.length', 1);
98
99
  YasguiSteps.getCurrentTabTitle().should('have.text', 'Unnamed 1');
99
100
  });
101
+
102
+ it('Should display information about ongoing requests if try to navigate to other page when there is a tab with ongoing request', () => {
103
+ // When I execute a long-running query,
104
+ QueryStubs.stubLongRunningQuery(repositoryId);
105
+ SparqlEditorSteps.visitSparqlEditorPage();
106
+ YasqeSteps.executeQueryWithoutWaiteResult();
107
+ // and try to navigate to other page.
108
+ MainMenuSteps.clickOnMenuImport();
109
+
110
+ // Then I expect to see confirm dialog that explain me about ongoing query.
111
+ ModalDialogSteps.getDialog().should('be.visible');
112
+ ModalDialogSteps.getDialogBody().contains('You have running 1 query, that will be aborted.');
113
+ });
100
114
  });
101
115
 
102
116
  function openNewTab(expectedTabsCount) {
@@ -2,6 +2,8 @@ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
2
2
  import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
3
3
  import {YasrSteps} from "../../../steps/yasgui/yasr-steps";
4
4
  import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
5
+ import {JsonLdModalSteps} from "../../../steps/json-ld-modal-steps";
6
+ import {GraphsOverviewSteps} from "../../../steps/explore/graphs-overview-steps";
5
7
 
6
8
  describe('Download results', () => {
7
9
  let repositoryId;
@@ -50,5 +52,74 @@ describe('Download results', () => {
50
52
  YasrSteps.getDownloadAsOption(6).contains( 'TSV*');
51
53
  YasrSteps.getDownloadAsOption(7).contains( 'Binary RDF Results');
52
54
  });
55
+
56
+ it('should download as JSON-LD after a CONSTRUCT query', () => {
57
+ // Given I execute a CONSTRUCT query
58
+ pasteAndExecuteConstructQuery();
59
+ // And I open the download dropdown
60
+ YasrSteps.openDownloadAsDropdown();
61
+ // Then the second option should be JSON-LD
62
+ YasrSteps.getDownloadAsOption(1).contains( 'JSON-LD');
63
+ // When I select it
64
+ YasrSteps.selectDownloadAsOption(1);
65
+ // The dialog for download should appear
66
+ JsonLdModalSteps.getJSONLDModal().should('be.visible');
67
+ // Then I see the default settings
68
+ JsonLdModalSteps.getSelectedJSONLDModeField().should('have.value', 'http://www.w3.org/ns/json-ld#expanded');
69
+ // When I click to export
70
+ JsonLdModalSteps.clickExportJSONLD();
71
+ // Then the dialog should disappear
72
+ JsonLdModalSteps.getJSONLDModal().should('not.exist');
73
+ // And the file should have downloaded
74
+ // TODO: verify the file exists
75
+ // JsonLdModalSteps.verifyFileExists('query-result.jsonld');
76
+
77
+ // When I open the dialog again
78
+ YasrSteps.selectDownloadAsOption(1);
79
+ // And I change the JSON-LD form
80
+ GraphsOverviewSteps.selectJSONLDMode(0);
81
+ // And type in a context
82
+ JsonLdModalSteps.typeJSONLDFrame('https://w3c.github.io/json-ld-api/tests/compact/0007-context.jsonld');
83
+ // And export
84
+ JsonLdModalSteps.clickExportJSONLD();
85
+ JsonLdModalSteps.getJSONLDModal().should('not.exist');
86
+ // Then the file should have downloaded
87
+ // TODO: verify the file exists
88
+ // JsonLdModalSteps.verifyFileExists('query-result.jsonld');
89
+ });
90
+
91
+ it('should download as JSON-LD after a CONSTRUCT query, with context added', () => {
92
+ // Given I execute a CONSTRUCT query
93
+ pasteAndExecuteConstructQuery();
94
+ // And I open the download dropdown
95
+ YasrSteps.openDownloadAsDropdown();
96
+ // Then the second option should be JSON-LD
97
+ YasrSteps.getDownloadAsOption(1).contains( 'JSON-LD');
98
+ // When I select it
99
+ YasrSteps.selectDownloadAsOption(1);
100
+ // And I change the JSON-LD form
101
+ GraphsOverviewSteps.selectJSONLDMode(0);
102
+ // And type in a context
103
+ JsonLdModalSteps.typeJSONLDFrame('https://w3c.github.io/json-ld-api/tests/compact/0007-context.jsonld');
104
+ // And export
105
+ JsonLdModalSteps.clickExportJSONLD();
106
+ JsonLdModalSteps.getJSONLDModal().should('not.exist');
107
+ // Then the file should have downloaded
108
+ // TODO: verify the file exists
109
+ // JsonLdModalSteps.verifyFileExists('query-result.jsonld');
110
+ });
53
111
  });
54
112
  });
113
+
114
+ function pasteAndExecuteConstructQuery() {
115
+ YasqeSteps.clearEditor();
116
+ YasqeSteps.pasteQuery('PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>' +
117
+ 'PREFIX onto: <http://www.ontotext.com/>' +
118
+ 'CONSTRUCT {' +
119
+ '?source rdf:type ?destination .' +
120
+ '} WHERE {' +
121
+ '?bag rdf:type ?source .' +
122
+ '?flight rdf:type ?destination' +
123
+ '}');
124
+ YasqeSteps.executeQuery();
125
+ }