graphdb-workbench-tests 2.7.6 → 2.8.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 (119) hide show
  1. package/cypress.config.js +3 -0
  2. package/fixtures/cluster/2-nodes-cluster-group-status-deleted.json +30 -0
  3. package/fixtures/cluster/2-nodes-cluster-group-status.json +30 -0
  4. package/fixtures/cluster/3-nodes-cluster-group-status-after-replace.json +44 -0
  5. package/fixtures/cluster/3-nodes-cluster-group-status-building-snapshot.json +4 -1
  6. package/fixtures/cluster/3-nodes-cluster-group-status-receiving-snapshot.json +4 -1
  7. package/fixtures/cluster/3-nodes-cluster-group-status-sending-snapshot.json +4 -1
  8. package/fixtures/cluster/3-nodes-cluster-group-status-waiting-for-snapshot.json +4 -1
  9. package/fixtures/cluster/3-nodes-cluster-group-status.json +12 -3
  10. package/fixtures/cluster/4-nodes-cluster-group-status.json +58 -0
  11. package/fixtures/cluster/cluster-config.json +1 -0
  12. package/fixtures/cluster/cluster-node-status.json +4 -1
  13. package/fixtures/connectors/get-connectors.json +8 -0
  14. package/fixtures/connectors/get-retrieval-connector-0.json +1 -0
  15. package/fixtures/connectors/get-retrieval-connector.json +29 -0
  16. package/fixtures/connectors/get-ttyg-chatgpt-connectors.json +188 -0
  17. package/fixtures/locale-en.json +630 -61
  18. package/fixtures/namespaces/get-repository-starwars-namespaces.json +252 -0
  19. package/fixtures/remote-location/get-0-remote-locations.json +1 -2
  20. package/fixtures/remote-location/get-1-remote-locations.json +2 -4
  21. package/fixtures/remote-location/get-2-remote-locations.json +3 -6
  22. package/fixtures/remote-location/get-3-remote-locations.json +4 -8
  23. package/fixtures/remote-location/get-4-remote-locations.json +54 -0
  24. package/fixtures/remote-location/remote-location-status-in-cluster.json +1 -2
  25. package/fixtures/remote-location/remote-location-status-not-in-cluster.json +1 -2
  26. package/fixtures/remote-location/remote-locations-filter.json +1 -2
  27. package/fixtures/repositories/get-locations.json +67 -0
  28. package/fixtures/repositories/get-repositories.json +106 -0
  29. package/fixtures/repositories/get-repository-config-starwars-disabled-fts.json +201 -0
  30. package/fixtures/repositories/get-repository-config-starwars-enabled-fts.json +201 -0
  31. package/fixtures/repositories/get-ttyg-repositories.json +74 -0
  32. package/fixtures/similarity/get-similarity-indexes-0.json +1 -0
  33. package/fixtures/similarity/get-similarity-indexes.json +15 -0
  34. package/fixtures/similarity/get-ttyg-similarity-connectors.json +46 -0
  35. package/fixtures/ttyg/agent/create-agent.json +20 -0
  36. package/fixtures/ttyg/agent/get-agent-defaults.json +42 -0
  37. package/fixtures/ttyg/agent/get-agent-list-0.json +1 -0
  38. package/fixtures/ttyg/agent/get-agent-list-after-deleted.json +56 -0
  39. package/fixtures/ttyg/agent/get-agent-list-new-agent.json +22 -0
  40. package/fixtures/ttyg/agent/get-agent-list.json +77 -0
  41. package/fixtures/ttyg/agent/get-agent.json +25 -0
  42. package/fixtures/ttyg/chats/ask-question.json +25 -0
  43. package/fixtures/ttyg/chats/create/create-chat-response.json +16 -0
  44. package/fixtures/ttyg/chats/create/get-chats-after-create.json +12 -0
  45. package/fixtures/ttyg/chats/create/get-chats-before-create.json +7 -0
  46. package/fixtures/ttyg/chats/deleted-chat.json +3 -0
  47. package/fixtures/ttyg/chats/explain-response-1.json +59 -0
  48. package/fixtures/ttyg/chats/explain-response-2.json +59 -0
  49. package/fixtures/ttyg/chats/export-chat.json +34 -0
  50. package/fixtures/ttyg/chats/get-chat-list-0.json +1 -0
  51. package/fixtures/ttyg/chats/get-chat-list-with-deleted-chat.json +17 -0
  52. package/fixtures/ttyg/chats/get-chat-list-with-renamed-chat.json +22 -0
  53. package/fixtures/ttyg/chats/get-chat-list.json +22 -0
  54. package/fixtures/ttyg/chats/get-chat.json +199 -0
  55. package/fixtures/ttyg/chats/renamed-chat.json +4 -0
  56. package/integration/cluster/cluster-management.spec.js +0 -170
  57. package/integration/cluster/edit-cluster-nodes-modal.spec.js +425 -0
  58. package/integration/explore/graphs.overview.spec.js +4 -0
  59. package/integration/home/cookie-policy.spec.js +65 -0
  60. package/integration/home/create-repository.spec.js +35 -0
  61. package/integration/home/documentation-link.spec.js +60 -0
  62. package/integration/home/google-analytics.spec.js +60 -0
  63. package/integration/home/language-selector.spec.js +19 -0
  64. package/integration/home/rdf-resource-search.spec.js +192 -0
  65. package/integration/home/view-resource-autocomplete.spec.js +52 -0
  66. package/integration/home/workbench.home.spec.js +1 -277
  67. package/integration/import/import-user-data-file-upload.spec.js +13 -0
  68. package/integration/import/import-user-data.spec.js +8 -2
  69. package/integration/import/import-view.spec.js +6 -1
  70. package/integration/repository/attach-remote-location.spec.js +203 -0
  71. package/integration/repository/ontop-repository.spec.js +87 -1
  72. package/integration/repository/repositories.spec.js +4 -19
  73. package/integration/setup/my-settings.spec.js +2 -0
  74. package/integration/ttyg/agent-list.spec.js +76 -0
  75. package/integration/ttyg/agent-select-menu.spec.js +141 -0
  76. package/integration/ttyg/chat-list.spec.js +286 -0
  77. package/integration/ttyg/chat-panel.spec.js +175 -0
  78. package/integration/ttyg/clone-agent.spec.js +75 -0
  79. package/integration/ttyg/create-agent.spec.js +560 -0
  80. package/integration/ttyg/create-chat.spec.js +69 -0
  81. package/integration/ttyg/delete-agent.spec.js +51 -0
  82. package/integration/ttyg/edit-agent.spec.js +54 -0
  83. package/integration/ttyg/ttyg-permission.spec.js +66 -0
  84. package/integration/ttyg/ttyg-view.spec.js +75 -0
  85. package/npm-shrinkwrap.json +215 -220
  86. package/package.json +5 -6
  87. package/steps/alert-dialog-steps.js +25 -0
  88. package/steps/cluster/cluster-page-steps.js +8 -0
  89. package/steps/cluster/custer-nodes-configuration-steps.js +107 -0
  90. package/steps/home-steps.js +48 -5
  91. package/steps/import/import-steps.js +11 -11
  92. package/steps/modal-dialog-steps.js +8 -0
  93. package/steps/ontop-repository-steps.js +26 -0
  94. package/steps/repositories/attach-repository-steps.js +118 -0
  95. package/steps/repository-steps.js +53 -5
  96. package/steps/setup/settings-steps.js +17 -0
  97. package/steps/ttyg/chat-panel-steps.js +62 -0
  98. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +462 -0
  99. package/steps/ttyg/ttyg-view-steps.js +333 -0
  100. package/steps/window-steps.js +5 -0
  101. package/stubs/cluster/cluster-stubs.js +127 -7
  102. package/stubs/cluster/remote-location-stubs.js +46 -0
  103. package/stubs/connector-stubs.js +39 -0
  104. package/stubs/environment-stubs.js +27 -0
  105. package/stubs/license-stubs.js +101 -0
  106. package/stubs/repositories/repositories-stubs.js +133 -0
  107. package/stubs/repositories-stub.js +15 -0
  108. package/stubs/security-stubs.js +7 -0
  109. package/stubs/similarity-index-stubs.js +32 -0
  110. package/stubs/stubs.js +4 -0
  111. package/stubs/ttyg/ttyg-stubs.js +166 -0
  112. package/support/commands.js +2 -0
  113. package/support/index.js +17 -0
  114. package/support/security-command.js +25 -0
  115. package/support/settings-commands.js +4 -5
  116. package/support/user-commands.js +31 -0
  117. package/steps/cluster/add-remote-location-dialog-steps.js +0 -11
  118. package/steps/cluster/create-cluster-dialog-steps.js +0 -39
  119. package/steps/cluster/replace-nodes-dialog-steps.js +0 -39
