graphdb-workbench-tests 2.8.0-Test → 2.8.0

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 (117) 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-with-tag.json +47 -0
  10. package/fixtures/cluster/3-nodes-cluster-group-status.json +12 -3
  11. package/fixtures/cluster/4-nodes-cluster-group-status.json +58 -0
  12. package/fixtures/cluster/cluster-config.json +1 -0
  13. package/fixtures/cluster/cluster-node-status.json +4 -1
  14. package/fixtures/cluster/no-cluster-group-status.json +2 -1
  15. package/fixtures/cluster/no-cluster-node-status.json +2 -1
  16. package/fixtures/cluster/save-cluster-configuration-response.json +10 -0
  17. package/fixtures/connectors/get-retrieval-connector.json +1 -1
  18. package/fixtures/connectors/get-ttyg-chatgpt-connectors.json +188 -0
  19. package/fixtures/locale-en.json +382 -101
  20. package/fixtures/remote-location/get-0-remote-locations.json +1 -2
  21. package/fixtures/remote-location/get-1-remote-locations.json +2 -4
  22. package/fixtures/remote-location/get-2-remote-locations.json +3 -6
  23. package/fixtures/remote-location/get-3-remote-locations.json +4 -8
  24. package/fixtures/remote-location/get-4-remote-locations.json +54 -0
  25. package/fixtures/remote-location/remote-location-status-in-cluster.json +1 -2
  26. package/fixtures/remote-location/remote-location-status-not-in-cluster.json +1 -2
  27. package/fixtures/remote-location/remote-locations-filter.json +1 -2
  28. package/fixtures/repositories/get-locations.json +5 -10
  29. package/fixtures/repositories/get-ttyg-repositories.json +28 -0
  30. package/fixtures/security/get-admin-user.json +22 -0
  31. package/fixtures/similarity/get-ttyg-similarity-connectors.json +46 -0
  32. package/fixtures/ttyg/agent/create-agent.json +2 -1
  33. package/fixtures/ttyg/agent/get-agent-defaults.json +42 -0
  34. package/fixtures/ttyg/agent/get-agent-list-after-deleted.json +1 -1
  35. package/fixtures/ttyg/agent/get-agent-list-new-agent.json +2 -73
  36. package/fixtures/ttyg/agent/get-agent-list.json +1 -1
  37. package/fixtures/ttyg/agent/get-agent.json +25 -0
  38. package/fixtures/ttyg/chats/ask-question.json +25 -0
  39. package/fixtures/ttyg/chats/create/create-chat-response.json +16 -0
  40. package/fixtures/ttyg/chats/create/get-chats-after-create.json +12 -0
  41. package/fixtures/ttyg/chats/create/get-chats-before-create.json +7 -0
  42. package/fixtures/ttyg/chats/explain-response-1.json +59 -0
  43. package/fixtures/ttyg/chats/explain-response-2.json +59 -0
  44. package/fixtures/ttyg/chats/get-chat.json +199 -0
  45. package/integration/cluster/cluster-configuration/cluster-configuration-multi-region.spec.js +97 -0
  46. package/integration/cluster/cluster-configuration/cluster-configuration-nodes.spec.js +70 -0
  47. package/integration/cluster/cluster-configuration/cluster-configuration-properties.spec.js +95 -0
  48. package/integration/cluster/cluster-configuration/cluster-configuration.spec.js +38 -0
  49. package/integration/cluster/cluster-legend.spec.js +1 -0
  50. package/integration/cluster/edit-cluster-nodes-modal.spec.js +425 -0
  51. package/integration/explore/graphs.overview.spec.js +4 -0
  52. package/integration/explore/similariti-index-create.spec.js +1 -1
  53. package/integration/explore/similarity-index.spec.js +1 -1
  54. package/integration/explore/visual-graph/visual.graph.spec.js +31 -35
  55. package/integration/home/cookie-policy.spec.js +83 -0
  56. package/integration/home/create-repository.spec.js +35 -0
  57. package/integration/home/documentation-link.spec.js +60 -0
  58. package/integration/home/google-analytics.spec.js +60 -0
  59. package/integration/home/language-selector.spec.js +19 -0
  60. package/integration/home/rdf-resource-search.spec.js +192 -0
  61. package/integration/home/view-resource-autocomplete.spec.js +52 -0
  62. package/integration/home/workbench.home.spec.js +1 -277
  63. package/integration/import/import-user-data-file-upload.spec.js +13 -0
  64. package/integration/import/import-user-data.spec.js +6 -1
  65. package/integration/import/import-view.spec.js +6 -1
  66. package/integration/license/license.spec.js +26 -0
  67. package/integration/repository/attach-remote-location.spec.js +94 -40
  68. package/integration/repository/repositories.spec.js +1 -7
  69. package/integration/setup/my-settings.spec.js +13 -21
  70. package/integration/ttyg/agent-list.spec.js +27 -25
  71. package/integration/ttyg/agent-select-menu.spec.js +18 -16
  72. package/integration/ttyg/chat-list.spec.js +72 -9
  73. package/integration/ttyg/chat-panel.spec.js +106 -10
  74. package/integration/ttyg/clone-agent.spec.js +8 -4
  75. package/integration/ttyg/create-agent.spec.js +303 -51
  76. package/integration/ttyg/create-chat.spec.js +68 -0
  77. package/integration/ttyg/delete-agent.spec.js +6 -5
  78. package/integration/ttyg/edit-agent.spec.js +16 -5
  79. package/integration/ttyg/ttyg-permission.spec.js +66 -0
  80. package/integration/ttyg/ttyg-view.spec.js +8 -4
  81. package/npm-shrinkwrap.json +215 -220
  82. package/package.json +5 -6
  83. package/steps/alert-dialog-steps.js +25 -0
  84. package/steps/cluster/cluster-configuration-steps.js +173 -5
  85. package/steps/cluster/cluster-page-steps.js +8 -0
  86. package/steps/cluster/custer-nodes-configuration-steps.js +107 -0
  87. package/steps/home-steps.js +48 -5
  88. package/steps/import/import-steps.js +11 -7
  89. package/steps/license-steps.js +25 -0
  90. package/steps/repositories/attach-repository-steps.js +33 -0
  91. package/steps/repository-steps.js +26 -11
  92. package/steps/setup/settings-steps.js +17 -0
  93. package/steps/ttyg/chat-panel-steps.js +31 -6
  94. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +82 -4
  95. package/steps/ttyg/ttyg-view-steps.js +77 -3
  96. package/steps/visual-graph-steps.js +29 -1
  97. package/stubs/cluster/cluster-stubs.js +162 -7
  98. package/stubs/cluster/remote-location-stubs.js +46 -0
  99. package/stubs/connector-stubs.js +24 -0
  100. package/stubs/environment-stubs.js +27 -0
  101. package/stubs/license-stubs.js +108 -0
  102. package/stubs/repositories/repositories-stubs.js +11 -8
  103. package/stubs/repositories-stub.js +15 -0
  104. package/stubs/security-stubs.js +29 -0
  105. package/stubs/similarity-index-stubs.js +25 -0
  106. package/stubs/stubs.js +4 -0
  107. package/stubs/ttyg/ttyg-stubs.js +79 -40
  108. package/support/commands.js +2 -0
  109. package/support/index.js +18 -0
  110. package/support/security-command.js +25 -0
  111. package/support/settings-commands.js +4 -5
  112. package/support/user-commands.js +31 -0
  113. package/fixtures/ttyg/chats/get-chat-1.json +0 -43
  114. package/integration/cluster/cluster-management.spec.js +0 -220
  115. package/steps/cluster/add-remote-location-dialog-steps.js +0 -11
  116. package/steps/cluster/create-cluster-dialog-steps.js +0 -39
  117. package/steps/cluster/replace-nodes-dialog-steps.js +0 -39
