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.
- package/cypress.config.js +3 -0
- package/fixtures/cluster/2-nodes-cluster-group-status-deleted.json +30 -0
- package/fixtures/cluster/2-nodes-cluster-group-status.json +30 -0
- package/fixtures/cluster/3-nodes-cluster-group-status-after-replace.json +44 -0
- package/fixtures/cluster/3-nodes-cluster-group-status-building-snapshot.json +4 -1
- package/fixtures/cluster/3-nodes-cluster-group-status-receiving-snapshot.json +4 -1
- package/fixtures/cluster/3-nodes-cluster-group-status-sending-snapshot.json +4 -1
- package/fixtures/cluster/3-nodes-cluster-group-status-waiting-for-snapshot.json +4 -1
- package/fixtures/cluster/3-nodes-cluster-group-status.json +12 -3
- package/fixtures/cluster/4-nodes-cluster-group-status.json +58 -0
- package/fixtures/cluster/cluster-config.json +1 -0
- package/fixtures/cluster/cluster-node-status.json +4 -1
- package/fixtures/connectors/get-connectors.json +8 -0
- package/fixtures/connectors/get-retrieval-connector-0.json +1 -0
- package/fixtures/connectors/get-retrieval-connector.json +29 -0
- package/fixtures/connectors/get-ttyg-chatgpt-connectors.json +188 -0
- package/fixtures/locale-en.json +630 -61
- package/fixtures/namespaces/get-repository-starwars-namespaces.json +252 -0
- package/fixtures/remote-location/get-0-remote-locations.json +1 -2
- package/fixtures/remote-location/get-1-remote-locations.json +2 -4
- package/fixtures/remote-location/get-2-remote-locations.json +3 -6
- package/fixtures/remote-location/get-3-remote-locations.json +4 -8
- package/fixtures/remote-location/get-4-remote-locations.json +54 -0
- package/fixtures/remote-location/remote-location-status-in-cluster.json +1 -2
- package/fixtures/remote-location/remote-location-status-not-in-cluster.json +1 -2
- package/fixtures/remote-location/remote-locations-filter.json +1 -2
- package/fixtures/repositories/get-locations.json +67 -0
- package/fixtures/repositories/get-repositories.json +106 -0
- package/fixtures/repositories/get-repository-config-starwars-disabled-fts.json +201 -0
- package/fixtures/repositories/get-repository-config-starwars-enabled-fts.json +201 -0
- package/fixtures/repositories/get-ttyg-repositories.json +74 -0
- package/fixtures/similarity/get-similarity-indexes-0.json +1 -0
- package/fixtures/similarity/get-similarity-indexes.json +15 -0
- package/fixtures/similarity/get-ttyg-similarity-connectors.json +46 -0
- package/fixtures/ttyg/agent/create-agent.json +20 -0
- package/fixtures/ttyg/agent/get-agent-defaults.json +42 -0
- package/fixtures/ttyg/agent/get-agent-list-0.json +1 -0
- package/fixtures/ttyg/agent/get-agent-list-after-deleted.json +56 -0
- package/fixtures/ttyg/agent/get-agent-list-new-agent.json +22 -0
- package/fixtures/ttyg/agent/get-agent-list.json +77 -0
- package/fixtures/ttyg/agent/get-agent.json +25 -0
- package/fixtures/ttyg/chats/ask-question.json +25 -0
- package/fixtures/ttyg/chats/create/create-chat-response.json +16 -0
- package/fixtures/ttyg/chats/create/get-chats-after-create.json +12 -0
- package/fixtures/ttyg/chats/create/get-chats-before-create.json +7 -0
- package/fixtures/ttyg/chats/deleted-chat.json +3 -0
- package/fixtures/ttyg/chats/explain-response-1.json +59 -0
- package/fixtures/ttyg/chats/explain-response-2.json +59 -0
- package/fixtures/ttyg/chats/export-chat.json +34 -0
- package/fixtures/ttyg/chats/get-chat-list-0.json +1 -0
- package/fixtures/ttyg/chats/get-chat-list-with-deleted-chat.json +17 -0
- package/fixtures/ttyg/chats/get-chat-list-with-renamed-chat.json +22 -0
- package/fixtures/ttyg/chats/get-chat-list.json +22 -0
- package/fixtures/ttyg/chats/get-chat.json +199 -0
- package/fixtures/ttyg/chats/renamed-chat.json +4 -0
- package/integration/cluster/cluster-management.spec.js +0 -170
- package/integration/cluster/edit-cluster-nodes-modal.spec.js +425 -0
- package/integration/explore/graphs.overview.spec.js +4 -0
- package/integration/home/cookie-policy.spec.js +65 -0
- package/integration/home/create-repository.spec.js +35 -0
- package/integration/home/documentation-link.spec.js +60 -0
- package/integration/home/google-analytics.spec.js +60 -0
- package/integration/home/language-selector.spec.js +19 -0
- package/integration/home/rdf-resource-search.spec.js +192 -0
- package/integration/home/view-resource-autocomplete.spec.js +52 -0
- package/integration/home/workbench.home.spec.js +1 -277
- package/integration/import/import-user-data-file-upload.spec.js +13 -0
- package/integration/import/import-user-data.spec.js +8 -2
- package/integration/import/import-view.spec.js +6 -1
- package/integration/repository/attach-remote-location.spec.js +203 -0
- package/integration/repository/ontop-repository.spec.js +87 -1
- package/integration/repository/repositories.spec.js +4 -19
- package/integration/setup/my-settings.spec.js +2 -0
- package/integration/ttyg/agent-list.spec.js +76 -0
- package/integration/ttyg/agent-select-menu.spec.js +141 -0
- package/integration/ttyg/chat-list.spec.js +286 -0
- package/integration/ttyg/chat-panel.spec.js +175 -0
- package/integration/ttyg/clone-agent.spec.js +75 -0
- package/integration/ttyg/create-agent.spec.js +560 -0
- package/integration/ttyg/create-chat.spec.js +69 -0
- package/integration/ttyg/delete-agent.spec.js +51 -0
- package/integration/ttyg/edit-agent.spec.js +54 -0
- package/integration/ttyg/ttyg-permission.spec.js +66 -0
- package/integration/ttyg/ttyg-view.spec.js +75 -0
- package/npm-shrinkwrap.json +215 -220
- package/package.json +5 -6
- package/steps/alert-dialog-steps.js +25 -0
- package/steps/cluster/cluster-page-steps.js +8 -0
- package/steps/cluster/custer-nodes-configuration-steps.js +107 -0
- package/steps/home-steps.js +48 -5
- package/steps/import/import-steps.js +11 -11
- package/steps/modal-dialog-steps.js +8 -0
- package/steps/ontop-repository-steps.js +26 -0
- package/steps/repositories/attach-repository-steps.js +118 -0
- package/steps/repository-steps.js +53 -5
- package/steps/setup/settings-steps.js +17 -0
- package/steps/ttyg/chat-panel-steps.js +62 -0
- package/steps/ttyg/ttyg-agent-settings-modal.steps.js +462 -0
- package/steps/ttyg/ttyg-view-steps.js +333 -0
- package/steps/window-steps.js +5 -0
- package/stubs/cluster/cluster-stubs.js +127 -7
- package/stubs/cluster/remote-location-stubs.js +46 -0
- package/stubs/connector-stubs.js +39 -0
- package/stubs/environment-stubs.js +27 -0
- package/stubs/license-stubs.js +101 -0
- package/stubs/repositories/repositories-stubs.js +133 -0
- package/stubs/repositories-stub.js +15 -0
- package/stubs/security-stubs.js +7 -0
- package/stubs/similarity-index-stubs.js +32 -0
- package/stubs/stubs.js +4 -0
- package/stubs/ttyg/ttyg-stubs.js +166 -0
- package/support/commands.js +2 -0
- package/support/index.js +17 -0
- package/support/security-command.js +25 -0
- package/support/settings-commands.js +4 -5
- package/support/user-commands.js +31 -0
- package/steps/cluster/add-remote-location-dialog-steps.js +0 -11
- package/steps/cluster/create-cluster-dialog-steps.js +0 -39
- package/steps/cluster/replace-nodes-dialog-steps.js +0 -39
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
|
|
2
|
+
import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
|
|
3
|
+
import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
|
|
4
|
+
import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
|
|
5
|
+
import {ApplicationSteps} from "../../steps/application-steps";
|
|
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";
|
|
10
|
+
|
|
11
|
+
describe('TTYG chat list', () => {
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
|
|
15
|
+
RepositoriesStub.stubBaseEndpoints('starwars');
|
|
16
|
+
cy.presetRepository('starwars');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('Should render chat list', () => {
|
|
20
|
+
TTYGStubs.stubChatsListGet();
|
|
21
|
+
TTYGStubs.stubChatGet();
|
|
22
|
+
TTYGStubs.stubAgentListGet();
|
|
23
|
+
// Given I have opened the ttyg page
|
|
24
|
+
TTYGViewSteps.visit();
|
|
25
|
+
cy.wait('@get-chat-list');
|
|
26
|
+
cy.wait('@get-chat');
|
|
27
|
+
cy.wait('@get-all-repositories');
|
|
28
|
+
cy.wait('@get-agent-list');
|
|
29
|
+
// When the ttyg page is loaded
|
|
30
|
+
// Then I should see the chat list
|
|
31
|
+
// TODO: Temporary removed because it fails on CI.
|
|
32
|
+
// TTYGViewSteps.getChatListLoadingIndicator().should('be.visible');
|
|
33
|
+
TTYGViewSteps.getChatsPanel().should('be.visible');
|
|
34
|
+
// And I should see 7 chat groups by day
|
|
35
|
+
TTYGViewSteps.getChatByDayGroups().should('have.length', 2);
|
|
36
|
+
// And the first chat group should have 3 chats
|
|
37
|
+
verifyChatList([
|
|
38
|
+
[
|
|
39
|
+
{name: 'Test chat 3'},
|
|
40
|
+
{name: 'Test chat 2'},
|
|
41
|
+
{name: 'Very long chat name which does not fit in the sidebar'}
|
|
42
|
+
],
|
|
43
|
+
[{name: 'Test chat 4'}]
|
|
44
|
+
]);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('Should render no results when there are no chats', () => {
|
|
48
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
49
|
+
TTYGStubs.stubAgentListGet();
|
|
50
|
+
// Given I have opened the ttyg page
|
|
51
|
+
TTYGViewSteps.visit();
|
|
52
|
+
cy.wait('@get-chat-list');
|
|
53
|
+
cy.wait('@get-all-repositories');
|
|
54
|
+
cy.wait('@get-agent-list');
|
|
55
|
+
// When the ttyg page is loaded
|
|
56
|
+
// And there are no chats
|
|
57
|
+
// Then I expect chat list panel to be hidden
|
|
58
|
+
TTYGViewSteps.getChatsPanel().should('be.hidden');
|
|
59
|
+
// When I open the chat list
|
|
60
|
+
TTYGViewSteps.expandChatsSidebar();
|
|
61
|
+
// Then I should see no chats
|
|
62
|
+
TTYGViewSteps.getChatByDayGroups().should('have.length', 0);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('Should be able to edit an existing chat name by double click on the chat in the list', {
|
|
66
|
+
retries: {
|
|
67
|
+
runMode: 1,
|
|
68
|
+
openMode: 0
|
|
69
|
+
}
|
|
70
|
+
}, () => {
|
|
71
|
+
TTYGStubs.stubChatsListGet();
|
|
72
|
+
TTYGStubs.stubChatGet();
|
|
73
|
+
TTYGStubs.stubAgentListGet();
|
|
74
|
+
TTYGStubs.stubChatUpdate();
|
|
75
|
+
// Given I have opened the ttyg page and there are chats loaded
|
|
76
|
+
TTYGViewSteps.visit();
|
|
77
|
+
cy.wait('@get-chat');
|
|
78
|
+
cy.wait('@get-chat-list');
|
|
79
|
+
cy.wait('@get-all-repositories');
|
|
80
|
+
cy.wait('@get-agent-list');
|
|
81
|
+
// And I double-click on the chat name I want to rename
|
|
82
|
+
TTYGViewSteps.editChatName(1, 0);
|
|
83
|
+
// Then I should see the chat name input
|
|
84
|
+
TTYGViewSteps.getChatNameInput(1, 0).should('be.visible').and('have.value', 'Test chat 4');
|
|
85
|
+
// When I change the chat name
|
|
86
|
+
TTYGViewSteps.writeChatName(1, 0, 'New chat name');
|
|
87
|
+
// And I hit [enter] key
|
|
88
|
+
TTYGStubs.stubChatsListGet('/ttyg/chats/get-chat-list-with-renamed-chat.json');
|
|
89
|
+
TTYGViewSteps.saveChatName(1, 0);
|
|
90
|
+
// Then I should see the new chat name
|
|
91
|
+
TTYGViewSteps.getChatFromGroup(1, 0).should('contain', 'New chat name');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('Should be able to edit an existing chat name through the action menu', {
|
|
95
|
+
retries: {
|
|
96
|
+
runMode: 1,
|
|
97
|
+
openMode: 0
|
|
98
|
+
}
|
|
99
|
+
}, () => {
|
|
100
|
+
TTYGStubs.stubChatsListGet();
|
|
101
|
+
TTYGStubs.stubChatGet();
|
|
102
|
+
TTYGStubs.stubAgentListGet();
|
|
103
|
+
TTYGStubs.stubChatUpdate();
|
|
104
|
+
// Given I have opened the ttyg page and there are chats loaded
|
|
105
|
+
TTYGViewSteps.visit();
|
|
106
|
+
cy.wait('@get-chat');
|
|
107
|
+
cy.wait('@get-chat-list');
|
|
108
|
+
cy.wait('@get-all-repositories');
|
|
109
|
+
cy.wait('@get-agent-list');
|
|
110
|
+
// And I open the action menu for the chat I want to rename
|
|
111
|
+
TTYGViewSteps.selectChat(1, 0);
|
|
112
|
+
cy.wait('@get-chat');
|
|
113
|
+
TTYGViewSteps.triggerEditChatActionMenu(1, 0);
|
|
114
|
+
// Then I should see the chat name input
|
|
115
|
+
TTYGViewSteps.getChatNameInput(1, 0).should('be.visible').and('have.value', 'Test chat 4');
|
|
116
|
+
// When I change the chat name
|
|
117
|
+
TTYGViewSteps.writeChatName(1, 0, 'New chat name');
|
|
118
|
+
// And I hit [enter] key
|
|
119
|
+
TTYGStubs.stubChatsListGet('/ttyg/chats/get-chat-list-with-renamed-chat.json');
|
|
120
|
+
TTYGViewSteps.saveChatName(1, 0);
|
|
121
|
+
// Then I should see the new chat name
|
|
122
|
+
TTYGViewSteps.getChatFromGroup(1, 0).should('contain', 'New chat name');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('Should be able to cancel a chat name editing', () => {
|
|
126
|
+
TTYGStubs.stubChatsListGet();
|
|
127
|
+
TTYGStubs.stubChatGet();
|
|
128
|
+
TTYGStubs.stubAgentListGet();
|
|
129
|
+
// Given I have opened the ttyg page and there are chats loaded
|
|
130
|
+
TTYGViewSteps.visit();
|
|
131
|
+
cy.wait('@get-chat');
|
|
132
|
+
cy.wait('@get-chat-list');
|
|
133
|
+
cy.wait('@get-all-repositories');
|
|
134
|
+
cy.wait('@get-agent-list');
|
|
135
|
+
// And I double-click on the first chat
|
|
136
|
+
TTYGViewSteps.editChatName(0, 0);
|
|
137
|
+
// Then I should see the chat name input
|
|
138
|
+
TTYGViewSteps.getChatNameInput(0, 0).should('be.visible').and('have.value', 'Test chat 3');
|
|
139
|
+
// When I change the chat name
|
|
140
|
+
TTYGViewSteps.writeChatName(0, 0, 'New chat name');
|
|
141
|
+
// And I hit [esc] key
|
|
142
|
+
TTYGViewSteps.cancelChatNameSaving(0, 0);
|
|
143
|
+
// Then I should see the old chat name
|
|
144
|
+
TTYGViewSteps.getChatFromGroup(0, 0).should('contain', 'Test chat 3');
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('Should be able to delete a chat', () => {
|
|
148
|
+
TTYGStubs.stubChatsListGet();
|
|
149
|
+
TTYGStubs.stubChatGet();
|
|
150
|
+
TTYGStubs.stubAgentListGet();
|
|
151
|
+
TTYGStubs.stubChatDelete();
|
|
152
|
+
// Given I have opened the ttyg page and there are chats loaded
|
|
153
|
+
TTYGViewSteps.visit();
|
|
154
|
+
cy.wait('@get-chat');
|
|
155
|
+
cy.wait('@get-chat-list');
|
|
156
|
+
cy.wait('@get-all-repositories');
|
|
157
|
+
cy.wait('@get-agent-list');
|
|
158
|
+
// When I select the delete action from the chat action menu
|
|
159
|
+
TTYGViewSteps.triggerDeleteChatActionMenu(1, 0);
|
|
160
|
+
// Then I should see the chat deletion confirmation dialog
|
|
161
|
+
ModalDialogSteps.getDialog().should('be.visible');
|
|
162
|
+
// If I reject the deletion
|
|
163
|
+
ModalDialogSteps.clickOnCancelButton();
|
|
164
|
+
// Then the chat should not be deleted
|
|
165
|
+
TTYGViewSteps.getChatFromGroup(1, 0).should('contain', 'Test chat 4');
|
|
166
|
+
// When I select the delete action from the chat action menu again
|
|
167
|
+
TTYGViewSteps.triggerDeleteChatActionMenu(1, 0);
|
|
168
|
+
// And I confirm the deletion
|
|
169
|
+
TTYGStubs.stubChatsListGet('/ttyg/chats/get-chat-list-with-deleted-chat.json');
|
|
170
|
+
ModalDialogSteps.clickOnConfirmButton();
|
|
171
|
+
// Then the chat should be deleted
|
|
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);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('Should be able to export chat from chat list export action', () => {
|
|
190
|
+
TTYGStubs.stubAgentListGet();
|
|
191
|
+
TTYGStubs.stubChatsListGet();
|
|
192
|
+
TTYGStubs.stubChatExport();
|
|
193
|
+
TTYGStubs.stubChatGet();
|
|
194
|
+
// Given I have opened the ttyg page and there are chats loaded
|
|
195
|
+
TTYGViewSteps.visit();
|
|
196
|
+
cy.wait('@get-chat');
|
|
197
|
+
cy.wait('@get-chat-list');
|
|
198
|
+
cy.wait('@get-all-repositories');
|
|
199
|
+
cy.wait('@get-agent-list');
|
|
200
|
+
// When I select the export chat action chat panel toolbar
|
|
201
|
+
TTYGViewSteps.triggerExportChatActionMenu(1, 0);
|
|
202
|
+
cy.wait('@export-chat');
|
|
203
|
+
// Then I expect to download the chat as a file
|
|
204
|
+
TTYGViewSteps.verifyFileExists('chat-export.json');
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('Should show error notification if chat list fails to load', () => {
|
|
208
|
+
TTYGStubs.stubChatListGetError();
|
|
209
|
+
TTYGStubs.stubAgentListGet();
|
|
210
|
+
// Given I have opened the ttyg page
|
|
211
|
+
TTYGViewSteps.visit();
|
|
212
|
+
cy.wait('@get-chat-list');
|
|
213
|
+
cy.wait('@get-all-repositories');
|
|
214
|
+
cy.wait('@get-agent-list');
|
|
215
|
+
// When the chat list fails to load
|
|
216
|
+
// Then I should see an error notification
|
|
217
|
+
TTYGViewSteps.getChatListLoadingIndicator().should('not.exist');
|
|
218
|
+
// And the error notification should be visible
|
|
219
|
+
ApplicationSteps.getErrorNotifications().should('be.visible');
|
|
220
|
+
// And the chat list should not be visible
|
|
221
|
+
TTYGViewSteps.getChatsPanel().should('be.hidden');
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('Should persist selected chat', () => {
|
|
225
|
+
TTYGStubs.stubChatsListGet();
|
|
226
|
+
TTYGStubs.stubChatGet();
|
|
227
|
+
TTYGStubs.stubAgentListGet();
|
|
228
|
+
// Given I have opened the ttyg page
|
|
229
|
+
TTYGViewSteps.visit();
|
|
230
|
+
cy.wait('@get-chat');
|
|
231
|
+
cy.wait('@get-chat-list');
|
|
232
|
+
cy.wait('@get-all-repositories');
|
|
233
|
+
cy.wait('@get-agent-list');
|
|
234
|
+
TTYGViewSteps.getChatFromGroup(0, 0).should('have.class', 'selected');
|
|
235
|
+
|
|
236
|
+
// When I select another chat,
|
|
237
|
+
TTYGViewSteps.selectChat(0, 2);
|
|
238
|
+
TTYGViewSteps.getChatFromGroup(0, 0).should('have.not.class', 'selected');
|
|
239
|
+
TTYGViewSteps.getChatFromGroup(0, 2).should('have.class', 'selected');
|
|
240
|
+
// change the page,
|
|
241
|
+
HomeSteps.visit();
|
|
242
|
+
cy.wait('@get-chat');
|
|
243
|
+
// and came back to the ttyg page
|
|
244
|
+
TTYGViewSteps.visit();
|
|
245
|
+
|
|
246
|
+
// Then I expect to last used chat be selected.
|
|
247
|
+
TTYGViewSteps.getChatFromGroup(0, 2).should('have.class', 'selected');
|
|
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
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @param {*[]} data
|
|
277
|
+
*/
|
|
278
|
+
function verifyChatList(data) {
|
|
279
|
+
TTYGViewSteps.getChatByDayGroups().should('have.length', data.length);
|
|
280
|
+
data.forEach((group, index) => {
|
|
281
|
+
TTYGViewSteps.getChatsFromGroup(index).should('have.length', group.length);
|
|
282
|
+
group.forEach((chat, chatIndex) => {
|
|
283
|
+
TTYGViewSteps.getChatFromGroup(index, chatIndex).should('contain', chat.name);
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
|
|
2
|
+
import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
|
|
3
|
+
import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
|
|
4
|
+
import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
|
|
5
|
+
import {ApplicationSteps} from "../../steps/application-steps";
|
|
6
|
+
import {RepositoriesStub} from "../../stubs/repositories-stub";
|
|
7
|
+
|
|
8
|
+
describe('Ttyg ChatPanel', () => {
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
// Create an actual repository to prevent stubbing all background requests that are not related to the ttyg view
|
|
12
|
+
RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
|
|
13
|
+
RepositoriesStub.stubBaseEndpoints('starwars');
|
|
14
|
+
cy.presetRepository('starwars');
|
|
15
|
+
TTYGStubs.stubChatsListGet();
|
|
16
|
+
TTYGStubs.stubAgentListGet();
|
|
17
|
+
TTYGStubs.stubChatGet();
|
|
18
|
+
|
|
19
|
+
// When visiting the TTYG page where there is a chat with questions and answers
|
|
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');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('Should load chat history and show answer actions', () => {
|
|
28
|
+
// When I select a chat which last used agent is missing (deleted)
|
|
29
|
+
TTYGViewSteps.selectChat(0, 2);
|
|
30
|
+
// Then I expect chat history to be displayed
|
|
31
|
+
ChatPanelSteps.getChatDetailsElements().should('have.length', 2);
|
|
32
|
+
// and only the actions for the last message are 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');
|
|
35
|
+
|
|
36
|
+
// When I hover over the hidden answer actions.
|
|
37
|
+
ChatPanelSteps.getChatDetailActions(0, 0).realHover();
|
|
38
|
+
|
|
39
|
+
// Then I expect answer actions to be visible.
|
|
40
|
+
ChatPanelSteps.getChatDetailActions(0, 0).should('exist').and('have.css', 'opacity', '1');
|
|
41
|
+
|
|
42
|
+
// When the new question input is empty.
|
|
43
|
+
// The "Ask" button must be disabled.
|
|
44
|
+
ChatPanelSteps.getAskButtonElement().should('be.disabled');
|
|
45
|
+
ChatPanelSteps.getQuestionInputElement().should('be.disabled');
|
|
46
|
+
|
|
47
|
+
// Then I expect the "Ask" button be not active because agent is not selected
|
|
48
|
+
ChatPanelSteps.getAskButtonElement().should('not.be.enabled');
|
|
49
|
+
|
|
50
|
+
// When I select an agent
|
|
51
|
+
TTYGViewSteps.openAgentsMenu();
|
|
52
|
+
TTYGViewSteps.selectAgent(0);
|
|
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
|
+
|
|
60
|
+
// Then I expect the "Ask" button be active.
|
|
61
|
+
ChatPanelSteps.getAskButtonElement().should('be.enabled');
|
|
62
|
+
|
|
63
|
+
// When I click on "Ask" button.
|
|
64
|
+
TTYGStubs.stubAnswerQuestion();
|
|
65
|
+
ChatPanelSteps.getAskButtonElement().scrollIntoView().click();
|
|
66
|
+
|
|
67
|
+
// Then I expect the question be in chat history,
|
|
68
|
+
ChatPanelSteps.getChatDetailsElements().should('have.length', 3);
|
|
69
|
+
ChatPanelSteps.getChatDetailQuestionElement(2).contains('Who is Han Solo?');
|
|
70
|
+
// and input field be empty,
|
|
71
|
+
ChatPanelSteps.getQuestionInputElement().should('be.enabled');
|
|
72
|
+
ChatPanelSteps.getQuestionInputElement().should('have.value', '');
|
|
73
|
+
// and "Ask" button be disabled.
|
|
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');
|
|
78
|
+
|
|
79
|
+
// When I click on regenerate button on the last response => +2 messages
|
|
80
|
+
TTYGStubs.stubAnswerQuestion();
|
|
81
|
+
ChatPanelSteps.regenerateQuestion(2, 1);
|
|
82
|
+
|
|
83
|
+
// Then I expect the question to be regenerated and appear in the chat history.
|
|
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);
|
|
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");
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Can't test this on CI
|
|
168
|
+
it.skip('Should copy an answer when click on copy button', () => {
|
|
169
|
+
// When I click on copy button
|
|
170
|
+
ChatPanelSteps.copyAnswer();
|
|
171
|
+
|
|
172
|
+
// Then I expect the answer to be copied.
|
|
173
|
+
ApplicationSteps.getSuccessNotifications().contains('The answer was successfully copied to the clipboard.');
|
|
174
|
+
});
|
|
175
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
|
|
2
|
+
import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
|
|
3
|
+
import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
|
|
4
|
+
import {TtygAgentSettingsModalSteps} from "../../steps/ttyg/ttyg-agent-settings-modal.steps";
|
|
5
|
+
import {RepositoriesStub} from "../../stubs/repositories-stub";
|
|
6
|
+
|
|
7
|
+
describe('TTYG clone an agent', () => {
|
|
8
|
+
const repositoryId = 'starwars';
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
|
|
12
|
+
RepositoriesStub.stubBaseEndpoints(repositoryId);
|
|
13
|
+
cy.presetRepository(repositoryId);
|
|
14
|
+
TTYGStubs.stubAgentDefaultsGet();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it(' should be able to clone an agent.', () => {
|
|
18
|
+
TTYGStubs.stubAgentListGet();
|
|
19
|
+
TTYGStubs.stubChatsListGet();
|
|
20
|
+
TTYGStubs.stubChatGet();
|
|
21
|
+
// Given I have opened the ttyg page
|
|
22
|
+
TTYGViewSteps.visit();
|
|
23
|
+
cy.wait('@get-all-repositories');
|
|
24
|
+
cy.wait('@get-chat');
|
|
25
|
+
cy.wait('@get-agent-list');
|
|
26
|
+
// When I select to clone an agent
|
|
27
|
+
TTYGViewSteps.expandAgentsSidebar();
|
|
28
|
+
TTYGViewSteps.triggerCloneAgentActionMenu(0);
|
|
29
|
+
// Then I expect to see the clone agent settings modal
|
|
30
|
+
TtygAgentSettingsModalSteps.getDialog().should('be.visible');
|
|
31
|
+
TtygAgentSettingsModalSteps.getDialogHeader().should('contain', 'Clone Agent');
|
|
32
|
+
// And I expect the agent name to be prefixed with 'clone-'
|
|
33
|
+
TtygAgentSettingsModalSteps.getAgentNameField().should('have.value', 'clone-agent-1');
|
|
34
|
+
// And the FTS search method should be selected
|
|
35
|
+
TtygAgentSettingsModalSteps.getSelectedExtractionMethods().should('have.length', 1);
|
|
36
|
+
TtygAgentSettingsModalSteps.getSelectedExtractionMethod(0).should('contain', 'Full-text search');
|
|
37
|
+
// And the agent save button should be enabled
|
|
38
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled').and('contain', 'Save');
|
|
39
|
+
// When I change the agent name
|
|
40
|
+
TtygAgentSettingsModalSteps.clearAgentName();
|
|
41
|
+
TtygAgentSettingsModalSteps.typeAgentName('agent-11');
|
|
42
|
+
// And I select additional extraction method
|
|
43
|
+
TtygAgentSettingsModalSteps.checkIriDiscoverySearchCheckbox();
|
|
44
|
+
// And save the agent
|
|
45
|
+
// We don't verify the response here, we just want to make sure the request is sent with the correct data
|
|
46
|
+
TTYGStubs.stubAgentCreate();
|
|
47
|
+
TtygAgentSettingsModalSteps.saveAgent();
|
|
48
|
+
cy.wait('@create-agent').then((interception) => {
|
|
49
|
+
assert.deepEqual(interception.request.body, {
|
|
50
|
+
"id": "asst_gAPcrHQQ9ZIxD5eXWH2BNFfo",
|
|
51
|
+
"name": "agent-11",
|
|
52
|
+
"repositoryId": "starwars",
|
|
53
|
+
"model": "gpt-4o",
|
|
54
|
+
"temperature": 0,
|
|
55
|
+
"topP": 0,
|
|
56
|
+
"seed": 0,
|
|
57
|
+
"assistantsInstructions": {
|
|
58
|
+
"systemInstruction": "",
|
|
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."
|
|
60
|
+
},
|
|
61
|
+
"assistantExtractionMethods": [
|
|
62
|
+
{
|
|
63
|
+
"method": "fts_search",
|
|
64
|
+
"maxNumberOfTriplesPerCall": 44
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"additionalExtractionMethods": [
|
|
68
|
+
{
|
|
69
|
+
"method": "iri_discovery_search"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|