@@ -0,0 +1,333 @@
1
+ export class TTYGViewSteps {
2
+ static visit() {
3
+ cy.visit('/ttyg');
4
+ }
5
+
6
+ static getTtygView() {
7
+ return cy.get('.ttyg-view');
8
+ }
9
+
10
+ static getTtygViewTitle() {
11
+ return cy.get('#ttyg-view-title');
12
+ }
13
+
14
+ static getNoAgentsView() {
15
+ return this.getTtygView().find('.no-agents-view-component');
16
+ }
17
+
18
+ static getTtygViewContent() {
19
+ return cy.get('.ttyg-view-content');
20
+ }
21
+
22
+ static getChatsSidebar() {
23
+ return cy.get('.left-sidebar');
24
+ }
25
+
26
+ static getChatListLoadingIndicator() {
27
+ return this.getChatsSidebar().find('[onto-loader-fancy]');
28
+ }
29
+
30
+ static getChatsPanel() {
31
+ return this.getChatsSidebar().find('.chat-list-panel');
32
+ }
33
+
34
+ static getChatListComponent() {
35
+ return this.getChatsPanel().find('.chat-list-component');
36
+ }
37
+
38
+ static getChatByDayGroups() {
39
+ return this.getChatListComponent().find('.chat-group');
40
+ }
41
+
42
+ static getChatGroup(index) {
43
+ return this.getChatByDayGroups().eq(index);
44
+ }
45
+
46
+ static getChatsFromGroup(index) {
47
+ return this.getChatGroup(index).find('.chat-item');
48
+ }
49
+
50
+ static getChatFromGroup(groupIndex, chatIndex) {
51
+ return this.getChatGroup(groupIndex).find('.chat-item').eq(chatIndex);
52
+ }
53
+
54
+ static selectChat(groupIndex, chatIndex) {
55
+ this.getChatFromGroup(groupIndex, chatIndex).click();
56
+ }
57
+
58
+ static editChatName(groupIndex, chatIndex) {
59
+ this.getChatFromGroup(groupIndex, chatIndex).dblclick();
60
+ }
61
+
62
+ static getChatNameInput(groupIndex, chatIndex) {
63
+ return this.getChatFromGroup(groupIndex, chatIndex).find('.inline-editable-text input');
64
+ }
65
+
66
+ static writeChatName(groupIndex, chatIndex, name) {
67
+ this.getChatNameInput(groupIndex, chatIndex).clear().type(name);
68
+ }
69
+
70
+ static saveChatName(groupIndex, chatIndex) {
71
+ this.getChatNameInput(groupIndex, chatIndex).type('{enter}');
72
+ }
73
+
74
+ static cancelChatNameSaving(groupIndex, chatIndex) {
75
+ this.getChatNameInput(groupIndex, chatIndex).type('{esc}');
76
+ }
77
+
78
+ static openChatActionMenu(groupIndex, chatIndex) {
79
+ this.getChatFromGroup(groupIndex, chatIndex).realHover().find('.open-chat-actions-btn').click();
80
+ }
81
+
82
+ static triggerEditChatActionMenu(groupIndex, chatIndex) {
83
+ this.openChatActionMenu(groupIndex, chatIndex);
84
+ this.getChatFromGroup(groupIndex, chatIndex).find('.chat-actions-menu .rename-chat-btn').click();
85
+ }
86
+
87
+ static triggerDeleteChatActionMenu(groupIndex, chatIndex) {
88
+ this.openChatActionMenu(groupIndex, chatIndex);
89
+ this.getChatFromGroup(groupIndex, chatIndex).find('.chat-actions-menu .delete-chat-btn').click();
90
+ }
91
+
92
+ static triggerExportChatActionMenu(groupIndex, chatIndex) {
93
+ this.openChatActionMenu(groupIndex, chatIndex);
94
+ this.getChatFromGroup(groupIndex, chatIndex).find('.chat-actions-menu .export-chat-btn').click();
95
+ }
96
+
97
+ static getToggleChatsSidebarButton() {
98
+ return this.getChatsSidebar().find('.toggle-chats-sidebar-btn');
99
+ }
100
+
101
+ static collapseChatsSidebar() {
102
+ return this.getToggleChatsSidebarButton().click();
103
+ }
104
+
105
+ static expandChatsSidebar() {
106
+ return this.getToggleChatsSidebarButton().click();
107
+ }
108
+
109
+ static getCreateChatButton() {
110
+ return this.getChatsSidebar().find('.create-chat-btn');
111
+ }
112
+
113
+ static createANewChat() {
114
+ TTYGViewSteps.getCreateChatButton().click();
115
+ }
116
+
117
+ static getAgentsSidebar() {
118
+ return cy.get('.right-sidebar');
119
+ }
120
+
121
+ static getAgentsPanel() {
122
+ return this.getAgentsSidebar().find('.agent-list-panel');
123
+ }
124
+
125
+ static getAgentFilter() {
126
+ return this.getAgentsPanel().find('.agents-filter-dropdown');
127
+ }
128
+
129
+ static getSelectedAgentFilter() {
130
+ return this.getAgentFilter().find('.selected-filter');
131
+ }
132
+
133
+ static getDropdownMenu() {
134
+ return this.getAgentFilter().find('.dropdown-menu');
135
+ }
136
+
137
+ static verifyRepositoryOptionNotExist(repositoryId) {
138
+ this.getDropdownMenu().each(($select) => {
139
+ cy.wrap($select).should('not.contain.text', repositoryId);
140
+ });
141
+ }
142
+
143
+ static filterAgentsByRepository(repository) {
144
+ this.getAgentFilter().click();
145
+ this.getDropdownMenu().find(`[data-value="${repository}"]`).click();
146
+ }
147
+
148
+ static selectAllAgentsFilter() {
149
+ this.filterAgentsByRepository('All');
150
+ }
151
+
152
+ static getAgentsLoadingIndicator() {
153
+ return this.getAgentsPanel().find('.agent-list-loader');
154
+ }
155
+
156
+ static getAgents() {
157
+ return this.getAgentsPanel().find('.agent-item');
158
+ }
159
+
160
+ static getAgent(index) {
161
+ return this.getAgents().eq(index);
162
+ }
163
+
164
+ static getHelpButton() {
165
+ return this.getAgentsSidebar().find('.help-btn');
166
+ }
167
+
168
+ static getCreateFirstAgentButton() {
169
+ return this.getNoAgentsView().find('.create-agent-btn');
170
+ }
171
+
172
+ static getCreateAgentButton() {
173
+ return this.getAgentsSidebar().find('.create-agent-btn');
174
+ }
175
+
176
+ static createFirstAgent() {
177
+ this.getCreateFirstAgentButton().click();
178
+ }
179
+
180
+ static getToggleAgentsSidebarButton() {
181
+ return this.getAgentsSidebar().find('.toggle-agents-sidebar-btn');
182
+ }
183
+
184
+ static collapseAgentsSidebar() {
185
+ return this.getToggleAgentsSidebarButton().click();
186
+ }
187
+
188
+ static expandAgentsSidebar() {
189
+ return this.getToggleAgentsSidebarButton().click();
190
+ }
191
+
192
+ static getChatPanel() {
193
+ return this.getTtygView().find('.chat-content');
194
+ }
195
+
196
+ static getChatPanelToolbar() {
197
+ return this.getChatPanel().find('.toolbar');
198
+ }
199
+
200
+ static getEditCurrentAgentButton() {
201
+ return this.getChatPanelToolbar().find('.edit-current-agent-btn');
202
+ }
203
+
204
+ static editCurrentAgent() {
205
+ return this.getEditCurrentAgentButton().click();
206
+ }
207
+
208
+ static verifyFileExists(fileName) {
209
+ cy.readFile('cypress/downloads/' + fileName);
210
+ }
211
+
212
+ static getChat() {
213
+ return this.getChatPanel().find('.chat');
214
+ }
215
+
216
+ static getOpenAgentActionsButton(index) {
217
+ return this.getAgent(index).realHover().find('.open-agent-actions-btn');
218
+ }
219
+
220
+ static openAgentActionMenu(index) {
221
+ this.getOpenAgentActionsButton(index).click();
222
+ }
223
+
224
+ static triggerCloneAgentActionMenu(index) {
225
+ this.openAgentActionMenu(index);
226
+ this.getAgent(index).find('.agent-actions-menu .clone-agent-btn').click();
227
+ }
228
+
229
+ static triggerDeleteAgentActionMenu(index) {
230
+ this.openAgentActionMenu(index);
231
+ this.getAgent(index).find('.agent-actions-menu .delete-agent-btn').click();
232
+ }
233
+
234
+ static getAgentDeletingLoader() {
235
+ return this.getAgentsPanel().find('.agent-list .deleting-agent-loader');
236
+ }
237
+
238
+ /**
239
+ * @param {*[]} data
240
+ */
241
+ static verifyAgentList(data) {
242
+ this.getAgents().should('have.length', data.length);
243
+ data.forEach((agent, index) => {
244
+ this.getAgent(index).within(() => {
245
+ cy.get('.agent-name').should('contain', agent.name);
246
+ const shouldExist = agent.isRepositoryDeleted ? 'exist' : 'not.exist';
247
+ cy.get('.agent-with-deleted-repository').should(shouldExist);
248
+ cy.get('.related-repository').should('contain', agent.repositoryId);
249
+ });
250
+ });
251
+ }
252
+
253
+ static getAgentsMenu() {
254
+ return this.getTtygView().find('.agent-select-menu');
255
+ }
256
+
257
+ static getAgentsMenuToggleButton() {
258
+ return this.getAgentsMenu().find('.dropdown-toggle-btn');
259
+ }
260
+
261
+ static openAgentsMenu() {
262
+ this.getAgentsMenuToggleButton().click();
263
+ }
264
+
265
+ static getAgentsFromMenu() {
266
+ return this.getAgentsMenu().find('.agent-menu-item');
267
+ }
268
+
269
+ static getAgentFromMenu(index) {
270
+ return this.getAgentsFromMenu().eq(index);
271
+ }
272
+
273
+ static selectAgent(index) {
274
+ this.getAgentFromMenu(index).click();
275
+ }
276
+
277
+ static verifySelectAgentMenuItems(data) {
278
+ this.openAgentsMenu();
279
+ this.getAgentsFromMenu().should('have.length', data.length);
280
+ data.forEach((agent, index) => {
281
+ this.getAgentFromMenu(index).within(() => {
282
+ cy.get('.agent-name').should('contain', agent.name);
283
+ const shouldExist = agent.isRepositoryDeleted ? 'exist' : 'not.exist';
284
+ cy.get('.agent-with-deleted-repository').should(shouldExist);
285
+ cy.get('.repository-id').should('contain', agent.repositoryId);
286
+ });
287
+ });
288
+ }
289
+
290
+ static getExplainResponseButton(index) {
291
+ return this.getTtygView().find('.explain-response-btn').eq(index);
292
+ }
293
+
294
+ static clickOnExplainResponse(index) {
295
+ this.getExplainResponseButton(index).click();
296
+ }
297
+
298
+ static getHowDeliverAnswerButton() {
299
+ return this.getTtygView().find('.deliver-answer-btn');
300
+ }
301
+
302
+ static clickOnHowDeliverAnswerButton(index) {
303
+ this.getHowDeliverAnswerButton().click();
304
+ }
305
+
306
+ static getExplainResponsesElement(index) {
307
+ return cy.get('.explain-responses').eq(index);
308
+ }
309
+
310
+ static getExplainResponseElement(explainResponsesIndex, explainResponseIndex) {
311
+ return this.getExplainResponsesElement(explainResponsesIndex).find('.explain-response').eq(explainResponseIndex);
312
+ }
313
+
314
+ static getQueryMethodElement(explainResponsesIndex, explainResponseIndex) {
315
+ return this.getExplainResponseElement(explainResponsesIndex, explainResponseIndex).find('.query-method');
316
+ }
317
+
318
+ static getQueryMethodDetailsElement(explainResponsesIndex, explainResponseIndex) {
319
+ return this.getExplainResponseElement(explainResponsesIndex, explainResponseIndex).find('.query-method-details');
320
+ }
321
+
322
+ static getRawQuery(explainResponsesIndex, explainResponseIndex) {
323
+ return this.getExplainResponseElement(explainResponsesIndex, explainResponseIndex).find('.raw-query');
324
+ }
325
+
326
+ static getExplainQueryHeaderElement(explainResponsesIndex, explainResponseIndex) {
327
+ return this.getExplainResponseElement(explainResponsesIndex, explainResponseIndex).find('.header');
328
+ }
329
+
330
+ static getExplainQueryQueryElement(explainResponsesIndex, explainResponseIndex) {
331
+ return this.getExplainResponseElement(explainResponsesIndex, explainResponseIndex).find('.query');
332
+ }
333
+ }
@@ -0,0 +1,5 @@
1
+ export class WindowSteps {
2
+ static getClipboardTextContent() {
3
+ return cy.window().its('navigator.clipboard').invoke('readText').then((text) => text);
4
+ }
5
+ }
@@ -15,6 +15,42 @@ export class ClusterStubs extends Stubs {
15
15
  }).as('3-nodes-cluster-group-status');
