graphdb-workbench-tests 2.5.1 → 2.6.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 (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 +44 -10
  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 +220 -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 +193 -35
  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
@@ -0,0 +1,453 @@
1
+ import {ApplicationSteps} from "../../../steps/application-steps";
2
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
3
+ import {YasrSteps} from "../../../steps/yasgui/yasr-steps";
4
+ import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
5
+ import {VisualGraphSteps} from "../../../steps/visual-graph-steps";
6
+ import {MainMenuSteps} from "../../../steps/main-menu-steps";
7
+
8
+ const FILE_TO_IMPORT = 'wine.rdf';
9
+ const QUERY_START = `# CONSTRUCT or DESCRIBE query. The results will be rendered visually as a graph of triples.\nCONSTRUCT WHERE {\n\t?s ?p ?o\n} LIMIT 10`;
10
+ const QUERY_EXPAND_NODE = `# Note that ?node is the node you clicked and must be used in the query\nPREFIX rank: <http://www.ontotext.com/owlim/RDFRank#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nCONSTRUCT {\n # The triples that will be added to the visual graph\n ?node ?edge ?newNodeLTR .\n ?newNodeRTL ?edge ?node .\n} WHERE {\n {\n # Left to right relations (starting IRI is the subject)\n ?node ?edge ?newNodeLTR .\n\n # Select only IRIs\n FILTER(isIRI(?newNodeLTR) || rdf:isTriple(?newNodeLTR))\n } UNION {\n # Right to left relations (starting IRI is the object)\n ?newNodeRTL ?edge ?node .\n\n # Select only IRIs\n FILTER(isIRI(?newNodeRTL) || rdf:isTriple(?newNodeRTL))\n }\n FILTER(isIRI(?node) || rdf:isTriple(?node))\n} ORDER BY ?edge`;
11
+
12
+ describe('Graphs config', () => {
13
+
14
+ let repositoryId = 'graphRepo' + Date.now();
15
+ let graphConfigName = 'graph-config';
16
+
17
+ before(() => {
18
+ cy.clearLocalStorage('ls.graphs-viz');
19
+ repositoryId = 'repo' + Date.now();
20
+ cy.createRepository({id: repositoryId});
21
+ cy.importServerFile(repositoryId, FILE_TO_IMPORT);
22
+ });
23
+
24
+ after(() => {
25
+ cy.clearLocalStorage('ls.graphs-viz');
26
+ cy.setDefaultUserData();
27
+ cy.deleteRepository(repositoryId);
28
+ });
29
+
30
+ beforeEach(() => {
31
+ cy.presetRepository(repositoryId);
32
+ });
33
+
34
+ afterEach(() => {
35
+ cy.deleteGraphConfig(graphConfigName);
36
+ });
37
+
38
+ it('Should be able to switch between wizard tabs using the previous-next buttons', () => {
39
+ // Given I have started a create config wizard
40
+ startCreateConfigWizard();
41
+ // Then I expect to see the first wizard tab
42
+ VisualGraphSteps.getConfigWizardTab(1).should('be.visible')
43
+ .and('have.class', 'active');
44
+ // And I should not see the previous page button
45
+ VisualGraphSteps.getPreviousPageButton().should('not.be.visible');
46
+ // When I click on next buttons
47
+ // Then I expect wizard tabs to be switched
48
+ VisualGraphSteps.goToNextPage();
49
+ VisualGraphSteps.getConfigWizardTab(2).should('be.visible')
50
+ .and('have.class', 'active');
51
+ VisualGraphSteps.goToNextPage();
52
+ VisualGraphSteps.getConfigWizardTab(3).should('be.visible')
53
+ .and('have.class', 'active');
54
+ VisualGraphSteps.goToNextPage();
55
+ VisualGraphSteps.getConfigWizardTab(4).should('be.visible')
56
+ .and('have.class', 'active');
57
+ VisualGraphSteps.goToNextPage();
58
+ VisualGraphSteps.getConfigWizardTab(5).should('be.visible')
59
+ .and('have.class', 'active');
60
+ // When I am on the last wizard tab
61
+ // Then I should not see the next page button
62
+ VisualGraphSteps.getNextPageButton().should('not.be.visible');
63
+ });
64
+
65
+ it('Should see the first tab in create graph config wizard', () => {
66
+ // Given I have started a create config wizard
67
+ startCreateConfigWizard();
68
+ // And I should see the create config wizard tabs
69
+ // And the first tab should be active
70
+ VisualGraphSteps.getConfigWizardTab(1).should('be.visible')
71
+ .and('contain', 'Starting point')
72
+ .and('have.class', 'active');
73
+
74
+ // In the Starting point tab
75
+
76
+ // And I should see the start mode selectors
77
+ VisualGraphSteps.getStartModes().should('have.length', 3);
78
+ // And the search mode should be selected
79
+ VisualGraphSteps.getStartModeSelector('search').should('be.checked');
80
+ VisualGraphSteps.getStartMode('search').should('contain', 'Start with a search box');
81
+
82
+ // When I select the node mode
83
+ VisualGraphSteps.selectStartMode('node');
84
+ // Then I expect selector to become active
85
+ VisualGraphSteps.getStartModeSelector('node').should('be.checked');
86
+ VisualGraphSteps.getStartMode('node').should('contain', 'Start with a fixed node');
87
+ // And I should see the start node selector field
88
+ VisualGraphSteps.getStartNodeSelectorField().should('be.visible').and('be.empty');
89
+
90
+ // When I select the query mode
91
+ VisualGraphSteps.selectStartMode('query');
92
+ // Then I expect selector to become active
93
+ VisualGraphSteps.getStartModeSelector('query').should('be.checked');
94
+ VisualGraphSteps.getStartMode('query').should('contain', 'Start with graph query results');
95
+ // And I should see a query editor
96
+ checkEditorWithQuery(' ');
97
+ // And I should see predefined sample queries
98
+ VisualGraphSteps.getPredefinedQuerySamples().should('have.length', 1);
99
+ // And I should not see user sample queries
100
+ VisualGraphSteps.getUserQuerySamples().should('have.length.gte', 0);
101
+ // And I should see the show preview button when query mode is query
102
+ VisualGraphSteps.getPreviewQueryResultsButton().should('be.visible');
103
+ });
104
+
105
+ it('Should see the second tab in create graph config wizard', () => {
106
+ // Given I have started a create config wizard
107
+ startCreateConfigWizard();
108
+
109
+ // When I open the graph expansion tab
110
+ VisualGraphSteps.openConfigWizardTab(2);
111
+ VisualGraphSteps.getConfigWizardTab(2).should('contain', 'Graph expansion')
112
+ .and('have.class', 'active');
113
+ // Then I should see an info box
114
+ VisualGraphSteps.getHelpInfoBox().should('be.visible');
115
+ // And I should see the query editor
116
+ checkEditorWithQuery(' ');
117
+ // And I should see predefined sample queries
118
+ VisualGraphSteps.getPredefinedQuerySamples().should('have.length', 2);
119
+ // And I should not see user sample queries
120
+ VisualGraphSteps.getUserQuerySamples().should('have.length', 0);
121
+ // And I should see the show preview button
122
+ VisualGraphSteps.getPreviewQueryResultsButton().should('be.visible');
123
+ });
124
+
125
+ it('Should see the third tab in create graph config wizard', () => {
126
+ // Given I have started a create config wizard
127
+ startCreateConfigWizard();
128
+
129
+ // When I open the graph node basics tab
130
+ VisualGraphSteps.openConfigWizardTab(3);
131
+ VisualGraphSteps.getConfigWizardTab(3).should('contain', 'Node basics')
132
+ .and('have.class', 'active');
133
+ // Then I should see an info box
134
+ VisualGraphSteps.getHelpInfoBox().should('be.visible');
135
+ // And I should see the query editor
136
+ checkEditorWithQuery(' ');
137
+ // And I should see predefined sample queries
138
+ VisualGraphSteps.getPredefinedQuerySamples().should('have.length', 2);
139
+ // And I should not see user sample queries
140
+ VisualGraphSteps.getUserQuerySamples().should('have.length', 0);
141
+ // And I should see the show preview button
142
+ VisualGraphSteps.getPreviewQueryResultsButton().should('be.visible');
143
+ });
144
+
145
+ it('Should see the fourth tab in create graph config wizard', () => {
146
+ // Given I have started a create config wizard
147
+ startCreateConfigWizard();
148
+
149
+ // When I open the graph edge basics tab
150
+ VisualGraphSteps.openConfigWizardTab(4);
151
+ VisualGraphSteps.getConfigWizardTab(4).should('contain', 'Edge basics')
152
+ .and('have.class', 'active');
153
+ // Then I should see an info box
154
+ VisualGraphSteps.getHelpInfoBox().should('be.visible');
155
+ // And I should see the query editor
156
+ checkEditorWithQuery(' ');
157
+ // And I should see predefined sample queries
158
+ VisualGraphSteps.getPredefinedQuerySamples().should('have.length', 2);
159
+ // And I should not see user sample queries
160
+ VisualGraphSteps.getUserQuerySamples().should('have.length', 0);
161
+ // And I should see the show preview button
162
+ VisualGraphSteps.getPreviewQueryResultsButton().should('be.visible');
163
+ });
164
+
165
+ it('Should see the fifth tab in create graph config wizard', () => {
166
+ // Given I have started a create config wizard
167
+ startCreateConfigWizard();
168
+
169
+ // When I open the graph edge basics tab
170
+ VisualGraphSteps.openConfigWizardTab(5);
171
+ VisualGraphSteps.getConfigWizardTab(5).should('contain', 'Node extra')
172
+ .and('have.class', 'active');
173
+ // Then I should see an info box
174
+ VisualGraphSteps.getHelpInfoBox().should('be.visible');
175
+ // And I should see the query editor
176
+ checkEditorWithQuery(' ');
177
+ // And I should see predefined sample queries
178
+ VisualGraphSteps.getPredefinedQuerySamples().should('have.length', 2);
179
+ // And I should not see user sample queries
180
+ VisualGraphSteps.getUserQuerySamples().should('have.length', 0);
181
+ // And I should see the show preview button
182
+ VisualGraphSteps.getPreviewQueryResultsButton().should('be.visible');
183
+ });
184
+
185
+ it('Should be able to cancel config creation', () => {
186
+ // Given I have started a create config wizard
187
+ startCreateConfigWizard();
188
+ // When I click on cancel
189
+ VisualGraphSteps.cancelSaveConfig();
190
+ // Then I expect to be redirected to configs list view
191
+ cy.url().should('eq', Cypress.config('baseUrl') + '/graphs-visualizations');
192
+ });
193
+
194
+ it('Should not allow config creation without a name', () => {
195
+ // Given I have started a create config wizard
196
+ startCreateConfigWizard();
197
+ // When I click on save
198
+ VisualGraphSteps.saveConfig();
199
+ // Then I expect a warning notification
200
+ ApplicationSteps.getWarningNotification().should('be.visible');
201
+ // And I should stay on the same page
202
+ cy.url().should('include', '/graphs-visualizations/config/save');
203
+ });
204
+
205
+ it('Should create graph config with search box', () => {
206
+ // Given I have started a create config wizard
207
+ startCreateConfigWizard();
208
+ // When I fill in the config name
209
+ VisualGraphSteps.typeGraphConfigName(graphConfigName);
210
+ // And I save the graph config
211
+ saveGraphConfig(graphConfigName);
212
+ // When I open the graph config
213
+ VisualGraphSteps.openGraphConfig(graphConfigName);
214
+ // Then I expect the uri search field for the saved graph to be opened
215
+ cy.url().should('contain', Cypress.config('baseUrl') + '/graphs-visualizations?config=');
216
+ VisualGraphSteps.getGraphConfigSearchPanelName().should('contain', graphConfigName);
217
+ });
218
+
219
+ it('Should create graph config with fixed node', () => {
220
+ cy.enableAutocomplete(repositoryId);
221
+ // Given I have started a create config wizard
222
+ startCreateConfigWizard();
223
+ // When I fill in the config name
224
+ VisualGraphSteps.typeGraphConfigName(graphConfigName);
225
+ // And I select the config with fixed node option
226
+ VisualGraphSteps.selectStartMode('node');
227
+ // And I type an uri and select it
228
+ VisualGraphSteps.selectStartNode('USRegion', 0);
229
+ VisualGraphSteps.getSelectedStartNodeUri().should('contain', 'http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#USRegion');
230
+ // And I save the graph config
231
+ saveGraphConfig(graphConfigName);
232
+ // When I open the graph config
233
+ VisualGraphSteps.openGraphConfig(graphConfigName);
234
+ // Then I expect the graph visualization of the saved config to be opened
235
+ cy.url().should('contain', Cypress.config('baseUrl') + '/graphs-visualizations?config=');
236
+ VisualGraphSteps.getGraphVisualizationPane().should('be.visible');
237
+ });
238
+
239
+ it('Should not be able to switch to next wizard tabs when starting point query is not provided ', () => {
240
+ // Given I have started a create config wizard
241
+ startCreateConfigWizard();
242
+ // And I populated in the config name
243
+ VisualGraphSteps.typeGraphConfigName(graphConfigName);
244
+ // And I selected the config with query results option
245
+ VisualGraphSteps.selectStartMode('query');
246
+ // When I try to open the graph expansion tab without providing a starting point query
247
+ VisualGraphSteps.openConfigWizardTab(2);
248
+ // Then I expect to see a warning
249
+ // And the current first tab to remain open
250
+ ApplicationSteps.getWarningNotification().should('be.visible');
251
+ VisualGraphSteps.getConfigWizardTab(1).should('be.visible')
252
+ .and('have.class', 'active');
253
+ });
254
+
255
+ it('Should be able to create graph config with query results', () => {
256
+ // Given I have started a create config wizard
257
+ startCreateConfigWizard();
258
+ // And I populated in the config name
259
+ VisualGraphSteps.typeGraphConfigName(graphConfigName);
260
+ // And I selected the config with query results option
261
+ VisualGraphSteps.selectStartMode('query');
262
+ // And I selected a query
263
+ checkEditorWithQuery(' ');
264
+ VisualGraphSteps.selectPredefinedQuerySample(0);
265
+ YasqeSteps.getQuery(500).should('contain', QUERY_START);
266
+ // When I select preview query results
267
+ VisualGraphSteps.previewQueryResults();
268
+ // Then I expect to see the results table
269
+ YasrSteps.getYasr().should('be.visible');
270
+ // When I select to edit query
271
+ VisualGraphSteps.editQuery();
272
+ // Then I expect to see the query editor with the previously selected query
273
+ checkEditorWithQuery(QUERY_START);
274
+ // And I open the graph expansion tab
275
+ VisualGraphSteps.openConfigWizardTab(2);
276
+ // Then I expect the tab to be opened and become active
277
+ VisualGraphSteps.getConfigWizardTab(2).should('have.class', 'active');
278
+ // And the query editor to be visible and empty
279
+ checkEditorWithQuery(' ');
280
+ // When I select a predefined query from the list
281
+ VisualGraphSteps.selectPredefinedQuerySample(0);
282
+ YasqeSteps.getQuery(500).should('contain', QUERY_EXPAND_NODE);
283
+ // When I select to preview query results
284
+ VisualGraphSteps.previewQueryResults();
285
+ // Then I expect to see the results table
286
+ YasrSteps.getYasr().should('be.visible');
287
+ // When I select to edit the selected query
288
+ VisualGraphSteps.editQuery();
289
+ // Then I expect to see the editor with the selected query
290
+ YasqeSteps.getQuery(500).should('contain', QUERY_EXPAND_NODE);
291
+ // When I click on save
292
+ saveGraphConfig(graphConfigName);
293
+ // Then I expect config to be saved
294
+ // When I open the graph config
295
+ VisualGraphSteps.openGraphConfig(graphConfigName);
296
+ // Then I expect the graph visualization of the saved config to be opened
297
+ cy.url().should('contain', Cypress.config('baseUrl') + '/graphs-visualizations?config=');
298
+ VisualGraphSteps.getGraphVisualizationPane().should('be.visible');
299
+ });
300
+
301
+ it('Should be able to update existing graph config', () => {
302
+ // Given I have created a graph config with start query
303
+ startCreateConfigWizard();
304
+ VisualGraphSteps.typeGraphConfigName(graphConfigName);
305
+ VisualGraphSteps.selectStartMode('query');
306
+ checkEditorWithQuery(' ');
307
+ VisualGraphSteps.selectPredefinedQuerySample(0);
308
+ checkEditorWithQuery(QUERY_START);
309
+ saveGraphConfig(graphConfigName);
310
+ // When I select edit for the new config
311
+ VisualGraphSteps.editConfig(graphConfigName);
312
+ // Then I expect to see the first wizard tab with the selected start query
313
+ checkEditorWithQuery(QUERY_START);
314
+ // When I change the query
315
+ VisualGraphSteps.getRevertQueryButton().should('be.disabled');
316
+ YasqeSteps.writeInEditor('##');
317
+ // Then I expect to be able to revert it
318
+ VisualGraphSteps.getRevertQueryButton().should('be.enabled');
319
+ VisualGraphSteps.revertQuery();
320
+ VisualGraphSteps.getRevertQueryButton().should('be.disabled');
321
+ checkEditorWithQuery(QUERY_START);
322
+ // When I edit the config by adding an expand query
323
+ VisualGraphSteps.goToNextPage();
324
+ VisualGraphSteps.getConfigWizardTab(2).should('be.visible');
325
+ VisualGraphSteps.selectPredefinedQuerySample(0);
326
+ checkEditorWithQuery(QUERY_EXPAND_NODE);
327
+ saveGraphConfig(graphConfigName);
328
+ // Then I expect graph config to be saved with the new data
329
+ VisualGraphSteps.editConfig(graphConfigName);
330
+ checkEditorWithQuery(QUERY_START);
331
+ VisualGraphSteps.goToNextPage();
332
+ VisualGraphSteps.getConfigWizardTab(2).should('be.visible');
333
+ checkEditorWithQuery(QUERY_EXPAND_NODE);
334
+ });
335
+
336
+ it('Should prevent leaving with confirmation when start query is changed', () => {
337
+ // Given I have created a graph config with start query
338
+ startCreateConfigWizard();
339
+ VisualGraphSteps.typeGraphConfigName(graphConfigName);
340
+ VisualGraphSteps.selectStartMode('query');
341
+ checkEditorWithQuery(' ');
342
+ VisualGraphSteps.selectPredefinedQuerySample(0);
343
+ checkEditorWithQuery(QUERY_START);
344
+ saveGraphConfig(graphConfigName);
345
+ // And I open it for edit
346
+ VisualGraphSteps.editConfig(graphConfigName);
347
+ checkEditorWithQuery(QUERY_START);
348
+ // When I click cancel without changing the query
349
+ VisualGraphSteps.cancelSaveConfig();
350
+ // Then I expect to be redirected to configs list without confirmation
351
+ cy.url().should('eq', Cypress.config('baseUrl') + '/graphs-visualizations');
352
+ // And I open it for edit
353
+ VisualGraphSteps.editConfig(graphConfigName);
354
+ checkEditorWithQuery(QUERY_START);
355
+ // And I change the query
356
+ YasqeSteps.writeInEditor('##');
357
+ // When I click cancel after changing the query
358
+ VisualGraphSteps.cancelSaveConfig();
359
+ // Then I expect a confirmation for leaving the page
360
+ ModalDialogSteps.getDialog().should('be.visible');
361
+ // When I reject
362
+ ModalDialogSteps.clickOnCancelButton();
363
+ // Then I expect to remain on the same page
364
+ ModalDialogSteps.getDialog().should('not.exist');
365
+ cy.url().should('contain', '/graphs-visualizations/config/save');
366
+ // When I click cancel after changing the query
367
+ VisualGraphSteps.cancelSaveConfig();
368
+ // Then I expect a confirmation for leaving the page
369
+ ModalDialogSteps.getDialog().should('be.visible');
370
+ // When I confirm
371
+ ModalDialogSteps.clickOnConfirmButton();
372
+ // Then I expect to be redirected to configs list page
373
+ ModalDialogSteps.getDialog().should('not.exist');
374
+ cy.url().should('eq', Cypress.config('baseUrl') + '/graphs-visualizations');
375
+ });
376
+
377
+ it('Should prevent leaving with confirmation when expand query is changed', () => {
378
+ // Given I have created a graph config with start query
379
+ startCreateConfigWizard();
380
+ VisualGraphSteps.typeGraphConfigName(graphConfigName);
381
+ VisualGraphSteps.selectStartMode('query');
382
+ checkEditorWithQuery(' ');
383
+ VisualGraphSteps.selectPredefinedQuerySample(0);
384
+ checkEditorWithQuery(QUERY_START);
385
+ saveGraphConfig(graphConfigName);
386
+ // And I open it for edit
387
+ VisualGraphSteps.editConfig(graphConfigName);
388
+ // And I open the expand query wizard tab
389
+ VisualGraphSteps.openConfigWizardTab(2);
390
+ VisualGraphSteps.getConfigWizardTab(2).should('have.class', 'active');
391
+ // When I click cancel without changing the query
392
+ VisualGraphSteps.cancelSaveConfig();
393
+ // Then I expect a confirmation for leaving the page
394
+ ModalDialogSteps.getDialog().should('be.visible');
395
+ // When I reject
396
+ ModalDialogSteps.clickOnCancelButton();
397
+ // Then I expect to stay on the same page
398
+ ModalDialogSteps.getDialog().should('not.exist');
399
+ // When I select a predefined query
400
+ VisualGraphSteps.selectPredefinedQuerySample(0);
401
+ YasqeSteps.getQuery(500).should('contain', QUERY_EXPAND_NODE);
402
+ // And I try to open another page
403
+ MainMenuSteps.clickOnMenuImport();
404
+ // Then I expect a confirmation for leaving the page
405
+ ModalDialogSteps.getDialog().should('be.visible');
406
+ });
407
+
408
+ it('Should be able to delete existing graph config', () => {
409
+ // Given I have created a graph config
410
+ startCreateConfigWizard();
411
+ VisualGraphSteps.typeGraphConfigName(graphConfigName);
412
+ saveGraphConfig(graphConfigName);
413
+ // When I select to delete the config
414
+ VisualGraphSteps.deleteConfig(graphConfigName);
415
+ // Then I expect to see confirmation dialog
416
+ ModalDialogSteps.getDialog().should('be.visible');
417
+ // When I cancel delete operation
418
+ ModalDialogSteps.clickOnCancelButton();
419
+ ModalDialogSteps.getDialog().should('not.exist');
420
+ // Then I expect that config will not be deleted
421
+ VisualGraphSteps.getGraphConfig(graphConfigName).should('be.visible');
422
+ // When I delete and confirm the operation
423
+ VisualGraphSteps.deleteConfig(graphConfigName);
424
+ ModalDialogSteps.clickOnConfirmButton();
425
+ // Then I expect the config to be deleted
426
+ VisualGraphSteps.getGraphConfigs().should('not.exist');
427
+ });
428
+ });
429
+
430
+ function checkEditorWithQuery(query) {
431
+ VisualGraphSteps.getQueryEditor().should('be.visible');
432
+ YasqeSteps.getQuery(500).should('contain', query);
433
+ }
434
+
435
+ function saveGraphConfig(graphConfigName) {
436
+ // And I click on save
437
+ VisualGraphSteps.saveConfig();
438
+ // Then I expect a success notification
439
+ ApplicationSteps.getSuccessNotifications().should('be.visible');
440
+ // And I should be redirected to configs list view
441
+ cy.url().should('eq', Cypress.config('baseUrl') + '/graphs-visualizations');
442
+ // And the new config should be present in the list
443
+ VisualGraphSteps.getGraphConfig(graphConfigName).should('be.visible');
444
+ }
445
+
446
+ function startCreateConfigWizard() {
447
+ // Given I have opened the graphs visualizations page
448
+ cy.visit('graphs-visualizations');
449
+ // When I click on create custom graphs config
450
+ VisualGraphSteps.getCreateCustomGraphLink().click();
451
+ // Then I should see the graphs config view
452
+ cy.url().should('include', '/config/save');
453
+ }