graphdb-workbench-tests 2.3.1 → 2.4.0-TR1

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 (88) 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/locale-en.json +18 -5
  4. package/fixtures/namespaces/ontotext-generated-namespace.json +22 -0
  5. package/fixtures/queries/empty-query-response.json +11 -0
  6. package/integration/explore/graphs.overview.spec.js +4 -2
  7. package/integration/explore/similariti-index-create.spec.js +315 -0
  8. package/integration/explore/similarity-index.spec.js +88 -0
  9. package/integration/explore/similarity.spec.js +156 -47
  10. package/integration/explore/visual-graph/graphs-config.spec.js +452 -0
  11. package/integration/explore/{visual.graph.spec.js → visual-graph/visual.graph.spec.js} +145 -348
  12. package/integration/home/language-change.spec.js +3 -3
  13. package/integration/import/import.user.data.spec.js +4 -4
  14. package/integration/resource/resource.spec.js +354 -0
  15. package/integration/setup/jdbc-create.spec.js +316 -0
  16. package/integration/setup/jdbc.spec.js +99 -178
  17. package/integration/setup/my-settings.spec.js +9 -41
  18. package/integration/setup/sparql-template-create.js +141 -0
  19. package/integration/setup/sparql-templates.spec.js +82 -146
  20. package/integration/sparql-editor/actions/execute-query.spec.js +44 -0
  21. package/integration/sparql-editor/actions/expand-results-over-sameas.spec.js +136 -0
  22. package/integration/sparql-editor/actions/include-inferred-statements.spec.js +100 -0
  23. package/integration/sparql-editor/actions/save-query.spec.js +70 -0
  24. package/integration/sparql-editor/actions/show-saved-queries.spec.js +61 -0
  25. package/integration/sparql-editor/internationalization.spec.js +41 -0
  26. package/integration/sparql-editor/saved-query/abort-query.spec.js +60 -0
  27. package/integration/sparql-editor/saved-query/delete-query.spec.js +56 -0
  28. package/integration/sparql-editor/saved-query/edit-query.spec.js +68 -0
  29. package/integration/sparql-editor/saved-query/share-query.spec.js +78 -0
  30. package/integration/sparql-editor/sparql-editor.spec.js +20 -0
  31. package/integration/sparql-editor/yasgui-tabs.spec.js +107 -0
  32. package/integration/sparql-editor/yasr/download-as.spec.js +62 -0
  33. package/integration/sparql-editor/yasr/pagination.spec.js +234 -0
  34. package/integration/sparql-editor/yasr/table-plugin.spec.js +191 -0
  35. package/integration/sparql-editor/yasr/toolbar/visual-button.spec.js +56 -0
  36. package/integration-flaky/setup/sparql-template-create.js +139 -0
  37. package/integration-flaky/sparql-editor/actions/execute-update-query.spec.js +89 -0
  38. package/integration-flaky/sparql-editor/actions/share-query.spec.js +84 -0
  39. package/integration-flaky/sparql-editor/lucene-connector.spec.js +62 -0
  40. package/package.json +3 -2
  41. package/steps/application-steps.js +23 -0
  42. package/steps/error-steps.js +9 -0
  43. package/steps/explore/graphs-overview-steps.js +24 -0
  44. package/steps/explore/similarity-index-create-steps.js +113 -0
  45. package/steps/explore/similarity-indexes-steps.js +18 -0
  46. package/steps/import-steps.js +8 -1
  47. package/steps/language-selector-steps.js +22 -0
  48. package/steps/loader-steps.js +10 -0
  49. package/steps/lucene-connector-steps.js +43 -0
  50. package/steps/main-menu-steps.js +39 -0
  51. package/steps/modal-dialog-steps.js +113 -0
  52. package/steps/repository-selector-steps.js +26 -0
  53. package/steps/resource/resource-edit-steps.js +111 -0
  54. package/steps/resource/resource-steps.js +145 -0
  55. package/steps/setup/jdbc-create-steps.js +97 -0
  56. package/steps/setup/jdbc-steps.js +42 -0
  57. package/steps/setup/sparql-create-update-steps.js +55 -0
  58. package/steps/setup/sparql-templates-steps.js +34 -0
  59. package/steps/sparql-editor-steps.js +20 -0
  60. package/steps/visual-graph-steps.js +340 -3
  61. package/steps/yasgui/confirmation-dialog-steps.js +13 -0
  62. package/steps/yasgui/pagination-steps.js +47 -0
  63. package/steps/yasgui/plugin/error-plugin-steps.js +10 -0
  64. package/steps/yasgui/save-query-dialog.js +61 -0
  65. package/steps/yasgui/saved-queries-dialog.js +29 -0
  66. package/steps/yasgui/saved-query.js +25 -0
  67. package/steps/yasgui/share-saved-query-dialog.js +25 -0
  68. package/steps/yasgui/table-plugin-steps.js +29 -0
  69. package/steps/yasgui/yasgui-steps.js +191 -0
  70. package/steps/yasgui/yasqe-steps.js +187 -0
  71. package/steps/yasgui/yasr-steps.js +105 -0
  72. package/stubs/namespace-stubs.js +10 -0
  73. package/stubs/security-stubs.js +69 -0
  74. package/stubs/yasgui/connectors-stubs.js +12 -0
  75. package/stubs/yasgui/query-stubs.js +258 -0
  76. package/support/index.js +2 -0
  77. package/support/repository-commands.js +6 -1
  78. package/support/sparql-commands.js +1 -1
  79. package/support/visual-graph-commands.js +25 -0
  80. package/integration/sparql/main.menu.spec.js +0 -196
  81. package/integration/sparql/sparql-error-handling.spec.js +0 -74
  82. package/integration/sparql/sparql-language-change.spec.js +0 -58
  83. package/integration/sparql/sparql-result-formating.spec.js +0 -84
  84. package/integration/sparql/sparql.menu.spec.js +0 -1244
  85. package/integration-flaky/setup/sparql-templates.spec.js +0 -125
  86. package/integration-flaky/sparql/sparql-language-change.spec.js +0 -45
  87. package/integration-flaky/sparql/sparql.menu.spec.js +0 -75
  88. package/steps/sparql-steps.js +0 -227