16
16
  }
17
17
 
18
+ static stubClusterGroupStatusAfterAdd() {
19
+ cy.intercept('/rest/cluster/group/status', {
20
+ fixture: '/cluster/4-nodes-cluster-group-status.json',
21
+ statusCode: 200
22
+ }).as('4-nodes-cluster-group-status');
23
+ }
24
+
25
+ static stubClusterGroupStatusAfterDelete() {
26
+ cy.intercept('/rest/cluster/group/status', {
27
+ fixture: '/cluster/2-nodes-cluster-group-status-deleted.json',
28
+ statusCode: 200
29
+ }).as('2-nodes-cluster-group-status-deleted');
30
+ }
31
+
32
+ static stubClusterGroupStatusAfterReplaceAndDelete() {
33
+ cy.intercept('/rest/cluster/group/status', {
34
+ fixture: '/cluster/3-nodes-cluster-group-status-after-replace.json',
35
+ statusCode: 200
36
+ }).as('3-nodes-cluster-group-status-after-replace');
37
+ }
38
+
39
+ static stubClusterGroupStatusAfterReplace() {
40
+ cy.intercept('/rest/cluster/group/status', {
41
+ fixture: '/cluster/2-nodes-cluster-group-status.json',
42
+ statusCode: 200
43
+ }).as('2-nodes-cluster-group-status');
44
+ }
45
+
46
+ static stubDeleteUnusedLocation(uri) {
47
+ cy.intercept(`rest/locations?uri=${uri}`, {
48
+ body: `Successfully removed location '${uri}'`,
49
+ statusCode: 200,
50
+ method: 'DELETE'
51
+ }).as('delete-location');
52
+ }
53
+
18
54
  static stubClusterWithRecoveryStatusGroupStatus(recoveryStatus) {
19
55
  cy.intercept('/rest/cluster/group/status', {
20
56
  fixture: `/cluster/3-nodes-cluster-group-status-${recoveryStatus}`,
@@ -49,13 +85,6 @@ export class ClusterStubs extends Stubs {
49
85
  }).as('cluster-config');
50
86
  }
51
87
 
52
- static stubCreateCluster() {
53
- cy.intercept('/rest/cluster/config', {
54
- fixture: '/cluster/3-nodes-cluster-created.json',
55
- statusCode: 201
56
- }).as('3-nodes-cluster-created');
57
- }
58
-
59
88
  static stubDeleteCluster() {
60
89
  cy.intercept('/rest/cluster/config?force=false', {
61
90
  fixture: '/cluster/delete-cluster.json',
@@ -71,4 +100,95 @@ export class ClusterStubs extends Stubs {
71
100
  method: 'PATCH'
72
101
  }).as('replace-nodes');
73
102
  }
103
+
104
+ static stubAddNodesByList(nodes) {
105
+ const response = {};
106
+ nodes.forEach((node) => {
107
+ response[node] = "Node was successfully added in the cluster.";
108
+ });
109
+
110
+ cy.intercept({
111
+ method: 'PATCH',
112
+ url: '/rest/cluster/httpConfig'
113
+ }, (req) => {
114
+ req.reply({
115
+ statusCode: 200,
116
+ body: response
117
+ });
118
+ }).as('response-add-nodes');
119
+ }
120
+
121
+ static stubDeleteNodesByList(nodes) {
122
+ const response = {};
123
+ nodes.forEach((node) => {
124
+ response[node] = "Cluster was deleted on this node.";
125
+ });
126
+
127
+ cy.intercept({
128
+ method: 'PATCH',
129
+ url: '/rest/cluster/httpConfig'
130
+ }, (req) => {
131
+ req.reply({
132
+ statusCode: 200,
133
+ body: response
134
+ });
135
+ }).as('response-delete-nodes');
136
+ }
137
+
138
+ static stubReplaceNodesByList(added, removed) {
139
+ const response = {};
140
+ added.forEach((node) => {
141
+ response[node] = "Node was successfully added in the cluster.";
142
+ });
143
+ added.forEach((node) => {
144
+ response[node] = "Node was successfully removed from the cluster.";
145
+ });
146
+
147
+ cy.intercept({
148
+ method: 'PATCH',
149
+ url: '/rest/cluster/httpConfig'
150
+ }, (req) => {
151
+ req.reply({
152
+ statusCode: 200,
153
+ body: response
154
+ });
155
+ }).as('response-replace-nodes');
156
+ }
157
+
158
+ static stubClusterConfigByList(nodes) {
159
+ const clusterConfig = {
160
+ "electionMinTimeout": 8000,
161
+ "electionRangeTimeout": 6000,
162
+ "heartbeatInterval": 2000,
163
+ "messageSizeKB": 64,
164
+ "verificationTimeout": 1500,
165
+ "transactionLogMaximumSizeGB": 50.0,
166
+ "batchUpdateInterval": 5000,
167
+ "nodes": nodes
168
+ };
169
+
170
+ cy.intercept('GET', '/rest/cluster/config', {
171
+ body: clusterConfig,
172
+ statusCode: 200
173
+ }).as('cluster-config-list');
174
+ }
175
+
176
+ static stubCreateClusterByList(nodes) {
177
+ const clusterConfig = {
178
+ "electionMinTimeout": 8000,
179
+ "electionRangeTimeout": 6000,
180
+ "heartbeatInterval": 2000,
181
+ "messageSizeKB": 64,
182
+ "verificationTimeout": 1500,
183
+ "transactionLogMaximumSizeGB": 50.0,
184
+ "batchUpdateInterval": 5000,
185
+ "nodes": nodes
186
+ };
187
+
188
+ cy.intercept('/rest/cluster/httpConfig', {
189
+ body: clusterConfig,
190
+ statusCode: 201
191
+ }).as('2-nodes-cluster-created');
192
+ }
193
+
74
194
  }
@@ -32,6 +32,16 @@ export class RemoteLocationStubs extends Stubs {
32
32
  }).as('check-remote-location');