@@ -4,11 +4,15 @@ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
4
4
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
5
5
  import {ApplicationSteps} from "../../steps/application-steps";
6
6
  import HomeSteps from "../../steps/home-steps";
7
+ import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
8
+ import {AlertDialogSteps} from "../../steps/alert-dialog-steps";
9
+ import {RepositoriesStub} from "../../stubs/repositories-stub";
7
10
 
8
11
  describe('TTYG chat list', () => {
9
12
 
10
13
  beforeEach(() => {
11
14
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
15
+ RepositoriesStub.stubBaseEndpoints('starwars');
12
16
  cy.presetRepository('starwars');
13
17
  });
14
18
 
@@ -16,10 +20,12 @@ describe('TTYG chat list', () => {
16
20
  TTYGStubs.stubChatsListGet();
17
21
  TTYGStubs.stubChatGet();
18
22
  TTYGStubs.stubAgentListGet();
19
- TTYGStubs.stubChatGet();
20
23
  // Given I have opened the ttyg page
21
24
  TTYGViewSteps.visit();
25
+ cy.wait('@get-chat-list');
22
26
  cy.wait('@get-chat');
27
+ cy.wait('@get-all-repositories');
28
+ cy.wait('@get-agent-list');
23
29
  // When the ttyg page is loaded
24
30
  // Then I should see the chat list
25
31
  // TODO: Temporary removed because it fails on CI.
@@ -41,9 +47,11 @@ describe('TTYG chat list', () => {
41
47
  it('Should render no results when there are no chats', () => {
42
48
  TTYGStubs.stubChatsListGetNoResults();
43
49
  TTYGStubs.stubAgentListGet();
44
- TTYGStubs.stubChatGet();
45
50
  // Given I have opened the ttyg page
46
51
  TTYGViewSteps.visit();
52
+ cy.wait('@get-chat-list');
53
+ cy.wait('@get-all-repositories');
54
+ cy.wait('@get-agent-list');
47
55
  // When the ttyg page is loaded
48
56
  // And there are no chats
49
57
  // Then I expect chat list panel to be hidden
@@ -64,10 +72,12 @@ describe('TTYG chat list', () => {
64
72
  TTYGStubs.stubChatGet();
65
73
  TTYGStubs.stubAgentListGet();
66
74
  TTYGStubs.stubChatUpdate();
67
- TTYGStubs.stubChatGet();
68
75
  // Given I have opened the ttyg page and there are chats loaded
69
76
  TTYGViewSteps.visit();
70
77
  cy.wait('@get-chat');
78
+ cy.wait('@get-chat-list');
79
+ cy.wait('@get-all-repositories');
80
+ cy.wait('@get-agent-list');
71
81
  // And I double-click on the chat name I want to rename
72
82
  TTYGViewSteps.editChatName(1, 0);
73
83
  // Then I should see the chat name input
@@ -91,12 +101,15 @@ describe('TTYG chat list', () => {
91
101
  TTYGStubs.stubChatGet();
92
102
  TTYGStubs.stubAgentListGet();
93
103
  TTYGStubs.stubChatUpdate();
94
- TTYGStubs.stubChatGet();
95
104
  // Given I have opened the ttyg page and there are chats loaded
96
105
  TTYGViewSteps.visit();
97
106
  cy.wait('@get-chat');
107
+ cy.wait('@get-chat-list');
108
+ cy.wait('@get-all-repositories');
109
+ cy.wait('@get-agent-list');
98
110
  // And I open the action menu for the chat I want to rename
99
111
  TTYGViewSteps.selectChat(1, 0);
112
+ cy.wait('@get-chat');
100
113
  TTYGViewSteps.triggerEditChatActionMenu(1, 0);
101
114
  // Then I should see the chat name input
102
115
  TTYGViewSteps.getChatNameInput(1, 0).should('be.visible').and('have.value', 'Test chat 4');
@@ -113,10 +126,12 @@ describe('TTYG chat list', () => {
113
126
  TTYGStubs.stubChatsListGet();
114
127
  TTYGStubs.stubChatGet();
115
128
  TTYGStubs.stubAgentListGet();
116
- TTYGStubs.stubChatGet();
117
129
  // Given I have opened the ttyg page and there are chats loaded
118
130
  TTYGViewSteps.visit();
119
131
  cy.wait('@get-chat');
132
+ cy.wait('@get-chat-list');
133
+ cy.wait('@get-all-repositories');
134
+ cy.wait('@get-agent-list');
120
135
  // And I double-click on the first chat
121
136
  TTYGViewSteps.editChatName(0, 0);
122
137
  // Then I should see the chat name input
@@ -134,10 +149,12 @@ describe('TTYG chat list', () => {
134
149
  TTYGStubs.stubChatGet();
135
150
  TTYGStubs.stubAgentListGet();
136
151
  TTYGStubs.stubChatDelete();
137
- TTYGStubs.stubChatGet();
138
152
  // Given I have opened the ttyg page and there are chats loaded
139
153
  TTYGViewSteps.visit();
140
154
  cy.wait('@get-chat');
155
+ cy.wait('@get-chat-list');
156
+ cy.wait('@get-all-repositories');
157
+ cy.wait('@get-agent-list');
141
158
  // When I select the delete action from the chat action menu
142
159
  TTYGViewSteps.triggerDeleteChatActionMenu(1, 0);
143
160
  // Then I should see the chat deletion confirmation dialog
@@ -153,6 +170,20 @@ describe('TTYG chat list', () => {
153
170
  ModalDialogSteps.clickOnConfirmButton();
154
171
  // Then the chat should be deleted
155
172
  TTYGViewSteps.getChatByDayGroups().should('have.length', 1);
173
+
174
+ // When I select a chat
175
+ TTYGViewSteps.selectChat(0, 1);
176
+ // Then I expect the chat be loaded
177
+ TTYGViewSteps.getChatFromGroup(0, 1).should('contain', 'Test chat 2');
178
+ TTYGViewSteps.getChatFromGroup(0, 1).should('have.class', 'selected');
179
+ ChatPanelSteps.getChatDetailsElements().should('have.length', 3);
180
+
181
+ // When I delete the selected chat
182
+ TTYGViewSteps.triggerDeleteChatActionMenu(0, 1);
183
+ ModalDialogSteps.clickOnConfirmButton();
184
+
185
+ // Then I expect the chat history to be removed from the chat panel.
186
+ ChatPanelSteps.getChatDetailsElements().should('have.length', 0);
156
187
  });
157
188
 
158
189
  it('Should be able to export chat from chat list export action', () => {
@@ -163,19 +194,24 @@ describe('TTYG chat list', () => {
163
194
  // Given I have opened the ttyg page and there are chats loaded
164
195
  TTYGViewSteps.visit();
165
196
  cy.wait('@get-chat');
197
+ cy.wait('@get-chat-list');
198
+ cy.wait('@get-all-repositories');
199
+ cy.wait('@get-agent-list');
166
200
  // When I select the export chat action chat panel toolbar
167
201
  TTYGViewSteps.triggerExportChatActionMenu(1, 0);
168
202
  cy.wait('@export-chat');
169
203
  // Then I expect to download the chat as a file
170
- TTYGViewSteps.verifyFileExists('chat-export.json')
204
+ TTYGViewSteps.verifyFileExists('chat-export.json');
171
205
  });
172
206
 
173
207
  it('Should show error notification if chat list fails to load', () => {
174
208
  TTYGStubs.stubChatListGetError();
175
209
  TTYGStubs.stubAgentListGet();
176
- TTYGStubs.stubChatGet();
177
210
  // Given I have opened the ttyg page
178
211
  TTYGViewSteps.visit();
212
+ cy.wait('@get-chat-list');
213
+ cy.wait('@get-all-repositories');
214
+ cy.wait('@get-agent-list');
179
215
  // When the chat list fails to load
180
216
  // Then I should see an error notification
181
217
  TTYGViewSteps.getChatListLoadingIndicator().should('not.exist');
@@ -185,13 +221,16 @@ describe('TTYG chat list', () => {
185
221
  TTYGViewSteps.getChatsPanel().should('be.hidden');
186
222
  });
187
223
 
188
- it('should persist selected chat', () => {
224
+ it('Should persist selected chat', () => {
189
225
  TTYGStubs.stubChatsListGet();
190
226
  TTYGStubs.stubChatGet();
191
227
  TTYGStubs.stubAgentListGet();
192
228
  // Given I have opened the ttyg page
193
229
  TTYGViewSteps.visit();
194
230
  cy.wait('@get-chat');
231
+ cy.wait('@get-chat-list');
232
+ cy.wait('@get-all-repositories');
233
+ cy.wait('@get-agent-list');
195
234
  TTYGViewSteps.getChatFromGroup(0, 0).should('have.class', 'selected');
196
235
 
197
236
  // When I select another chat,
@@ -207,6 +246,30 @@ describe('TTYG chat list', () => {
207
246
  // Then I expect to last used chat be selected.
208
247
  TTYGViewSteps.getChatFromGroup(0, 2).should('have.class', 'selected');
209
248
  });
249
+
250
+ it('Should automatically remove the selected chat when it is not found by the backend', () => {
251
+ TTYGStubs.stubChatsListGet();
252
+ TTYGStubs.stubChatGet();
253
+ TTYGStubs.stubAgentListGet();
254
+ // Given I have opened the ttyg page
255
+ TTYGViewSteps.visit();
256
+ cy.wait('@get-all-repositories');
257
+ cy.wait('@get-chat-list');
258
+ cy.wait('@get-chat');
259
+ cy.wait('@get-agent-list');
260
+ // And the page have loaded and the chat list is visible
261
+ TTYGViewSteps.getChatFromGroup(0, 0).should('have.class', 'selected');
262
+ // When I select a chat for which the backend would return 404
263
+ TTYGStubs.stubChatGet404Error();
264
+ TTYGViewSteps.selectChat(0, 2);
265
+ cy.wait('@get-chat');
266
+ // Then I expect an alert to be displayed to the user
267
+ AlertDialogSteps.getDialog().should('be.visible');
268
+ // When I close the alert
269
+ AlertDialogSteps.acceptAlert();
270
+ // Then I expect the chat to be removed from the chat list
271
+ TTYGViewSteps.getChatFromGroup(0, 2).should('not.exist');
272
+ });
210
273
  });
211
274
 
212
275
  /**
@@ -3,12 +3,14 @@ import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
3
  import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
4
4
  import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
5
5
  import {ApplicationSteps} from "../../steps/application-steps";
6
+ import {RepositoriesStub} from "../../stubs/repositories-stub";
6
7
 
7
8
  describe('Ttyg ChatPanel', () => {
8
9
 
9
10
  beforeEach(() => {
10
11
  // Create an actual repository to prevent stubbing all background requests that are not related to the ttyg view
11
12
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
13
+ RepositoriesStub.stubBaseEndpoints('starwars');
12
14
  cy.presetRepository('starwars');
13
15
  TTYGStubs.stubChatsListGet();
14
16
  TTYGStubs.stubAgentListGet();
@@ -16,28 +18,31 @@ describe('Ttyg ChatPanel', () => {
16
18
 
17
19
  // When visiting the TTYG page where there is a chat with questions and answers
18
20
  TTYGViewSteps.visit();
21
+ cy.wait('@get-chat-list');
22
+ cy.wait('@get-agent-list');
23
+ cy.wait('@get-chat');
24
+ cy.wait('@get-all-repositories');
19
25
  });
20
26
 
21
27
  it('Should load chat history and show answer actions', () => {
22
-
28
+ // When I select a chat which last used agent is missing (deleted)
29
+ TTYGViewSteps.selectChat(0, 2);
23
30
  // Then I expect chat history to be displayed
24
31
  ChatPanelSteps.getChatDetailsElements().should('have.length', 2);
25
32
  // and only the actions for the last message are visible.
26
- ChatPanelSteps.getChatDetailActions(0).should('not.be.visible');
27
- ChatPanelSteps.getChatDetailActions(1).should('be.visible');
33
+ ChatPanelSteps.getChatDetailActions(0, 0).should('exist').and('have.css', 'opacity', '0');
34
+ ChatPanelSteps.getChatDetailActions(1, 0).should('exist').and('have.css', 'opacity', '1');
28
35
 
29
36
  // When I hover over the hidden answer actions.
30
- ChatPanelSteps.getChatDetailActions(0).realHover();
37
+ ChatPanelSteps.getChatDetailActions(0, 0).realHover();
31
38
 
32
39
  // Then I expect answer actions to be visible.
33
- ChatPanelSteps.getChatDetailActions(0).should('be.visible');
40
+ ChatPanelSteps.getChatDetailActions(0, 0).should('exist').and('have.css', 'opacity', '1');
34
41
 
35
42
  // When the new question input is empty.
36
43
  // The "Ask" button must be disabled.
37
44
  ChatPanelSteps.getAskButtonElement().should('be.disabled');
38
-
39
- // When I type a question
40
- ChatPanelSteps.getQuestionInputElement().type('Who is Han Solo?');
45
+ ChatPanelSteps.getQuestionInputElement().should('be.disabled');
41
46
 
42
47
  // Then I expect the "Ask" button be not active because agent is not selected
43
48
  ChatPanelSteps.getAskButtonElement().should('not.be.enabled');
@@ -46,26 +51,117 @@ describe('Ttyg ChatPanel', () => {
46
51
  TTYGViewSteps.openAgentsMenu();
47
52
  TTYGViewSteps.selectAgent(0);
48
53
 
54
+ // When I type a question
55
+ ChatPanelSteps.getQuestionInputElement()
56
+ .should('be.visible')
57
+ .and('not.be.disabled')
58
+ .type('Who is Han Solo?');
59
+
49
60
  // Then I expect the "Ask" button be active.
50
61
  ChatPanelSteps.getAskButtonElement().should('be.enabled');
51
62
 
52
63
  // When I click on "Ask" button.
64
+ TTYGStubs.stubAnswerQuestion();
53
65
  ChatPanelSteps.getAskButtonElement().scrollIntoView().click();
54
66
 
55
67
  // Then I expect the question be in chat history,
56
68
  ChatPanelSteps.getChatDetailsElements().should('have.length', 3);
57
69
  ChatPanelSteps.getChatDetailQuestionElement(2).contains('Who is Han Solo?');
58
70
  // and input field be empty,
71
+ ChatPanelSteps.getQuestionInputElement().should('be.enabled');
59
72
  ChatPanelSteps.getQuestionInputElement().should('have.value', '');
60
73
  // and "Ask" button be disabled.
61
74
  ChatPanelSteps.getAskButtonElement().should('be.disabled');
75
+ // and only the actions for the last message are visible.
76
+ ChatPanelSteps.getChatDetailActions(2, 0).should('not.be.visible');
77
+ ChatPanelSteps.getChatDetailActions(2, 1).should('be.visible');
62
78
 
63
- // When I click on regenerate button.
64
- ChatPanelSteps.regenerateQuestion(2);
79
+ // When I click on regenerate button on the last response => +2 messages
80
+ TTYGStubs.stubAnswerQuestion();
81
+ ChatPanelSteps.regenerateQuestion(2, 1);
65
82
 
66
83
  // Then I expect the question to be regenerated and appear in the chat history.
67
84
  ChatPanelSteps.getChatDetailsElements().should('have.length', 4);
85
+ });
86
+
87
+ it('Should show info message that the agent is changed', () => {
88
+ // When select a chat that has answers using different agents
89
+ TTYGViewSteps.selectChat(0, 1);
90
+
91
+ // Then I expect to see one messages indicating the agent change.
92
+ ChatPanelSteps.getAgentInfoMessages().should('have.length', 1);
93
+ ChatPanelSteps.getAgentInfoMessage(0).contains('Agent changed to agent-2');
94
+
95
+ // When I change the selected agent to one that has not been used yet.
96
+ TTYGViewSteps.openAgentsMenu();
97
+ TTYGViewSteps.selectAgent(3);
98
+ // and ask a new question or click on regenerate button.
99
+ TTYGStubs.stubAnswerQuestion();
100
+ ChatPanelSteps.regenerateQuestion(2);
101
+ // Then I expect to see one messages indicating the agent change.
102
+ ChatPanelSteps.getAgentInfoMessages().should('have.length', 2);
103
+ // The last one is because the agent of the last chat item is different from the selected agent.
104
+ ChatPanelSteps.getAgentInfoMessage(1).contains('Agent changed to Databricks-biomarkers');
105
+ });
106
+
107
+ it('Should select last used agent when change the selected chat', () => {
108
+ // Then I expect the last used agent to be selected.
109
+ TTYGViewSteps.getAgentsMenuToggleButton().contains('agent-1');
110
+
111
+ // When I select another chat that last used agent is different.
112
+ TTYGViewSteps.selectChat(0, 1);
113
+ TTYGViewSteps.getChatFromGroup(0, 1).should('have.class', 'selected');
114
+ // Then I expect the last used agent be selected.
115
+ TTYGViewSteps.getAgentsMenuToggleButton().contains('agent-2');
116
+ });
117
+
118
+ it('Should displays explain response', () => {
119
+ // When I visit the TTYG page, a chat with two questions and answers is loaded.
120
+ // Wait to chat be loaded
121
+ ChatPanelSteps.getChatDetailsElements().should('have.length', 2);
68
122
 
123
+ // Quirk - the first explain response button is sometimes visible and the test fails
124
+ // so by hovering over the view title h1 element we make it disappear
125
+ cy.get('h1').realHover();
126
+ // Then, I expect only the last "Explain" button to be visible.
127
+ TTYGViewSteps.getExplainResponseButton(0).should('not.be.visible');
128
+ TTYGViewSteps.getExplainResponseButton(1).should('be.visible');
129
+
130
+ // When I click on first explain response button
131
+ TTYGViewSteps.getExplainResponseButton(0).realHover();
132
+ // Then I expect to explain button to be visible.
133
+ TTYGViewSteps.getExplainResponseButton(0).should('be.visible');
134
+
135
+ // When I click on the button.
136
+ TTYGStubs.stubExplainResponse();
137
+ TTYGViewSteps.clickOnExplainResponse(0);
138
+ // Then I expect the hint message to not exist (it should only exist for the last 'Explain' response).
139
+ TTYGViewSteps.getHowDeliverAnswerButton().should('not.exist');
140
+
141
+ // Then when I click on explain response button on the second answer
142
+ TTYGStubs.stubExplainResponse('/ttyg/chats/explain-response-2.json');
143
+ TTYGViewSteps.clickOnExplainResponse(1);
144
+ // Then I expect the hint message to exist (it should only exist for the last 'Explain' response).
145
+ TTYGViewSteps.getHowDeliverAnswerButton().should('exist');
146
+ TTYGViewSteps.getHowDeliverAnswerButton().should('have.length', 1);
147
+ // and the raw query in the first query method does not exist because the raw query and query are identical.
148
+ TTYGViewSteps.getRawQuery(1, 0).should('not.exist');
149
+ // it's a SPARQL query
150
+ TTYGViewSteps.getQueryMethodElement(1, 0).should('contain', "SPARQL");
151
+ TTYGViewSteps.getQueryMethodDetailsElement(1, 0).should('contain', "Direct query");
152
+ TTYGViewSteps.getExplainQueryQueryElement(1, 0).contains(" SELECT ?character ?name ?height");
153
+
154
+ // the second query - JSON
155
+ TTYGViewSteps.getQueryMethodElement(1, 1).should('contain', "ChatGPT Retrieval");
156
+ TTYGViewSteps.getQueryMethodDetailsElement(1, 1).should('contain', "Direct JSON query");
157
+ TTYGViewSteps.getExplainQueryQueryElement(1, 1).contains("{\n \"queries\" : [ {\n \"query\" : \"pilots that work with Luke Skywalker\",\n \"filter\" : {\n \"document");
158
+
159
+ // the third query - FTS IRI to SPARQL
160
+ // raw query should exist because raw query and query are not identical.
161
+ TTYGViewSteps.getRawQuery(1, 2).should('exist');
162
+ TTYGViewSteps.getQueryMethodElement(1, 2).should('contain', "FTS for IRI discovery");
163
+ TTYGViewSteps.getQueryMethodDetailsElement(1, 2).should('contain', "via SPARQL");
164
+ TTYGViewSteps.getExplainQueryQueryElement(1, 2).contains("PREFIX rdfs: <http://www.w3.org/2000/01/rdf-sch");
69
165
  });
70
166
 
71
167
  // Can't test this on CI
@@ -1,16 +1,17 @@
1
1
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
2
- import {NamespaceStubs} from "../../stubs/namespace-stubs";
3
2
  import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
4
3
  import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
5
4
  import {TtygAgentSettingsModalSteps} from "../../steps/ttyg/ttyg-agent-settings-modal.steps";
5
+ import {RepositoriesStub} from "../../stubs/repositories-stub";
6
6
 
7
7
  describe('TTYG clone an agent', () => {
8
8
  const repositoryId = 'starwars';
9
9
 
10
10
  beforeEach(() => {
11
11
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
12
+ RepositoriesStub.stubBaseEndpoints(repositoryId);
12
13
  cy.presetRepository(repositoryId);
13
- NamespaceStubs.stubNameSpaceResponse(repositoryId, '/namespaces/get-repository-starwars-namespaces.json');
14
+ TTYGStubs.stubAgentDefaultsGet();
14
15
  });
15
16
 
16
17
  it(' should be able to clone an agent.', () => {
@@ -19,8 +20,11 @@ describe('TTYG clone an agent', () => {
19
20
  TTYGStubs.stubChatGet();
20
21
  // Given I have opened the ttyg page
21
22
  TTYGViewSteps.visit();
23
+ cy.wait('@get-all-repositories');
22
24
  cy.wait('@get-chat');
25
+ cy.wait('@get-agent-list');
23
26
  // When I select to clone an agent
27
+ TTYGViewSteps.expandAgentsSidebar();
24
28
  TTYGViewSteps.triggerCloneAgentActionMenu(0);
25
29
  // Then I expect to see the clone agent settings modal
26
30
  TtygAgentSettingsModalSteps.getDialog().should('be.visible');
@@ -49,10 +53,10 @@ describe('TTYG clone an agent', () => {
49
53
  "model": "gpt-4o",
50
54
  "temperature": 0,
51
55
  "topP": 0,
52
- "seed": null,
56
+ "seed": 0,
53
57
  "assistantsInstructions": {
54
58
  "systemInstruction": "",
55
- "userInstruction": ""
59
+ "userInstruction": "If you need to write a SPARQL query, use only the classes and properties provided in the schema and don't invent or guess any. Always try to return human-readable names or labels and not only the IRIs. If SPARQL fails to provide the necessary information you can try another tool too."
56
60
  },
57
61
  "assistantExtractionMethods": [
58
62
  {