@@ -0,0 +1,316 @@
1
+ import {JdbcSteps} from "../../steps/setup/jdbc-steps";
2
+ import {JdbcCreateSteps} from "../../steps/setup/jdbc-create-steps";
3
+ import {ToasterSteps} from "../../steps/toaster-steps";
4
+ import {YasrSteps} from "../../steps/yasgui/yasr-steps";
5
+ import {LoaderSteps} from "../../steps/loader-steps";
6
+ import {ModalDialogSteps, VerifyConfirmationDialogOptions} from "../../steps/modal-dialog-steps";
7
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
8
+ import {MainMenuSteps} from "../../steps/main-menu-steps";
9
+ import {RepositorySelectorSteps} from "../../steps/repository-selector-steps";
10
+
11
+ const FILE_TO_IMPORT = '200-row-allianz.ttl';
12
+ const DEFAULT_QUERY = 'PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n' +
13
+ '\n' +
14
+ '# Selects two variables to use as columns\n' +
15
+ 'SELECT ?id ?label {\n' +
16
+ ' ?id rdfs:label ?label\n' +
17
+ ' # The following placeholder must be present in the query\n' +
18
+ ' #!filter\n' +
19
+ '}';
20
+
21
+ describe('JDBC configuration', () => {
22
+
23
+ let repositoryId;
24
+
25
+ beforeEach(() => {
26
+ repositoryId = 'jdbc-repo-' + Date.now();
27
+ cy.createRepository({id: repositoryId});
28
+ cy.presetRepository(repositoryId);
29
+ cy.importServerFile(repositoryId, FILE_TO_IMPORT);
30
+ JdbcCreateSteps.visit();
31
+ });
32
+
33
+ afterEach(() => {
34
+ cy.deleteRepository(repositoryId);
35
+ });
36
+
37
+ it('should not allow preview if query is invalid or column are not selected', () => {
38
+ // When I open the create JDBC configuration page,
39
+ // and click on "Preview" button.
40
+ JdbcCreateSteps.clickOnPreviewButton();
41
+
42
+ // Then I expect to see error notification,
43
+ ToasterSteps.verifyError('Please define at least one column');
44
+ // and "Column type" tab to be opened,
45
+ JdbcCreateSteps.getActiveTab().contains('Column types');
46
+ // and two columns to be suggested.
47
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 2);
48
+
49
+ // When I click "Preview" again.
50
+ JdbcCreateSteps.clickOnPreviewButton();
51
+
52
+ // Then I expect to see loader,
53
+ LoaderSteps.verifyMessage('Preview of first 100 rows of table');
54
+ // and see the generated preview.
55
+ YasrSteps.getResults().should('be.visible');
56
+ });
57
+
58
+ it('should contains exactly columns in preview than selected in Columns type tag', () => {
59
+ // When I open the create JDBC configuration page,
60
+ JdbcCreateSteps.openColumnTypesTab();
61
+ // waite columns to be suggested,
62
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 2);
63
+ // and make preview on default query.
64
+ JdbcCreateSteps.clickOnPreviewButton();
65
+
66
+ // Then I expect to see three columns. One for index and others are from the query.
67
+ YasrSteps.getResultRowCells(1).should('have.length', 3);
68
+
69
+ // When I try to remove a column.
70
+ JdbcCreateSteps.openColumnTypesTab();
71
+ JdbcCreateSteps.clickOnDeleteColumnButton();
72
+
73
+ // Then I expect to be asked to confirm deletion of the column.
74
+ ModalDialogSteps.verifyDialogBody('Are you sure you want to delete the column \'id\'?');
75
+
76
+ // When I click on cancel button.
77
+ ModalDialogSteps.clickOnCancelButton();
78
+
79
+ // Then I expect the column not be deleted.
80
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 2);
81
+
82
+ // When I try to remove a column.
83
+ JdbcCreateSteps.openColumnTypesTab();
84
+ JdbcCreateSteps.clickOnDeleteColumnButton();
85
+
86
+ // Then I expect to be asked to confirm deletion of the column.
87
+ ModalDialogSteps.verifyDialogBody('Are you sure you want to delete the column \'id\'?');
88
+
89
+ // When I click on close button.
90
+ ModalDialogSteps.clickOnCloseButton();
91
+
92
+ // Then I expect the column not be deleted.
93
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 2);
94
+
95
+ // When I remove a column.
96
+ JdbcCreateSteps.openColumnTypesTab();
97
+ JdbcCreateSteps.clickOnDeleteColumnButton();
98
+
99
+ // Then I expect to be asked to confirm deletion of the column.
100
+ ModalDialogSteps.verifyDialogBody('Are you sure you want to delete the column \'id\'?');
101
+
102
+ // When I click on confirm button.
103
+ ModalDialogSteps.clickOnConfirmButton();
104
+
105
+ // Then I expect the column be deleted.
106
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 1);
107
+
108
+ // When I click on preview button.
109
+ JdbcCreateSteps.clickOnPreviewButton();
110
+
111
+ // Then I expect to see two columns. One for index and one from the query.
112
+ YasrSteps.getResultRowCells(1).should('have.length', 2);
113
+ });
114
+
115
+ it('should suggests me all columns when I click on suggest button', () => {
116
+ // When I open the create JDBC configuration page,
117
+ JdbcCreateSteps.openColumnTypesTab();
118
+ // waite columns to be suggested,
119
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 2);
120
+ // When I remove all columns.
121
+ JdbcCreateSteps.clickOnDeleteColumnButton(0);
122
+ ModalDialogSteps.clickOnConfirmButton();
123
+ JdbcCreateSteps.clickOnDeleteColumnButton(0);
124
+ ModalDialogSteps.clickOnConfirmButton();
125
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 0);
126
+
127
+ // When I click on "Suggest" button.
128
+ JdbcCreateSteps.clickOnSuggestButton();
129
+ // Then I expect all columns to be suggested without confirmation.
130
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 2);
131
+
132
+ // When I click on "Suggest" button when there are selected columns.
133
+ JdbcCreateSteps.clickOnDeleteColumnButton(0);
134
+ ModalDialogSteps.clickOnConfirmButton();
135
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 1);
136
+ JdbcCreateSteps.clickOnSuggestButton();
137
+
138
+ // Then I expect to be asked to confirm the suggestion.
139
+ ModalDialogSteps.verifyDialogBody('Are you sure you want to get suggestions for all columns? This action will overwrite all column type mappings!');
140
+
141
+ // When I click on close button.
142
+ ModalDialogSteps.clickOnCloseButton();
143
+
144
+ // Then I expect suggestion to not be applied.
145
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 1);
146
+
147
+ // When I click on "Suggestion" button.
148
+ JdbcCreateSteps.clickOnSuggestButton();
149
+
150
+ // Then I expect to be asked to confirm the suggestion.
151
+ ModalDialogSteps.verifyDialogBody('Are you sure you want to get suggestions for all columns? This action will overwrite all column type mappings!');
152
+
153
+ // When I click on cancel button.
154
+ ModalDialogSteps.clickOnCancelButton();
155
+
156
+ // Then I expect suggestion to not be applied.
157
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 1);
158
+
159
+ // When I click on "Suggestion" button.
160
+ JdbcCreateSteps.clickOnSuggestButton();
161
+
162
+ // Then I expect to be asked to confirm the suggestion.
163
+ ModalDialogSteps.verifyDialogBody('Are you sure you want to get suggestions for all columns? This action will overwrite all column type mappings!');
164
+
165
+ // When I click on confirm button.
166
+ ModalDialogSteps.clickOnConfirmButton();
167
+
168
+ // Then I expect suggestion to not be applied.
169
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 2);
170
+ });
171
+
172
+ it('should not allow configuration to be saved if some of required fields are not filled', () => {
173
+ // When I open the create JDBC configuration page,
174
+ // and try to save the configuration.
175
+ JdbcCreateSteps.clickOnSave();
176
+
177
+ // Then I expect to see error message describes that configuration name is required.
178
+ JdbcCreateSteps.getJdbcConfigurationNameIsRequired().should('be.visible');
179
+ JdbcCreateSteps.getJdbcConfigurationNameIsRequired().contains('SQL table name is required');
180
+
181
+ // When I type the name of the configuration,
182
+ JdbcCreateSteps.typeTableName('Test table name');
183
+ // and type wrong query,
184
+ YasqeSteps.pasteQuery('Wrong query');
185
+ // and try to save configuration.
186
+ JdbcCreateSteps.clickOnSave();
187
+
188
+ // Then I expect to see error message described that the query must be select query.
189
+ JdbcCreateSteps.getInvalidQueryMode().should('be.visible');
190
+ JdbcCreateSteps.getInvalidQueryMode().contains('The data query must be a SELECT query');
191
+
192
+ // When I type wrong select query
193
+ YasqeSteps.pasteQuery('Select * where {?s ?p ?o ?g}');
194
+ // and try to save the configuration
195
+ JdbcCreateSteps.clickOnSave();
196
+
197
+ // Then I expect to see error message described that the query is not valid.
198
+ JdbcCreateSteps.getInvalidQuery().should('be.visible');
199
+ JdbcCreateSteps.getInvalidQuery().contains('Invalid query');
200
+
201
+ // When I type correct select query
202
+ YasqeSteps.pasteQuery(DEFAULT_QUERY);
203
+ // and try to save the configuration
204
+ JdbcCreateSteps.clickOnSave();
205
+
206
+ // Then I expect to see error message
207
+ ToasterSteps.verifyError('Please define at least one column');
208
+ });
209
+
210
+ it('should not display confirm message when if the fields of configuration are not changed', () => {
211
+ // When I open the create JDBC configuration page,
212
+ // and try to change page
213
+ JdbcSteps.visit();
214
+
215
+ // Then I expect the new page is loaded.
216
+ JdbcSteps.verifyUrl();
217
+ });
218
+
219
+
220
+ it('should display confirm message when configuration name is changed', () => {
221
+ // When I open the create JDBC configuration page,
222
+ // type configuration name,
223
+ JdbcCreateSteps.typeTableName('Configuration name');
224
+ JdbcCreateSteps.getJDBCConfigNameField().should('have.value', 'Configuration name');
225
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
226
+ });
227
+
228
+ it('should display confirm message when the configuration query data is changed', () => {
229
+ // When I open the create JDBC configuration page,
230
+ // type and change the query,
231
+ YasqeSteps.writeInEditor("Some changes");
232
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
233
+ });
234
+
235
+ it('should display confirm message when the selected columns are changed', () => {
236
+ // When I open the create JDBC configuration page,
237
+ // and change selected columns.
238
+ JdbcCreateSteps.openColumnTypesTab();
239
+ JdbcCreateSteps.clickOnDeleteColumnButton(0);
240
+ ModalDialogSteps.clickOnConfirmButton();
241
+ ModalDialogSteps.verifyUrlChangedConfirmation(createVerifyConfirmationDialogOptions());
242
+ });
243
+
244
+ it('should display confirm message when try to change the repository', () => {
245
+ const secondRepositoryId = 'jdbc-repo-second-repo' + Date.now();
246
+ cy.createRepository({id: secondRepositoryId});
247
+
248
+ // When I open a configuration for edit,
249
+ createConfigurationAndOpenInEdit('Test table');
250
+ // Make some changes
251
+ YasqeSteps.writeInEditor('Make changes');
252
+
253
+ // When I try to change the selected repository.
254
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
255
+
256
+ // Then I expect to be asked to confirm changing of repository.
257
+ ModalDialogSteps.verifyDialogBody('You have unsaved changes. Are you sure that you want to exit?');
258
+
259
+ // When I click on close button.
260
+ ModalDialogSteps.clickOnCloseButton();
261
+
262
+ // Then I expect to stay on same page
263
+ JdbcCreateSteps.verifyUrl();
264
+
265
+ // When I try to change the selected repository.
266
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
267
+
268
+ // Then I expect to be asked to confirm changing of repository.
269
+ ModalDialogSteps.verifyDialogBody('You have unsaved changes. Are you sure that you want to exit?');
270
+
271
+ // When I click on cancel button.
272
+ ModalDialogSteps.clickOnCancelButton();
273
+
274
+ // Then I expect to stay on same page
275
+ JdbcCreateSteps.verifyUrl();
276
+
277
+ // When I try to change the selected repository.
278
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
279
+
280
+ // Then I expect to be asked to confirm changing of repository.
281
+ ModalDialogSteps.verifyDialogBody('You have unsaved changes. Are you sure that you want to exit?');
282
+
283
+ // When I click on confirm button.
284
+ ModalDialogSteps.clickOnConfirmButton();
285
+
286
+ // Then I expect to stay on same page
287
+ JdbcSteps.verifyUrl();
288
+
289
+ cy.deleteRepository(secondRepositoryId);
290
+ });
291
+
292
+ function createConfigurationAndOpenInEdit(tableName) {
293
+ JdbcSteps.visit();
294
+ // Creates a configuration.
295
+ JdbcSteps.clickOnCreateJdbcConfigurationButton();
296
+ YasqeSteps.waitUntilQueryIsVisible();
297
+ JdbcCreateSteps.typeTableName(tableName);
298
+ JdbcCreateSteps.openColumnTypesTab();
299
+ // waite selected column to be loaded.
300
+ JdbcCreateSteps.getColumnSuggestionRows().should('have.length', 2);
301
+ JdbcCreateSteps.clickOnSave();
302
+
303
+ ToasterSteps.verifySuccess('SQL table configuration saved');
304
+
305
+ // Opens created configuration for edit.
306
+ JdbcSteps.clickOnEditButton(0);
307
+ }
308
+
309
+ function createVerifyConfirmationDialogOptions() {
310
+ return new VerifyConfirmationDialogOptions()
311
+ .setChangePageFunction(() => MainMenuSteps.clickOnMenuImport())
312
+ .setConfirmationMessage('You have unsaved changes. Are you sure that you want to exit?')
313
+ .setVerifyCurrentUrl(() => cy.url().should('eq', `${Cypress.config('baseUrl')}/jdbc/configuration/create`))
314
+ .setVerifyRedirectedUrl(() => cy.url().should('eq', `${Cypress.config('baseUrl')}/import#user`));
315
+ }
316
+ });
@@ -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" +
@@ -33,177 +23,108 @@ describe('JDBC configuration', () => {
33
23
  let repositoryId;
34
24
 
35
25
  beforeEach(() => {
36
- initRepositoryAndVisitJdbcView();
26
+ repositoryId = 'jdbc-repo-' + Date.now();
27
+ cy.createRepository({id: repositoryId});
28
+ cy.presetRepository(repositoryId);
29
+ cy.importServerFile(repositoryId, FILE_TO_IMPORT);
30
+ JdbcSteps.visit();
37
31
  });
38
32
 
39
33
  afterEach(() => {
40
34
  cy.deleteRepository(repositoryId);
41
35
  });
42
36
 
43
- it('Configuration table preview', () => {
44
- //cy.visit('/jdbc');
45
- // SQL configuration table should be visible
46
- getConfigurationList().should('be.visible');
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();
40
+
41
+ // Then I expect to be redirected to create JDBC configuration page.
42
+ JdbcCreateSteps.verifyUrl();
43
+
44
+ // When I fill correct data,
45
+ JdbcCreateSteps.typeTableName('JdbcTest');
46
+ JdbcCreateSteps.openColumnTypesTab();
47
+
48
+ // And click on cancel button.
49
+ JdbcCreateSteps.clickOnCancel();
50
+
51
+ // Then, I expect to be asked to confirm the cancellation.
52
+ // When I confirm
53
+ ModalDialogSteps.clickOnConfirmButton();
54
+
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');
47
59
  });
48
60
 
49
- //TODO Fix falling test
50
- it.skip('Should create a new JDBC configuration, edit, preview, then delete', () => {
51
- getCreateNewJDBCConfigurationButon().click();
52
- cy.pasteQuery(QUERY);
53
- getJDBCConfigNameField().type(JDBC_CONFIG_NAME);
54
- getColumnTypesTab().click(); //switch to SQL columns config tab
55
-
56
- //verify columns length and content
57
- getSQLTableRows().should('have.length', 4);
58
- getSQLTableConfig()
59
- .should('be.visible')
60
- .and('contain', 'sentiment_score');
61
-
62
- getSaveButton().click();
63
- getConfigurationList().should('contain', JDBC_CONFIG_NAME); //verify config is created
64
- getEditButton().click();
65
-
66
- typeQuery("{downarrow}"); //used to verify that the input field is active
67
- getPreviewButton().click({force:true}); //click preview button
68
- getLoader().should('not.exist');
69
-
70
- //verify results content
71
- getPreviewTable()
72
- .should('be.visible')
73
- .and('contain', 'SENTIMENT_SCORE')
74
- .and('contain', 'CUSTOMER_LOYALTY')
75
- .and('contain', 'ID')
76
- .and('contain', 'FRAUD_SCORE');
77
-
78
- //clear current query and paste the edited one, to test the suggest functionality
79
- clearQuery();
80
- cy.pasteQuery(EDIT_QUERY);
81
- getColumnTypesTab().click();
82
- getSuggestButton().click({force:true}); //click suggest button to update the changes from the second query
83
- getConfirmSuggestButton().click();
84
-
85
- //verify columns length and content
86
- getSQLTableRows().should('have.length', 3);
87
- getSQLTableConfig()
88
- .should('be.visible')
89
- .and('not.contain', 'sentiment_score');
90
- getSaveButton().click();
91
- getEditButton().click();
92
-
93
- //Verify that changes have been applied upon saving
94
- typeQuery("{downarrow}"); //used to verify that the input field is active
95
- getPreviewButton().click({force:true}); //click preview button
96
- getLoader().should('not.exist');
97
-
98
- //verify results content
99
- getPreviewTable()
100
- .should('be.visible')
101
- .and('not.contain', 'SENTIMENT_SCORE')
102
- .and('contain', 'CUSTOMER_LOYALTY')
103
- .and('contain', 'ID')
104
- .and('contain', 'FRAUD_SCORE');
105
- getCancelButton().click();
106
-
107
- //Delete jdbc configuration
108
- cy.get('.jdbc-list-configurations').should('be.visible');
109
- getDeleteButton().click();
110
- getConfirmDialogButton().click();
111
- getConfigurationList().should('contain', 'No Indexes');
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();
67
+
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);
73
+
74
+ // And click on save button.
75
+ JdbcCreateSteps.clickOnSave();
76
+
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);
81
+
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();
88
+
89
+ // Then I expect to be redirected to JDBC configurations page.
90
+ JdbcSteps.verifyUrl();
91
+
92
+ // When I click on delete button.
93
+ JdbcSteps.clickOnDeleteButton();
94
+
95
+ // Then I expect to be asked to confirm the deletion,
96
+ // and click on close dialog button.
97
+ ModalDialogSteps.clickOnCloseButton();
98
+
99
+ // Then I expect configuration to not be deleted.
100
+ JdbcSteps.getJDBCConfigurationResults().should('have.length', 1);
101
+
102
+ // When I click on delete button.
103
+ JdbcSteps.clickOnDeleteButton();
104
+
105
+ // Then I expect to be asked to confirm the deletion,
106
+ // and click on cancel dialog button.
107
+ ModalDialogSteps.clickOnCancelButton();
108
+
109
+ // Then I expect configuration to not be deleted.
110
+ JdbcSteps.getJDBCConfigurationResults().should('have.length', 1);
111
+
112
+ // When I click on delete button.
113
+ JdbcSteps.clickOnDeleteButton();
114
+
115
+ // Then I expect to be asked to confirm the deletion,
116
+ // and click on cancel dialog button.
117
+ ModalDialogSteps.clickOnCancelButton();
118
+
119
+ // When I click on delete button.
120
+ JdbcSteps.clickOnDeleteButton();
121
+
122
+ // Then I expect to be asked to confirm the deletion,
123
+ // and when click on confirm dialog button.
124
+ ModalDialogSteps.clickOnConfirmButton();
125
+
126
+ // Then I expect the configuration to be deleted.
127
+ JdbcSteps.getJDBCConfigurations().should('contain', 'No tables are defined');
112
128
  });