33
33
  }
34
34
 
35
+ static stubRemoteLocationCheckByAddress(addresses) {
36
+ addresses.forEach((address) => {
37
+ cy.intercept(
38
+ 'GET',
39
+ `/rest/info/rpc-address?location=http:%2F%2F${address.uri}`,
40
+ `${address.rpc}`
41
+ ).as(`check-remote-location-address-${address.uri}`);
42
+ });
43
+ }
44
+
35
45
  static stubRemoteLocationFilter() {
36
46
  cy.intercept('GET', '/rest/locations?filterClusterLocations=true', {
37
47
  fixture: '/remote-location/remote-location-check'
@@ -49,4 +59,40 @@ export class RemoteLocationStubs extends Stubs {
49
59
  fixture: '/remote-location/remote-location-status-not-in-cluster.json'
50
60
  }).as('remote-location-status-not-in-cluster');
51
61
  }
62
+
63
+ static stubGetRemoteLocationsByList(uris) {
64
+ const local = [{
65
+ "uri": "",
66
+ "label": "Local",
67
+ "username": "",
68
+ "password": "",
69
+ "authType": "signature",
70
+ "active": false,
71
+ "local": true,
72
+ "system": false,
73
+ "errorMsg": null,
74
+ "defaultRepository": null,
75
+ "isInCluster": false
76
+ }];
77
+ const locations = uris.map((uri) => {
78
+ return {
79
+ "uri": uri,
80
+ "label": `Remote (${uri})`,
81
+ "username": "",
82
+ "password": "",
83
+ "authType": "signature",
84
+ "active": false,
85
+ "local": false,
86
+ "system": false,
87
+ "errorMsg": null,
88
+ "defaultRepository": null,
89
+ "isInCluster": false
90
+ };
91
+ });
92
+
93
+ cy.intercept('GET', '/rest/locations', {
94
+ body: [...local, ...locations],
95
+ statusCode: 200
96
+ }).as('get-remote-locations-by-list');
97
+ }
52
98
  }
