graphdb-workbench-tests 2.5.1 → 2.6.0-RC2

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 (114) hide show
  1. package/fixtures/graphdb-import/resource-test-data.ttl +99 -0
  2. package/fixtures/graphql-editor/default-query-response.json +517 -0
  3. package/fixtures/guides/guides.json +764 -0
  4. package/fixtures/guides/movies.ttl +629 -0
  5. package/fixtures/guides/starwars.ttl +4384 -0
  6. package/fixtures/locale-en.json +53 -12
  7. package/fixtures/namespaces/ontotext-generated-namespace.json +22 -0
  8. package/fixtures/queries/empty-query-response.json +11 -0
  9. package/integration/cluster/cluster-management.spec.js +1 -2
  10. package/integration/explore/graphs.overview.spec.js +4 -2
  11. package/integration/explore/similariti-index-create.spec.js +333 -0
  12. package/integration/explore/similarity-index.spec.js +88 -0
  13. package/integration/explore/similarity.spec.js +180 -56
  14. package/integration/explore/visual-graph/graphs-config.spec.js +453 -0
  15. package/integration/explore/{visual.graph.spec.js → visual-graph/visual.graph.spec.js} +146 -347
  16. package/integration/guides/movies-interactive-guide.spec.js +73 -0
  17. package/integration/guides/star-wars-interactive-guide.js +60 -0
  18. package/integration/home/language-change.spec.js +3 -3
  19. package/integration/import/import.user.data.spec.js +2 -0
  20. package/integration/resource/resource.spec.js +357 -0
  21. package/integration/setup/aclmanagement/create-rule.spec.js +88 -11
  22. package/integration/setup/aclmanagement/delete-rule.spec.js +6 -4
  23. package/integration/setup/aclmanagement/edit-rule.spec.js +13 -8
  24. package/integration/setup/aclmanagement/render-rules.spec.js +4 -2
  25. package/integration/setup/aclmanagement/reorder-rules.spec.js +5 -3
  26. package/integration/setup/aclmanagement/revert-rules.spec.js +4 -3
  27. package/integration/setup/aclmanagement/scopes.spec.js +228 -0
  28. package/integration/setup/aclmanagement/update-rules.spec.js +17 -9
  29. package/integration/setup/jdbc-create.spec.js +330 -0
  30. package/integration/setup/jdbc.spec.js +78 -154
  31. package/integration/setup/my-settings.spec.js +9 -41
  32. package/integration/setup/sparql-template-create.js +150 -0
  33. package/integration/setup/sparql-templates.spec.js +82 -146
  34. package/integration/sparql-editor/actions/execute-query.spec.js +44 -0
  35. package/integration/sparql-editor/actions/expand-results-over-sameas.spec.js +136 -0
  36. package/integration/sparql-editor/actions/include-inferred-statements.spec.js +100 -0
  37. package/integration/sparql-editor/actions/inferred-sameas.spec.js +47 -0
  38. package/integration/sparql-editor/actions/save-query.spec.js +70 -0
  39. package/integration/sparql-editor/actions/show-saved-queries.spec.js +61 -0
  40. package/integration/sparql-editor/internationalization.spec.js +41 -0
  41. package/integration/sparql-editor/saved-query/abort-query.spec.js +51 -0
  42. package/integration/sparql-editor/saved-query/delete-query.spec.js +56 -0
  43. package/integration/sparql-editor/saved-query/edit-query.spec.js +68 -0
  44. package/integration/sparql-editor/saved-query/share-query.spec.js +78 -0
  45. package/integration/sparql-editor/sparql-editor.spec.js +55 -0
  46. package/integration/sparql-editor/yasgui-tabs.spec.js +107 -0
  47. package/integration/sparql-editor/yasr/download-as.spec.js +54 -0
  48. package/integration/sparql-editor/yasr/pagination.spec.js +234 -0
  49. package/integration/sparql-editor/yasr/table-plugin.spec.js +39 -0
  50. package/integration/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +57 -0
  51. package/integration-flaky/explore/visual.graph.spec.js +3 -2
  52. package/integration-flaky/setup/sparql-template-create.js +139 -0
  53. package/integration-flaky/sparql-editor/actions/execute-update-query.spec.js +89 -0
  54. package/integration-flaky/sparql-editor/actions/share-query.spec.js +84 -0
  55. package/integration-flaky/sparql-editor/lucene-connector.spec.js +62 -0
  56. package/integration-flaky/sparql-editor/plugins/error-plugin.spec.js +83 -0
  57. package/integration-flaky/sparql-editor/yasr/table-plugin.spec.js +81 -0
  58. package/package.json +3 -1
  59. package/steps/application-steps.js +5 -0
  60. package/steps/autocomplete-steps.js +10 -0
  61. package/steps/error-steps.js +9 -0
  62. package/steps/explore/graphs-overview-steps.js +24 -0
  63. package/steps/explore/similarity-index-create-steps.js +113 -0
  64. package/steps/explore/similarity-indexes-steps.js +18 -0
  65. package/steps/guides/guide-dialog-steps.js +38 -0
  66. package/steps/guides/guide-steps.js +278 -0
  67. package/steps/guides/movies-guide-steps.js +241 -0
  68. package/steps/guides/star-wars-guide-steps.js +188 -0
  69. package/steps/import-steps.js +16 -0
  70. package/steps/language-selector-steps.js +22 -0
  71. package/steps/loader-steps.js +10 -0
  72. package/steps/lucene-connector-steps.js +43 -0
  73. package/steps/main-menu-steps.js +67 -0
  74. package/steps/repository-selector-steps.js +26 -0
  75. package/steps/repository-steps.js +4 -0
  76. package/steps/resource/resource-edit-steps.js +111 -0
  77. package/steps/resource/resource-steps.js +149 -0
  78. package/steps/setup/acl-management-steps.js +201 -39
  79. package/steps/setup/jdbc-create-steps.js +97 -0
  80. package/steps/setup/jdbc-steps.js +42 -0
  81. package/steps/setup/sparql-create-update-steps.js +55 -0
  82. package/steps/setup/sparql-templates-steps.js +38 -0
  83. package/steps/sparql-editor-steps.js +20 -0
  84. package/steps/sparql-steps.js +0 -6
  85. package/steps/visual-graph-steps.js +365 -6
  86. package/steps/yasgui/confirmation-dialog-steps.js +13 -0
  87. package/steps/yasgui/pagination-steps.js +47 -0
  88. package/steps/yasgui/plugin/error-plugin-steps.js +30 -0
  89. package/steps/yasgui/save-query-dialog.js +61 -0
  90. package/steps/yasgui/saved-queries-dialog.js +29 -0
  91. package/steps/yasgui/saved-query.js +25 -0
  92. package/steps/yasgui/share-saved-query-dialog.js +25 -0
  93. package/steps/yasgui/table-plugin-steps.js +29 -0
  94. package/steps/yasgui/yasgui-loader.js +10 -0
  95. package/steps/yasgui/yasgui-steps.js +191 -0
  96. package/steps/yasgui/yasqe-steps.js +187 -0
  97. package/steps/yasgui/yasr-steps.js +108 -0
  98. package/stubs/namespace-stubs.js +10 -0
  99. package/stubs/repositories-stub.js +58 -0
  100. package/stubs/security-stubs.js +69 -0
  101. package/stubs/yasgui/connectors-stubs.js +12 -0
  102. package/stubs/yasgui/query-stubs.js +253 -0
  103. package/support/index.js +3 -0
  104. package/support/repository-commands.js +5 -5
  105. package/support/sparql-commands.js +1 -1
  106. package/support/visual-graph-commands.js +25 -0
  107. package/integration/sparql/main.menu.spec.js +0 -232
  108. package/integration/sparql/sparql-error-handling.spec.js +0 -74
  109. package/integration/sparql/sparql-language-change.spec.js +0 -58
  110. package/integration/sparql/sparql-result-formating.spec.js +0 -84
  111. package/integration/sparql/sparql.menu.spec.js +0 -1253
  112. package/integration-flaky/setup/sparql-templates.spec.js +0 -125
  113. package/integration-flaky/sparql/sparql-language-change.spec.js +0 -45
  114. package/integration-flaky/sparql/sparql.menu.spec.js +0 -75