113
129
 
114
- function initRepositoryAndVisitJdbcView() {
115
- repositoryId = 'jdbc-repo-' + Date.now();
116
- cy.createRepository({id: repositoryId});
117
- cy.presetRepository(repositoryId);
118
- cy.importServerFile(repositoryId, FILE_TO_IMPORT);
119
- cy.visit('/jdbc');
120
- cy.window();
121
- }
122
-
123
- function getCreateNewJDBCConfigurationButon() {
124
- return cy.get('.create-sql-table-configuration');
125
- }
126
-
127
- function getJDBCConfigNameField() {
128
- return cy.get('.sql-table-name');
129
- }
130
-
131
- function getQueryArea() {
132
- return cy.get('.CodeMirror');
133
- }
134
-
135
- function getQueryTextArea() {
136
- return getQueryArea().find('textarea');
137
- }
138
-
139
- function typeQuery(query) {
140
- // getQueryTextArea().invoke('val', query).trigger('change', {force: true});
141
- getQueryTextArea().type(query, {force: true});
142
- cy.waitUntilQueryIsVisible();
143
- }
144
-
145
- function clearQuery() {
146
- // Using force because the textarea is not visible
147
- getQueryTextArea().type(Cypress.env('modifierKey') + 'a{backspace}', {force: true});
148
- }
149
-
150
- function getColumnTypesTab() {
151
- return cy.get('.nav-tabs').contains("Column types");
152
- }
153
-
154
- function getDataQueryTab() {
155
- return cy.get('.nav-tabs').contains("Data query");
156
- }
157
-
158
- function getSaveButton() {
159
- return cy.get('.save-query-btn');
160
- }
161
-
162
- function getDeleteButton() {
163
- return cy.get('.icon-trash');
164
- }
165
-
166
- function getCancelButton() {
167
- return cy.get('.cancel-query-btn');
168
- }
169
-
170
- function getConfirmDialogButton() {
171
- return cy.get('.btn-primary');
172
- }
173
-
174
- function getConfigurationList() {
175
- return cy.get('.jdbc-list-configurations');
176
- }
177
-
178
- function getEditButton() {
179
- return cy.get('.icon-edit');
180
- }
181
-
182
- function getSQLTableRows() {
183
- return cy.get('div.form-group.row.pt-1.ng-scope');
184
- }
185
-
186
- function getPreviewButton() {
187
- return cy.get('.preview-btn');
188
- }
189
-
190
- function getSuggestButton(){
191
- return cy.get('.sql-table-config .preview-btn');
192
- }
193
-
194
- function getConfirmSuggestButton() {
195
- return cy.get('.confirm-btn');
196
- }
197
-
198
- function getLoader() {
199
- return cy.get('.ot-loader-new-content');
200
- }
201
-
202
- function getPreviewTable() {
203
- return cy.get('.resultsTable');
204
- }
205
-
206
- function getSQLTableConfig() {
207
- return cy.get('.sql-table-config');
208
- }
209
130
  });