@@ -0,0 +1,39 @@
1
+ import {Stubs} from "./stubs";
2
+
3
+ export class ConnectorStubs extends Stubs {
4
+ static stubGetConnectors() {
5
+ this.stubQueryResponse('/rest/connectors', '/connectors/get-connectors.json', 'get-connectors');
6
+ }
7
+
8
+ static stubGetRetrievalConnector(fixture = `/connectors/get-retrieval-connector.json`) {
9
+ this.stubQueryResponse(
10
+ `/rest/connectors/existing?prefix=http%3A%2F%2Fwww.ontotext.com%2Fconnectors%2Fretrieval%23`,
11
+ fixture,
12
+ 'get-connector'
13
+ );
14
+ }
15
+
16
+ /**
17
+ * Stubs ChatGPT connectors for three repositories:
18
+ * <ol>
19
+ * <li> "starwars" - it has two connectors "ChatGPT_starwars_one" and "ChatGPT_starwars_two"
20
+ * <li> "biomarkers" - it has one connector "ChatGPT_biomarkers_one"
21
+ * <li> "ttyg-repo-1725518186812" - it has no any connections.
22
+ * </ol>
23
+ * @param {number} delay
24
+ */
25
+ static stubTTYGChatGPTConnectors(delay = 0) {
26
+ cy.fixture('/connectors/get-ttyg-chatgpt-connectors.json').then((body) => {
27
+ cy.intercept('/rest/connectors/existing?prefix=http%3A%2F%2Fwww.ontotext.com%2Fconnectors%2Fretrieval%23', (req) => {
28
+ const repositoryId = req.headers['x-graphdb-repository'];
29
+ const connectors = body[repositoryId];
30
+ // Respond with the modified body
31
+ req.reply({
32
+ statusCode: 200,
33
+ body: JSON.stringify(connectors),
34
+ delay: delay
35
+ });
36
+ }).as('get-ttyg-ChatGPT-connector');
37
+ });
38
+ }
39
+ }
@@ -0,0 +1,27 @@
1
+ export class EnvironmentStubs {
2
+ static stubWbProdMode() {
3
+ cy.window().then((win) => {
4
+ win.wbDevMode = false;
5
+ });
6
+ }
7
+
8
+ static stubWbDevMode() {
9
+ cy.window().then((win) => {
10
+ win.wbDevMode = true;
11
+ });
12
+ }
13
+
14
+ static stubProductInfo(productVersion) {
15
+ cy.intercept('GET', '/rest/info/version?local=1', {
16
+ statusCode: 200,
17
+ body: {
18
+ "productType": "free",
19
+ productVersion,
20
+ "connectors": "16.2.11-RC1",
21
+ "sesame": "4.3.13",
22
+ "Workbench": "2.8.0-TR5"
23
+ }
24
+ }).as('productInfo');
25
+
26
+ }
27
+ }