@@ -1,19 +1,9 @@
1
+ import {JdbcSteps} from "../../steps/setup/jdbc-steps";
2
+ import {JdbcCreateSteps} from "../../steps/setup/jdbc-create-steps";
3
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
4
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
5
+
1
6
  const FILE_TO_IMPORT = '200-row-allianz.ttl';
2
- const JDBC_CONFIG_NAME = 'jdbc_config';
3
- const QUERY = "PREFIX ex:<http://example.com/#>\n" +
4
- "PREFIX base:<http://example/base/>\n" +
5
- "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>\n" +
6
- "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
7
- "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
8
- "\n" +
9
- "select ?id ?sentiment_score ?fraud_score ?customer_loyalty where { \n" +
10
- "\t?id rdf:type ex:Customer;\n" +
11
- " \tex:sentiment ?sentiment_score;\n" +
12
- " \tex:fraudScore ?fraud_score;\n" +
13
- " \tex:customerLoyalty ?customer_loyalty_id.\n" +
14
- " ?customer_loyalty_id rdfs:label ?customer_loyalty.\n" +
15
- " # !filter\n" +
16
- "} ";
17
7
  const EDIT_QUERY = "PREFIX ex:<http://example.com/#>\n" +
18
8
  "PREFIX base:<http://example/base/>\n" +
19
9
  "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>\n" +
@@ -37,170 +27,104 @@ describe('JDBC configuration', () => {
37
27
  cy.createRepository({id: repositoryId});
38
28
  cy.presetRepository(repositoryId);
39
29
  cy.importServerFile(repositoryId, FILE_TO_IMPORT);
40
- cy.visit('/jdbc');
41
- cy.window();
30
+ JdbcSteps.visit();
42
31
  });
43
32
 
44
33
  afterEach(() => {
45
34
  cy.deleteRepository(repositoryId);
46
35
  });
47
36
 
48
- it('Configuration table preview', () => {
49
- // SQL configuration table should be visible
50
- getConfigurationList().should('be.visible');
51
- });
37
+ it('Should not create a new JDBC configuration click on cancel button', () => {
38
+ // When I am on JDBC configurations page and click on create a new table configuration button.
39
+ JdbcSteps.clickOnCreateJdbcConfigurationButton();
52
40
 
53
- it('Should create a new JDBC configuration, edit, preview, then delete', () => {
54
- getCreateNewJDBCConfigurationButon().click();
55
- cy.pasteQuery(QUERY);
56
- getJDBCConfigNameField().type(JDBC_CONFIG_NAME);
57
-
58
- // switch to SQL columns config tab
59
- getColumnTypesTab().click();
60
- // verify columns length and content
61
- getSQLTableRows().should('have.length', 4);
62
- getSQLTableConfig()
63
- .should('be.visible')
64
- .and('contain', 'sentiment_score');
65
-
66
- getSaveButton().click();
67
- // verify config is created
68
- getConfigurationList().should('contain', JDBC_CONFIG_NAME);
69
- getEditButton().click();
70
- // used to verify that the input field is active
71
- typeQuery("{downarrow}");
72
-
73
- getPreviewButton().click();
74
- getLoader().should('not.exist');
75
-
76
- // verify results content
77
- getPreviewTable()
78
- .should('be.visible')
79
- .and('contain', 'SENTIMENT_SCORE')
80
- .and('contain', 'CUSTOMER_LOYALTY')
81
- .and('contain', 'ID')
82
- .and('contain', 'FRAUD_SCORE');
83
-
84
- // clear current query and paste the edited one, to test the suggest functionality
85
- clearQuery();
86
- cy.pasteQuery(EDIT_QUERY);
87
- getColumnTypesTab().click();
88
- // click suggest button to update the changes from the second query
89
- getSuggestButton().click();
90
- getConfirmSuggestButton().click();
91
- // verify columns length and content
92
- getSQLTableRows().should('have.length', 3);
93
- getSQLTableConfig()
94
- .should('be.visible')
95
- .and('not.contain', 'sentiment_score');
96
- getSaveButton().click();
97
-
98
- getEditButton().click();
99
- // Verify that changes have been applied upon saving
100
- // used to verify that the input field is active
101
- typeQuery("{downarrow}");
102
- getPreviewButton().click();
103
- getLoader().should('not.exist');
104
-
105
- // verify results content
106
- getPreviewTable()
107
- .should('be.visible')
108
- .and('contain', 'ID')
109
- .and('contain', 'FRAUD_SCORE')
110
- .and('contain', 'CUSTOMER_LOYALTY');
111
-
112
- getCancelButton().click();
113
- // Delete jdbc configuration
114
- cy.get('.jdbc-list-configurations').should('be.visible');
115
- getDeleteButton().click();
116
- getConfirmDialogButton().click();
117
- getConfigurationList().should('contain', 'No tables are defined');
118
- });
119
- });
41
+ // Then I expect to be redirected to create JDBC configuration page.
42
+ JdbcCreateSteps.verifyUrl();
120
43
 
121
- function getCreateNewJDBCConfigurationButon() {
122
- return cy.get('.create-sql-table-configuration');
123
- }
44
+ // When I fill correct data,
45
+ JdbcCreateSteps.typeTableName('JdbcTest');
46
+ JdbcCreateSteps.openColumnTypesTab();
124
47
 
125
- function getJDBCConfigNameField() {
126
- return cy.get('.sql-table-name');
127
- }
48
+ // And click on cancel button.
49
+ JdbcCreateSteps.clickOnCancel();
128
50
 
129
- function getQueryArea() {
130
- return cy.get('.CodeMirror');
131
- }
51
+ // Then, I expect to be asked to confirm the cancellation.
52
+ // When I confirm
53
+ ModalDialogSteps.clickOnConfirmButton();
132
54
 
133
- function getQueryTextArea() {
134
- return getQueryArea().find('textarea');
135
- }
55
+ // Then I expect to be redirected to Jdbc configurations page,
56
+ JdbcSteps.verifyUrl();
57
+ // and the configuration to not be created.
58
+ JdbcSteps.getJDBCConfigurations().should('contain', 'No tables are defined');
59
+ });
136
60
 
137
- function typeQuery(query) {
138
- // getQueryTextArea().invoke('val', query).trigger('change', {force: true});
139
- getQueryTextArea().type(query, {force: true});
140
- cy.waitUntilQueryIsVisible();
141
- }
61
+ it('Should create a new JDBC configuration, edit, preview, then delete', () => {
62
+ // When I am on JDBC configurations page and click on create a new table configuration button.
63
+ JdbcSteps.clickOnCreateJdbcConfigurationButton();
64
+
65
+ // Then I expect to be redirected to create JDBC configuration page.
66
+ JdbcCreateSteps.verifyUrl();
142
67
 
143
- function clearQuery() {
144
- // Using force because the textarea is not visible
145
- getQueryTextArea().type(Cypress.env('modifierKey') + 'a{backspace}', {force: true});
146
- }
68
+ // When I fill correct data,
69
+ JdbcCreateSteps.typeTableName('JdbcTest');
70
+ // and columns are selected.
71
+ JdbcCreateSteps.openColumnTypesTab();
72
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 2);
147
73
 
148
- function getColumnTypesTab() {
149
- return cy.get('.nav-tabs').contains("Column types");
150
- }
74
+ // And click on save button.
75
+ JdbcCreateSteps.clickOnSave();
151
76
 
152
- function getDataQueryTab() {
153
- return cy.get('.nav-tabs').contains("Data query");
154
- }
77
+ // Then I expect to be redirected to Jdbc configurations page,
78
+ JdbcSteps.verifyUrl();
79
+ // and the configuration not be created.
80
+ JdbcSteps.getJDBCConfigurationResults().should('have.length', 1);
155
81
 
156
- function getSaveButton() {
157
- return cy.get('.save-query-btn');
158
- }
82
+ // When I click on edit button,
83
+ JdbcSteps.clickOnEditButton();
84
+ // change the query,
85
+ YasqeSteps.pasteQuery(EDIT_QUERY);
86
+ // and click on save button.
87
+ JdbcCreateSteps.clickOnSave();
159
88
 
160
- function getDeleteButton() {
161
- return cy.get('.icon-trash');
162
- }
89
+ // Then I expect to be redirected to JDBC configurations page.
90
+ JdbcSteps.verifyUrl();
163
91
 
164
- function getCancelButton() {
165
- return cy.get('.cancel-query-btn');
166
- }
92
+ // When I click on delete button.
93
+ JdbcSteps.clickOnDeleteButton();
167
94
 
168
- function getConfirmDialogButton() {
169
- return cy.get('.btn-primary');
170
- }
95
+ // Then I expect to be asked to confirm the deletion,
96
+ // and click on close dialog button.
97
+ ModalDialogSteps.clickOnCloseButton();
171
98
 
172
- function getConfigurationList() {
173
- return cy.get('.jdbc-list-configurations');
174
- }
99
+ // Then I expect configuration to not be deleted.
100
+ JdbcSteps.getJDBCConfigurationResults().should('have.length', 1);
175
101
 
176
- function getEditButton() {
177
- return cy.get('.icon-edit');
178
- }
102
+ // When I click on delete button.
103
+ JdbcSteps.clickOnDeleteButton();
179
104
 
180
- function getSQLTableRows() {
181
- return cy.get('div.form-group.row.pt-1.ng-scope');
182
- }
105
+ // Then I expect to be asked to confirm the deletion,
106
+ // and click on cancel dialog button.
107
+ ModalDialogSteps.clickOnCancelButton();
183
108
 
184
- function getPreviewButton() {
185
- return cy.get('.preview-btn');
186
- }
109
+ // Then I expect configuration to not be deleted.
110
+ JdbcSteps.getJDBCConfigurationResults().should('have.length', 1);
187
111
 
188
- function getSuggestButton() {
189
- return cy.get('.sql-table-config .preview-btn');
190
- }
112
+ // When I click on delete button.
113
+ JdbcSteps.clickOnDeleteButton();
191
114
 
192
- function getConfirmSuggestButton() {
193
- return cy.get('.confirm-btn');
194
- }
115
+ // Then I expect to be asked to confirm the deletion,
116
+ // and click on cancel dialog button.
117
+ ModalDialogSteps.clickOnCancelButton();
195
118
 
196
- function getLoader() {
197
- return cy.get('.ot-loader-new-content');
198
- }
119
+ // When I click on delete button.
120
+ JdbcSteps.clickOnDeleteButton();
199
121
 
200
- function getPreviewTable() {
201
- return cy.get('.resultsTable');
202
- }
122
+ // Then I expect to be asked to confirm the deletion,
123
+ // and when click on confirm dialog button.
124
+ ModalDialogSteps.clickOnConfirmButton();
203
125
 
204
- function getSQLTableConfig() {
205
- return cy.get('.sql-table-config');
206
- }
126
+ // Then I expect the configuration to be deleted.
127
+ JdbcSteps.getJDBCConfigurations().should('contain', 'No tables are defined');
128
+ });
129
+
130
+ });
@@ -1,3 +1,6 @@
1
+ import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
2
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
3
+
1
4
  describe('My Settings', () => {
2
5
 
3
6
  let repositoryId;
@@ -109,44 +112,17 @@ describe('My Settings', () => {
109
112
  .then(() => {
110
113
  verifyUserSettingsUpdated();
111
114
  //Go to SPARQL editor and verify changes are persisted for the admin user
112
- cy.visit('/sparql');
113
- cy.window();
114
- cy.url().should('contain', `${Cypress.config('baseUrl')}/sparql`);
115
-
116
- waitUntilYASQUEBtnsAreVisible();
115
+ SparqlEditorSteps.visitSparqlEditorPage();
117
116
 
118
117
  //verify disabled default inference, sameAs and total results count
119
- cy.get('#inference')
120
- .should('be.visible')
121
- .find('.icon-2-5x.icon-inferred-off')
122
- .should('be.visible');
123
-
124
- cy.get('#sameAs')
125
- .should('be.visible')
126
- .find('.icon-2-5x.icon-sameas-off')
127
- .should('be.visible');
118
+ YasqeSteps.getIncludeInferredStatementsButton().should('have.class', 'icon-inferred-off');
119
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-off');
128
120
 
129
121
  //clear default query and paste a new one that will generate more than 1000 results
130
- cy.get('#queryEditor .CodeMirror').find('textarea')
131
- .type(Cypress.env('modifierKey') + 'a{backspace}', {force: true});
122
+ YasqeSteps.clearEditor();
123
+ YasqeSteps.pasteQuery(testResultCountQuery);
132
124
 
133
- cy.get('#queryEditor .CodeMirror').find('textarea')
134
- .invoke('val', testResultCountQuery).trigger('change', {force: true})
135
- cy.waitUntilQueryIsVisible();
136
- cy.verifyQueryAreaContains(testResultCountQuery);
137
-
138
- cy.get('#wb-sparql-runQuery')
139
- .should('be.visible')
140
- .and('not.be.disabled').click()
141
- .then(() => {
142
- // Retry until success message is shown
143
- cy.waitUntil(() =>
144
- cy.get('#yasr-inner')
145
- .should('be.visible')
146
- .find('.results-info .text-xs-right')
147
- .find('.results-description')
148
- .then(result => result && result.text().indexOf('Showing results from 1 to 1,000 of at least 1,001') > -1));
149
- });
125
+ YasqeSteps.executeQuery();
150
126
 
151
127
  //return to My Settings to revert the changes
152
128
  visitSettingsView();
@@ -269,14 +245,6 @@ describe('My Settings', () => {
269
245
  return cy.get('#wb-user-submit').scrollIntoView().should('be.visible');
270
246
  }
271
247
 
272
- function waitUntilYASQUEBtnsAreVisible() {
273
- cy.waitUntil(() =>
274
- cy.get('#queryEditor #yasqe_buttons')
275
- .find('#buttons')
276
- .then(buttons =>
277
- buttons && buttons.length > 0));
278
- }
279
-
280
248
  function verifyUserSettingsUpdated() {
281
249
  cy.waitUntil(() =>
282
250
  cy.get('#toast-container')
@@ -0,0 +1,150 @@
1
+ import {SparqlCreateUpdateSteps} from "../../steps/setup/sparql-create-update-steps";
2
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
3
+ import ImportSteps from "../../steps/import-steps";
4
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
5
+ import {MainMenuSteps} from "../../steps/main-menu-steps";
6
+ import {RepositorySelectorSteps} from "../../steps/repository-selector-steps";
7
+ import {SparqlTemplatesSteps} from "../../steps/setup/sparql-templates-steps";
8
+
9
+ describe('SPARQL create template', () => {
10
+
11
+ let repositoryId;
12
+ let secondRepositoryId;
13
+
14
+ beforeEach(() => {
15
+ repositoryId = 'sparql-templates-repo' + Date.now();
16
+ cy.createRepository({id: repositoryId});
17
+ cy.presetRepository(repositoryId);
18
+ secondRepositoryId = 'sparql-templates-second-repo' + Date.now();
19
+ cy.createRepository({id: secondRepositoryId});
20
+ SparqlCreateUpdateSteps.visit();
21
+ });
22
+
23
+ afterEach(() => {
24
+ cy.deleteRepository(repositoryId);
25
+ cy.deleteRepository(secondRepositoryId);
26
+ });
27
+
28
+ it('should has error message described that template id is required', () => {
29
+ // When I visit 'Sparql create template' view,
30
+ // and click on "Save" button without to fill template id.
31
+ SparqlCreateUpdateSteps.clickOnSaveButton();
32
+
33
+ // Then I expect to see error message.
34
+ SparqlCreateUpdateSteps.getRequiredErrorElement().contains('SPARQL template IRI is required');
35
+ });
36
+
37
+ it('should has error message described that template id is invalid', () => {
38
+ // When I visit 'Sparql create template' view,
39
+ // and fill an invalid template id,
40
+ const invalidTemplateName = 'invalid-template-id';
41
+ SparqlCreateUpdateSteps.typeTemplateId(invalidTemplateName);
42
+ // and click on "Save" button without to fill template id.
43
+ SparqlCreateUpdateSteps.clickOnSaveButton();
44
+
45
+ // Then I expect to see error message.
46
+ SparqlCreateUpdateSteps.getInvalidErrorElement().contains(`'${invalidTemplateName}' is not a valid IRI`);
47
+ });
48
+
49
+ it('should has error message described that query mode is invalid', () => {
50
+ // When I visit 'Sparql create template' view,
51
+ // and fill valid template id.
52
+ SparqlCreateUpdateSteps.typeTemplateId('http://test');
53
+
54
+ // When I fill non update query (select for example).
55
+ YasqeSteps.clearEditor();
56
+ YasqeSteps.writeInEditor('select * where {?s ?p ?o}');
57
+ // and click on "Save" button.
58
+ SparqlCreateUpdateSteps.clickOnSaveButton();
59
+
60
+ // Then I expect to see error message.
61
+ SparqlCreateUpdateSteps.getInvalidQueryModeElement().contains('The template query must be an UPDATE query');
62
+ });
63
+
64
+ it('should navigate to other view if there are no changes', () => {
65
+ // When I visit 'Sparql create template' view,
66
+ // and navigate to other view.
67
+ ImportSteps.visitUserImport(repositoryId);
68
+
69
+ // Then I expect to be navigated without confirmation.
70
+ ImportSteps.verifyUserImportUrl();
71
+ });
72
+
73
+ it('should confirm me before navigate when template id is changed', () => {
74
+ // When I visit 'Sparql create template' view,
75
+ // and set template id.
76
+ SparqlCreateUpdateSteps.typeTemplateId('http://test');
77
+
78
+ // When I try to navigate to other view
79
+ MainMenuSteps.clickOnMenu('Import');
80
+
81
+ // Then I expect to see confirm dialog inform me that there are unsaved changes.
82
+ ModalDialogSteps.getDialogHeader().contains('Confirm');
83
+ ModalDialogSteps.getDialogBody().contains('You have unsaved changes. Are you sure that you want to exit?');
84
+
85
+ // When I click on close button
86
+ ModalDialogSteps.clickOnCloseButton();
87
+
88
+ // Then I expect to stay on current page
89
+ SparqlCreateUpdateSteps.verifyUrl();
90
+
91
+ // When I click on cancel button.
92
+ MainMenuSteps.clickOnMenu('Import');
93
+ ModalDialogSteps.clickOnCancelButton();
94
+
95
+ // Then I expect to stay on current page
96
+ SparqlCreateUpdateSteps.verifyUrl();
97
+
98
+ // When I click on confirm button.
99
+ MainMenuSteps.clickOnMenu('Import');
100
+ ModalDialogSteps.clickOnConfirmButton();
101
+
102
+ // Then I expect to be navigated to other view.
103
+ ImportSteps.verifyUserImportUrl();
104
+ });
105
+
106
+ it('should not change the view if I am creating a new sparql template and change the repository', () => {
107
+ // When I visit 'Sparql create template' view,
108
+ // make some changes.
109
+ SparqlCreateUpdateSteps.typeTemplateId('http://test');
110
+ // When I change the repository.
111
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
112
+ // Then I expect the view not changed
113
+ SparqlCreateUpdateSteps.verifyUrl();
114
+ // And I expect to see a confirmation dialog.
115
+ ModalDialogSteps.getDialog().should('be.visible');
116
+ });
117
+
118
+ it('Should redirect to templates catalog view when repository is changed', () => {
119
+ // When I visit 'Sparql create template' view
120
+ // When I change the repository.
121
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
122
+ // Then I expect to be redirected to templates catalog view.
123
+ SparqlTemplatesSteps.verifyUrl();
124
+ SparqlTemplatesSteps.getSparqlTemplatesListContainer().should('be.visible');
125
+ });
126
+
127
+ it('should ask for confirmation when try to save sparql template with already existing template id', () => {
128
+ // When I visit 'Sparql create template' view,
129
+ // create a SPARQL template
130
+ const templateName = 'http://' + Date.now();
131
+ SparqlCreateUpdateSteps.typeTemplateId(templateName);
132
+ SparqlCreateUpdateSteps.clickOnSaveButton();
133
+ SparqlTemplatesSteps.verifyUrl();
134
+
135
+ // When try to create a template with same template IRI
136
+ SparqlCreateUpdateSteps.visit();
137
+ SparqlCreateUpdateSteps.typeTemplateId(templateName);
138
+ SparqlCreateUpdateSteps.clickOnSaveButton();
139
+
140
+ // Then I expect to see confirm dialog.
141
+ ModalDialogSteps.getDialogHeader().contains('Confirm save');
142
+ ModalDialogSteps.getDialogBody().contains('Do you want to override the template query?');
143
+
144
+ // When I click on cancel button.
145
+ ModalDialogSteps.clickOnCancelButton();
146
+
147
+ // Then I expect template to not be saved and stay on sparql template create view.
148
+ SparqlCreateUpdateSteps.verifyUrl();
149
+ });
150
+ });