graphdb-workbench-tests 2.7.6 → 2.8.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.
- 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,560 @@
|
|
|
1
|
+
import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
|
|
2
|
+
import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
|
|
3
|
+
import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
|
|
4
|
+
import {TtygAgentSettingsModalSteps} from "../../steps/ttyg/ttyg-agent-settings-modal.steps";
|
|
5
|
+
import {SimilarityIndexStubs} from "../../stubs/similarity-index-stubs";
|
|
6
|
+
import {ConnectorStubs} from "../../stubs/connector-stubs";
|
|
7
|
+
import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
|
|
8
|
+
import {RepositoriesStub} from "../../stubs/repositories-stub";
|
|
9
|
+
import {AlertDialogSteps} from "../../steps/alert-dialog-steps";
|
|
10
|
+
|
|
11
|
+
describe('TTYG create new agent', () => {
|
|
12
|
+
const repositoryId = 'starwars';
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
|
|
16
|
+
RepositoriesStub.stubBaseEndpoints(repositoryId);
|
|
17
|
+
cy.presetRepository(repositoryId);
|
|
18
|
+
TTYGStubs.stubAgentDefaultsGet();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('Should be able to cancel the new agent creation on the no agents view', {
|
|
22
|
+
retries: {
|
|
23
|
+
runMode: 1,
|
|
24
|
+
openMode: 0
|
|
25
|
+
}
|
|
26
|
+
}, () => {
|
|
27
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
28
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
29
|
+
// Given I have opened the ttyg page
|
|
30
|
+
TTYGViewSteps.visit();
|
|
31
|
+
// When I click on the create agent button
|
|
32
|
+
TTYGViewSteps.createFirstAgent();
|
|
33
|
+
// Then I should see the create agent modal
|
|
34
|
+
TtygAgentSettingsModalSteps.getDialog().should('be.visible');
|
|
35
|
+
// When I cancel the agent creation
|
|
36
|
+
TtygAgentSettingsModalSteps.cancel();
|
|
37
|
+
// Then the modal should be closed and I should see the no agents view again
|
|
38
|
+
TtygAgentSettingsModalSteps.getDialog().should('not.exist');
|
|
39
|
+
TTYGViewSteps.getNoAgentsView().should('be.visible');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('Should be able to create a new agent with SPARQL extraction method on the no agents view', {
|
|
43
|
+
retries: {
|
|
44
|
+
runMode: 1,
|
|
45
|
+
openMode: 0
|
|
46
|
+
}
|
|
47
|
+
}, () => {
|
|
48
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
49
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json', 1000);
|
|
50
|
+
// Given I have opened the ttyg page
|
|
51
|
+
TTYGViewSteps.visit();
|
|
52
|
+
cy.wait('@get-all-repositories');
|
|
53
|
+
cy.wait('@get-agent-list');
|
|
54
|
+
// When I click on the create agent button
|
|
55
|
+
TTYGViewSteps.createFirstAgent();
|
|
56
|
+
// Then I should see the create agent modal
|
|
57
|
+
TtygAgentSettingsModalSteps.getDialog().should('be.visible');
|
|
58
|
+
// And the save button should be disabled because the form is not configured yet
|
|
59
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
60
|
+
// Validate agent settings for SPARQL extraction method
|
|
61
|
+
|
|
62
|
+
// agent name
|
|
63
|
+
fillAgentName('Test Agent');
|
|
64
|
+
|
|
65
|
+
// SPARQL extraction method settings
|
|
66
|
+
|
|
67
|
+
// At least one extraction method must be selected
|
|
68
|
+
// enable SPARQL extraction method and disable it again to check the error message for the extraction methods
|
|
69
|
+
TtygAgentSettingsModalSteps.enableSparqlExtractionMethod();
|
|
70
|
+
// The component here is the bootstrap collapse component, so we need to wait for the animation to finish, otherwise the test might fail randomly
|
|
71
|
+
cy.wait(1000);
|
|
72
|
+
TtygAgentSettingsModalSteps.getSparqlExtractionMethodPanel().should('be.visible');
|
|
73
|
+
TtygAgentSettingsModalSteps.disableSparqlExtractionMethod();
|
|
74
|
+
// The component here is the bootstrap collapse component, so we need to wait for the animation to finish, otherwise the test might fail randomly
|
|
75
|
+
cy.wait(1000);
|
|
76
|
+
TtygAgentSettingsModalSteps.getSparqlExtractionMethodPanel().should('not.exist');
|
|
77
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
78
|
+
TtygAgentSettingsModalSteps.getExtractionMethodError().should('be.visible').and('contain', 'At least one query method must be selected');
|
|
79
|
+
TtygAgentSettingsModalSteps.enableSparqlExtractionMethod();
|
|
80
|
+
TtygAgentSettingsModalSteps.getExtractionMethodError().should('not.exist');
|
|
81
|
+
// the save button should be disabled because the SPARQL method options are not configured yet
|
|
82
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
83
|
+
// and there should be an error message for the SPARQL extraction method
|
|
84
|
+
TtygAgentSettingsModalSteps.getSparqlExtractionMethodError().should('be.visible').and('contain', 'Select how an ontology should be fetched');
|
|
85
|
+
// select the ontology graph SPARQL extraction method option
|
|
86
|
+
TtygAgentSettingsModalSteps.selectSparqlMethodOntologyGraph();
|
|
87
|
+
// the ontology graph default value should be visible
|
|
88
|
+
TtygAgentSettingsModalSteps.getSparqlMethodOntologyGraphField().should('have.value', 'http://example.com');
|
|
89
|
+
// if the value is removed, the save button should be disabled because these fields are required if the option is selected
|
|
90
|
+
TtygAgentSettingsModalSteps.clearSparqlMethodOntologyGraphField();
|
|
91
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
92
|
+
TtygAgentSettingsModalSteps.typeSparqlMethodOntologyGraphField('http://example.com/swgraph');
|
|
93
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
94
|
+
// select the sparql query SPARQL extraction method option
|
|
95
|
+
TtygAgentSettingsModalSteps.selectSparqlMethodSparqlQuery();
|
|
96
|
+
TtygAgentSettingsModalSteps.getSparqlMethodSparqlQueryField().should('have.value', 'CONSTRUCT {?s ?p ?o} WHERE {GRAPH <http://example.org/ontology> {?s ?p ?o .}}');
|
|
97
|
+
// if the value is removed, the save button should be disabled because these fields are required if the option is selected
|
|
98
|
+
TtygAgentSettingsModalSteps.clearSparqlMethodSparqlQueryField();
|
|
99
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
100
|
+
TtygAgentSettingsModalSteps.typeSparqlMethodSparqlQueryField('select ?s ?p ?o where {?s ?p ?o .}');
|
|
101
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
102
|
+
// check the add missing namespaces checkbox
|
|
103
|
+
TtygAgentSettingsModalSteps.getAddMissingNamespacesCheckbox().should('not.be.checked');
|
|
104
|
+
TtygAgentSettingsModalSteps.toggleAddMissingNamespacesCheckbox();
|
|
105
|
+
|
|
106
|
+
// Validate the other agent settings
|
|
107
|
+
|
|
108
|
+
// gpt model
|
|
109
|
+
TtygAgentSettingsModalSteps.getGptModelField().should('have.value', 'gpt-4o');
|
|
110
|
+
TtygAgentSettingsModalSteps.clearGptModel();
|
|
111
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
112
|
+
TtygAgentSettingsModalSteps.getGptModelError().should('be.visible').and('contain', 'This field is required');
|
|
113
|
+
TtygAgentSettingsModalSteps.typeGptModel('gpt-4o');
|
|
114
|
+
|
|
115
|
+
// temperature
|
|
116
|
+
TtygAgentSettingsModalSteps.setTemperature('0.2');
|
|
117
|
+
TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '0.2');
|
|
118
|
+
|
|
119
|
+
// Top P
|
|
120
|
+
TtygAgentSettingsModalSteps.getTopPField().should('have.value', '1');
|
|
121
|
+
TtygAgentSettingsModalSteps.setTopP('0.2');
|
|
122
|
+
TtygAgentSettingsModalSteps.getTopPField().should('have.value', '0.2');
|
|
123
|
+
|
|
124
|
+
// Seed
|
|
125
|
+
// TODO: The seed field is currently removed until backend decides to use it
|
|
126
|
+
// TtygAgentSettingsModalSteps.getSeedField().should('have.value', '0');
|
|
127
|
+
// // The seed field is optional, so the save button should be enabled
|
|
128
|
+
// TtygAgentSettingsModalSteps.clearSeed();
|
|
129
|
+
// TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
130
|
+
// TtygAgentSettingsModalSteps.typeSeed('2');
|
|
131
|
+
|
|
132
|
+
// Validate the advanced settings
|
|
133
|
+
|
|
134
|
+
// System instructions
|
|
135
|
+
TtygAgentSettingsModalSteps.getSystemInstructionsField().should('have.value', '');
|
|
136
|
+
|
|
137
|
+
// User instructions
|
|
138
|
+
TtygAgentSettingsModalSteps.getUserInstructionsField().should('have.value', '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.');
|
|
139
|
+
|
|
140
|
+
// Save the agent
|
|
141
|
+
TTYGStubs.stubAgentCreate(1000);
|
|
142
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json', 1000);
|
|
143
|
+
TtygAgentSettingsModalSteps.saveAgent();
|
|
144
|
+
TtygAgentSettingsModalSteps.getCreatingAgentLoader().should('be.visible');
|
|
145
|
+
cy.wait('@create-agent').then((interception) => {
|
|
146
|
+
assert.deepEqual(interception.request.body, {
|
|
147
|
+
"id": "id",
|
|
148
|
+
"name": "Test Agent",
|
|
149
|
+
"repositoryId": "starwars",
|
|
150
|
+
"model": "gpt-4o",
|
|
151
|
+
"temperature": "0.2",
|
|
152
|
+
"topP": "0.2",
|
|
153
|
+
"seed": 0,
|
|
154
|
+
"assistantsInstructions": {
|
|
155
|
+
"systemInstruction": "",
|
|
156
|
+
"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."
|
|
157
|
+
},
|
|
158
|
+
"assistantExtractionMethods": [
|
|
159
|
+
{
|
|
160
|
+
"method": "sparql_search",
|
|
161
|
+
"sparqlQuery": "select ?s ?p ?o where {?s ?p ?o .}",
|
|
162
|
+
"addMissingNamespaces": true
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"additionalExtractionMethods": [
|
|
166
|
+
]
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
// the modal should be closed
|
|
170
|
+
TtygAgentSettingsModalSteps.getDialog().should('not.exist');
|
|
171
|
+
cy.wait('@get-agent-list');
|
|
172
|
+
TTYGViewSteps.getNoAgentsView().should('not.exist');
|
|
173
|
+
// agent list should be reloaded to show the new agent and the loading indicator should be visible
|
|
174
|
+
// TODO: this doesn't work for some reason. During the agent list loading the view remains blank and then the agent list is shown
|
|
175
|
+
// TTYGViewSteps.getAgentsLoadingIndicator().should('be.visible');
|
|
176
|
+
// the agent should be created
|
|
177
|
+
// the new agent should be visible in the agent list (there were 0 agents before, so now there should be 1)
|
|
178
|
+
TTYGViewSteps.getAgents().should('have.length', 1);
|
|
179
|
+
TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('Should require FTS to be enabled for selected repository when creating agent with FTS extraction method', {
|
|
183
|
+
retries: {
|
|
184
|
+
runMode: 1,
|
|
185
|
+
openMode: 0
|
|
186
|
+
}
|
|
187
|
+
}, () => {
|
|
188
|
+
RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-disabled-fts.json');
|
|
189
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
190
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
191
|
+
// Given I have opened the ttyg page
|
|
192
|
+
TTYGViewSteps.visit();
|
|
193
|
+
cy.wait('@get-all-repositories');
|
|
194
|
+
// When I click on the create agent button
|
|
195
|
+
TTYGViewSteps.createFirstAgent();
|
|
196
|
+
// And I select a repository
|
|
197
|
+
TtygAgentSettingsModalSteps.selectRepository(repositoryId);
|
|
198
|
+
// When I open the full text search extraction method panel
|
|
199
|
+
TtygAgentSettingsModalSteps.toggleFTSExtractionMethodPanel();
|
|
200
|
+
// Then I should see a help message for FTS not enabled
|
|
201
|
+
TtygAgentSettingsModalSteps.getFtsDisabledHelp().should('be.visible');
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('Should be able to create agent with FTS extraction method', {
|
|
205
|
+
retries: {
|
|
206
|
+
runMode: 1,
|
|
207
|
+
openMode: 0
|
|
208
|
+
}
|
|
209
|
+
}, () => {
|
|
210
|
+
RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-enabled-fts.json');
|
|
211
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
212
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
213
|
+
// Given I have opened the ttyg page
|
|
214
|
+
TTYGViewSteps.visit();
|
|
215
|
+
cy.wait('@get-all-repositories');
|
|
216
|
+
cy.wait('@get-agent-list');
|
|
217
|
+
// When I click on the create agent button
|
|
218
|
+
TTYGViewSteps.createFirstAgent();
|
|
219
|
+
// And I fill in the agent name
|
|
220
|
+
TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
|
|
221
|
+
// And I select a repository
|
|
222
|
+
TtygAgentSettingsModalSteps.selectRepository(repositoryId);
|
|
223
|
+
// When I open the full text search extraction method panel
|
|
224
|
+
// The save button should be disabled because the FTS extraction method is not enabled
|
|
225
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
226
|
+
// And I enable the FTS extraction method
|
|
227
|
+
TtygAgentSettingsModalSteps.enableFtsExtractionMethod();
|
|
228
|
+
// The save button should be enabled
|
|
229
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
230
|
+
// When I save the agent
|
|
231
|
+
TTYGStubs.stubAgentCreate();
|
|
232
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
|
|
233
|
+
TtygAgentSettingsModalSteps.saveAgent();
|
|
234
|
+
cy.wait('@create-agent');
|
|
235
|
+
// the modal should be closed
|
|
236
|
+
TtygAgentSettingsModalSteps.getDialog().should('not.exist');
|
|
237
|
+
cy.wait('@get-agent-list');
|
|
238
|
+
// and the agent should be created
|
|
239
|
+
TTYGViewSteps.getNoAgentsView().should('not.exist');
|
|
240
|
+
// the new agent should be visible in the agent list (there were 0 agents before, so now there should be 1)
|
|
241
|
+
TTYGViewSteps.getAgents().should('have.length', 1);
|
|
242
|
+
TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('Should require similarity index in order to create agent with similarity search method', {
|
|
246
|
+
retries: {
|
|
247
|
+
runMode: 1,
|
|
248
|
+
openMode: 0
|
|
249
|
+
}
|
|
250
|
+
}, () => {
|
|
251
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
252
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
253
|
+
SimilarityIndexStubs.stubGetSimilarityIndexes('/similarity/get-similarity-indexes-0.json');
|
|
254
|
+
// Given I have opened the ttyg page
|
|
255
|
+
TTYGViewSteps.visit();
|
|
256
|
+
cy.wait('@get-all-repositories');
|
|
257
|
+
cy.wait('@get-agent-list');
|
|
258
|
+
// When I click on the create agent button
|
|
259
|
+
TTYGViewSteps.createFirstAgent();
|
|
260
|
+
// When I select the similarity search extraction method
|
|
261
|
+
TtygAgentSettingsModalSteps.enableSimilaritySearchMethodPanel();
|
|
262
|
+
// Then I should see a help message for similarity index missing
|
|
263
|
+
TtygAgentSettingsModalSteps.getSimilaritySearchIndexMissingHelp().should('be.visible');
|
|
264
|
+
// And the agent save button should be disabled because the similarity index method is not configured yet
|
|
265
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it('Should be able to configure and create agent with similarity index search method', {
|
|
269
|
+
retries: {
|
|
270
|
+
runMode: 1,
|
|
271
|
+
openMode: 0
|
|
272
|
+
}
|
|
273
|
+
}, () => {
|
|
274
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
275
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
276
|
+
SimilarityIndexStubs.stubGetSimilarityIndexes();
|
|
277
|
+
// Given I have opened the ttyg page
|
|
278
|
+
TTYGViewSteps.visit();
|
|
279
|
+
cy.wait('@get-all-repositories');
|
|
280
|
+
cy.wait('@get-agent-list');
|
|
281
|
+
// When I click on the create agent button
|
|
282
|
+
TTYGViewSteps.createFirstAgent();
|
|
283
|
+
TtygAgentSettingsModalSteps.getDialog().should('be.visible');
|
|
284
|
+
TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
|
|
285
|
+
TtygAgentSettingsModalSteps.selectRepository(repositoryId);
|
|
286
|
+
// And I enable the similarity search extraction method
|
|
287
|
+
TtygAgentSettingsModalSteps.enableSimilaritySearchMethodPanel();
|
|
288
|
+
// Then I expect similarity index to be selected
|
|
289
|
+
TtygAgentSettingsModalSteps.getSimilarityIndexField().should('have.value', '0');
|
|
290
|
+
// Then agent save button should be enabled
|
|
291
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
292
|
+
// When I set the similarity index threshold
|
|
293
|
+
TtygAgentSettingsModalSteps.getSimilarityIndexThresholdField().should('have.value', '0.6');
|
|
294
|
+
TtygAgentSettingsModalSteps.setSimilarityIndexThreshold('0.8');
|
|
295
|
+
// And I set the max triples per call
|
|
296
|
+
TtygAgentSettingsModalSteps.getSimilarityIndexMaxTriplesField().should('have.value', '');
|
|
297
|
+
TtygAgentSettingsModalSteps.setSimilarityIndexMaxTriples('100');
|
|
298
|
+
// When I save the agent
|
|
299
|
+
TTYGStubs.stubAgentCreate();
|
|
300
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
|
|
301
|
+
TtygAgentSettingsModalSteps.saveAgent();
|
|
302
|
+
cy.wait('@create-agent');
|
|
303
|
+
// the modal should be closed
|
|
304
|
+
TtygAgentSettingsModalSteps.getDialog().should('not.exist');
|
|
305
|
+
cy.wait('@get-agent-list');
|
|
306
|
+
// and the agent should be created
|
|
307
|
+
TTYGViewSteps.getNoAgentsView().should('not.exist');
|
|
308
|
+
// the new agent should be visible in the agent list (there were 0 agents before, so now there should be 1)
|
|
309
|
+
TTYGViewSteps.getAgents().should('have.length', 1);
|
|
310
|
+
TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it('Should require retrieval connector in order to create an agent with GPT retrieval connector method', {
|
|
314
|
+
retries: {
|
|
315
|
+
runMode: 1,
|
|
316
|
+
openMode: 0
|
|
317
|
+
}
|
|
318
|
+
}, () => {
|
|
319
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
320
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
321
|
+
ConnectorStubs.stubGetConnectors();
|
|
322
|
+
ConnectorStubs.stubGetRetrievalConnector('/connectors/get-retrieval-connector-0.json');
|
|
323
|
+
// Given I have opened the ttyg page
|
|
324
|
+
TTYGViewSteps.visit();
|
|
325
|
+
cy.wait('@get-all-repositories');
|
|
326
|
+
cy.wait('@get-agent-list');
|
|
327
|
+
// When I click on the create agent button
|
|
328
|
+
TTYGViewSteps.createFirstAgent();
|
|
329
|
+
TtygAgentSettingsModalSteps.getDialog().should('be.visible');
|
|
330
|
+
TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
|
|
331
|
+
TtygAgentSettingsModalSteps.selectRepository(repositoryId);
|
|
332
|
+
// When I select and open the GPT retrieval connector method panel
|
|
333
|
+
TtygAgentSettingsModalSteps.enableRetrievalMethodPanel();
|
|
334
|
+
// Then I should see the missing connector help message
|
|
335
|
+
TtygAgentSettingsModalSteps.getMissingRetrievalConnectorHelp().should('be.visible');
|
|
336
|
+
// And the save button should be disabled
|
|
337
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it('Should be able to configure and create an agent with retrieval connector method', {
|
|
341
|
+
retries: {
|
|
342
|
+
runMode: 1,
|
|
343
|
+
openMode: 0
|
|
344
|
+
}
|
|
345
|
+
}, () => {
|
|
346
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
347
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
348
|
+
ConnectorStubs.stubGetConnectors();
|
|
349
|
+
ConnectorStubs.stubGetRetrievalConnector();
|
|
350
|
+
// Given I have opened the ttyg page
|
|
351
|
+
TTYGViewSteps.visit();
|
|
352
|
+
cy.wait('@get-all-repositories');
|
|
353
|
+
cy.wait('@get-agent-list');
|
|
354
|
+
// When I click on the create agent button
|
|
355
|
+
TTYGViewSteps.createFirstAgent();
|
|
356
|
+
TtygAgentSettingsModalSteps.getDialog().should('be.visible');
|
|
357
|
+
TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
|
|
358
|
+
TtygAgentSettingsModalSteps.selectRepository(repositoryId);
|
|
359
|
+
// When I select and open the GPT retrieval connector method panel
|
|
360
|
+
TtygAgentSettingsModalSteps.enableRetrievalMethodPanel();
|
|
361
|
+
// Then I expect retrieval connector to be selected
|
|
362
|
+
TtygAgentSettingsModalSteps.getRetrievalConnectorField().should('have.value', '0');
|
|
363
|
+
// Then the save button should be enabled
|
|
364
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
365
|
+
// When I remove the query template
|
|
366
|
+
TtygAgentSettingsModalSteps.getQueryTemplateField().should('have.value', '{"query": "string"}');
|
|
367
|
+
TtygAgentSettingsModalSteps.clearQueryTemplate();
|
|
368
|
+
// Then the save button should be disabled
|
|
369
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
370
|
+
// And I set the query template
|
|
371
|
+
TtygAgentSettingsModalSteps.typeQueryTemplate('{"query": "string"}');
|
|
372
|
+
// Then the save button should be enabled
|
|
373
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
374
|
+
// When I set the max triples per call
|
|
375
|
+
TtygAgentSettingsModalSteps.getRetrievalMaxTriplesField().should('have.value', '');
|
|
376
|
+
TtygAgentSettingsModalSteps.setRetrievalMaxTriples('100');
|
|
377
|
+
// When I save the agent
|
|
378
|
+
TTYGStubs.stubAgentCreate();
|
|
379
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
|
|
380
|
+
TtygAgentSettingsModalSteps.saveAgent();
|
|
381
|
+
cy.wait('@create-agent');
|
|
382
|
+
// the modal should be closed
|
|
383
|
+
TtygAgentSettingsModalSteps.getDialog().should('not.exist');
|
|
384
|
+
cy.wait('@get-agent-list');
|
|
385
|
+
// and the agent should be created
|
|
386
|
+
TTYGViewSteps.getNoAgentsView().should('not.exist');
|
|
387
|
+
// the new agent should be visible in the agent list (there were 0 agents before, so now there should be 1)
|
|
388
|
+
TTYGViewSteps.getAgents().should('have.length', 1);
|
|
389
|
+
TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it('Should updates the ChatGPT form field when the repository is changed', () => {
|
|
393
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
394
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
395
|
+
ConnectorStubs.stubGetConnectors();
|
|
396
|
+
ConnectorStubs.stubTTYGChatGPTConnectors();
|
|
397
|
+
// Given I have opened the ttyg page
|
|
398
|
+
TTYGViewSteps.visit();
|
|
399
|
+
cy.wait('@get-all-repositories');
|
|
400
|
+
|
|
401
|
+
// When I click on the create agent button
|
|
402
|
+
TTYGViewSteps.createFirstAgent();
|
|
403
|
+
// Then I expect the selected repository to be set as the repository ID in the form.
|
|
404
|
+
TtygAgentSettingsModalSteps.verifyRepositorySelected('starwars');
|
|
405
|
+
// and all options are exclusively for GraphDB repositories.
|
|
406
|
+
TtygAgentSettingsModalSteps.verifyRepositoryOptionNotExist('Fedx_repository');
|
|
407
|
+
TtygAgentSettingsModalSteps.verifyRepositoryOptionNotExist('Ontop_repository');
|
|
408
|
+
|
|
409
|
+
// When I open ChatGPT retrieval connector panel
|
|
410
|
+
TtygAgentSettingsModalSteps.enableRetrievalMethodPanel();
|
|
411
|
+
// Then I expect to see the first connector selected.
|
|
412
|
+
TtygAgentSettingsModalSteps.verifyRetrievalConnectorSelected('ChatGPT_starwars_one');
|
|
413
|
+
|
|
414
|
+
// When I select another repository that have retrieval connectors
|
|
415
|
+
TtygAgentSettingsModalSteps.selectRepository('biomarkers');
|
|
416
|
+
// Then I expect to see the first connector from new repository selected.
|
|
417
|
+
TtygAgentSettingsModalSteps.verifyRetrievalConnectorSelected('ChatGPT_biomarkers_one');
|
|
418
|
+
|
|
419
|
+
// When I select a repository that not have retrieval connectors
|
|
420
|
+
TtygAgentSettingsModalSteps.selectRepository('ttyg-repo-1725518186812');
|
|
421
|
+
// Then I expect help message to be open
|
|
422
|
+
TtygAgentSettingsModalSteps.getMissingRetrievalConnectorHelp().should('be.visible');
|
|
423
|
+
|
|
424
|
+
// When I click on help menu
|
|
425
|
+
TtygAgentSettingsModalSteps.clickOnMissingRetrievalConnectorHelp();
|
|
426
|
+
// Then I expect a confirm dialog displayed.
|
|
427
|
+
ModalDialogSteps.getDialogBody().contains('If you proceed with creating the ChatGPT Retrieval connector, GraphDB will open in a new tab and switch to the ttyg-repo-1725518186812 repository.');
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
it('Should updates the similarity form field when the repository is changed', () => {
|
|
431
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
432
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
433
|
+
ConnectorStubs.stubGetConnectors();
|
|
434
|
+
SimilarityIndexStubs.stubTTYGSimilarityIndexes();
|
|
435
|
+
// Given I have opened the ttyg page
|
|
436
|
+
TTYGViewSteps.visit();
|
|
437
|
+
cy.wait('@get-all-repositories');
|
|
438
|
+
|
|
439
|
+
// When I click on the create agent button
|
|
440
|
+
TTYGViewSteps.createFirstAgent();
|
|
441
|
+
// Then I expect the selected repository to be set as the repository ID in the form.
|
|
442
|
+
TtygAgentSettingsModalSteps.verifyRepositorySelected('starwars');
|
|
443
|
+
|
|
444
|
+
// When I open Similarity index name panel
|
|
445
|
+
TtygAgentSettingsModalSteps.enableSimilaritySearchMethodPanel();
|
|
446
|
+
// Then I expect to see the first index selected.
|
|
447
|
+
TtygAgentSettingsModalSteps.verifySimilarityIndexSelected('similarity_index_starwars_one');
|
|
448
|
+
|
|
449
|
+
// When I select another repository that have similarity connectors
|
|
450
|
+
TtygAgentSettingsModalSteps.selectRepository('biomarkers');
|
|
451
|
+
// Then I expect to see the first similarity index from new repository selected.
|
|
452
|
+
TtygAgentSettingsModalSteps.verifySimilarityIndexSelected('similarity_index_biomarkers_one');
|
|
453
|
+
|
|
454
|
+
// When I select a repository that not have similarity indexes
|
|
455
|
+
TtygAgentSettingsModalSteps.selectRepository('ttyg-repo-1725518186812');
|
|
456
|
+
// Then I expect help message to be open
|
|
457
|
+
TtygAgentSettingsModalSteps.getSimilaritySearchIndexMissingHelp().should('be.visible');
|
|
458
|
+
|
|
459
|
+
// When I click on help menu
|
|
460
|
+
TtygAgentSettingsModalSteps.clickOnSimilaritySearchIndexMissingHelp();
|
|
461
|
+
// Then I expect a confirm dialog displayed.
|
|
462
|
+
ModalDialogSteps.getDialogBody().contains('If you proceed with creating the similarity index, GraphDB will open in a new tab and switch to the ttyg-repo-1725518186812 repository.');
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
it('Should warn the user when temperature is set above given treshold', () => {
|
|
466
|
+
RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-enabled-fts.json');
|
|
467
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
468
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
469
|
+
// Given I have opened the ttyg page
|
|
470
|
+
TTYGViewSteps.visit();
|
|
471
|
+
cy.wait('@get-all-repositories');
|
|
472
|
+
cy.wait('@get-agent-list');
|
|
473
|
+
// When I open the agent settings dialog
|
|
474
|
+
TTYGViewSteps.createFirstAgent();
|
|
475
|
+
TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
|
|
476
|
+
// Then I expect that the high temperature warning is not visible
|
|
477
|
+
TtygAgentSettingsModalSteps.getTemperatureWarning().should('not.exist');
|
|
478
|
+
TtygAgentSettingsModalSteps.getTemperatureField().should('not.have.class', 'has-warning');
|
|
479
|
+
// And I change the temperature to value above 1.0
|
|
480
|
+
TtygAgentSettingsModalSteps.setTemperature('1.2');
|
|
481
|
+
TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '1.2');
|
|
482
|
+
// Then I should see a warning message
|
|
483
|
+
TtygAgentSettingsModalSteps.getTemperatureWarning().should('be.visible');
|
|
484
|
+
TtygAgentSettingsModalSteps.getTemperatureField().should('have.class', 'has-warning');
|
|
485
|
+
// When I change the temperature to value below 1.0
|
|
486
|
+
TtygAgentSettingsModalSteps.setTemperature('0.9');
|
|
487
|
+
TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '0.9');
|
|
488
|
+
// Then The high temperature warning should be hidden
|
|
489
|
+
TtygAgentSettingsModalSteps.getTemperatureWarning().should('not.exist');
|
|
490
|
+
TtygAgentSettingsModalSteps.getTemperatureField().should('not.have.class', 'has-warning');
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
it('Should warn the user when he changes the default value of the base instruction', () => {
|
|
494
|
+
RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-enabled-fts.json');
|
|
495
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
496
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
497
|
+
// Given I have opened the ttyg page
|
|
498
|
+
TTYGViewSteps.visit();
|
|
499
|
+
cy.wait('@get-all-repositories');
|
|
500
|
+
cy.wait('@get-agent-list');
|
|
501
|
+
// When I open the agent settings dialog
|
|
502
|
+
TTYGViewSteps.createFirstAgent();
|
|
503
|
+
TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
|
|
504
|
+
// Then I expect that the overriding base instruction warning is not visible
|
|
505
|
+
TtygAgentSettingsModalSteps.toggleAdvancedSettings();
|
|
506
|
+
TtygAgentSettingsModalSteps.getSystemInstructionsWarning().should('not.exist');
|
|
507
|
+
// When I change the base instruction
|
|
508
|
+
TtygAgentSettingsModalSteps.typeSystemInstructions('New');
|
|
509
|
+
// Then I should see a warning alert
|
|
510
|
+
AlertDialogSteps.getDialog().should('be.visible');
|
|
511
|
+
AlertDialogSteps.acceptAlert();
|
|
512
|
+
// And the warning should be visible
|
|
513
|
+
TtygAgentSettingsModalSteps.getSystemInstructionsWarning().should('be.visible');
|
|
514
|
+
// When I revert the base instruction to the default value
|
|
515
|
+
TtygAgentSettingsModalSteps.clearSystemInstructions();
|
|
516
|
+
// Then the warning should be hidden
|
|
517
|
+
TtygAgentSettingsModalSteps.getSystemInstructionsWarning().should('not.exist');
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
it('should reset validation error when similarity search/ChatGPT connector are disabled', () => {
|
|
521
|
+
// When I open agent settings dialog and make all steps so the create button became enabled.
|
|
522
|
+
TTYGStubs.stubChatsListGetNoResults();
|
|
523
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
|
|
524
|
+
TTYGViewSteps.visit();
|
|
525
|
+
cy.wait('@get-all-repositories');
|
|
526
|
+
TTYGViewSteps.createFirstAgent();
|
|
527
|
+
TtygAgentSettingsModalSteps.enableFtsExtractionMethod();
|
|
528
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
529
|
+
|
|
530
|
+
// When enable the similarity index method
|
|
531
|
+
TtygAgentSettingsModalSteps.enableSimilaritySearchMethodPanel();
|
|
532
|
+
// Then I expect the save button be disabled because there aren't indexes in the selected repo.
|
|
533
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
534
|
+
|
|
535
|
+
// When I disable the similarity index method
|
|
536
|
+
TtygAgentSettingsModalSteps.disableSimilaritySearchMethodPanel();
|
|
537
|
+
// Then I expect the save button be enabled because the method is disabled.
|
|
538
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
539
|
+
|
|
540
|
+
// When enable the ChatGPT Retrieval connector method
|
|
541
|
+
TtygAgentSettingsModalSteps.enableRetrievalMethodPanel();
|
|
542
|
+
// Then I expect the save button be disabled because there aren't retrieval connectors in the selected repo.
|
|
543
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
544
|
+
|
|
545
|
+
// When I disable the ChatGPT Retrieval connector method
|
|
546
|
+
TtygAgentSettingsModalSteps.disableRetrievalMethodPanel();
|
|
547
|
+
// Then I expect the save button be enabled because the method is disabled.
|
|
548
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
function fillAgentName(name) {
|
|
553
|
+
TtygAgentSettingsModalSteps.clearAgentName();
|
|
554
|
+
TtygAgentSettingsModalSteps.typeAgentName(name);
|
|
555
|
+
// the save button should be disabled because there are other required fields that are not filled in yet
|
|
556
|
+
TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
|
|
557
|
+
TtygAgentSettingsModalSteps.clearAgentName();
|
|
558
|
+
TtygAgentSettingsModalSteps.getAgentNameError().should('be.visible').and('contain', 'This field is required');
|
|
559
|
+
TtygAgentSettingsModalSteps.typeAgentName(name);
|
|
560
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
|
|
2
|
+
import {RepositoriesStub} from "../../stubs/repositories-stub";
|
|
3
|
+
import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
|
|
4
|
+
import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
|
|
5
|
+
import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
|
|
6
|
+
import HomeSteps from "../../steps/home-steps";
|
|
7
|
+
|
|
8
|
+
describe('TTYG create chat', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
// Create an actual repository to prevent stubbing all background requests that are not related to the ttyg view
|
|
11
|
+
RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
|
|
12
|
+
RepositoriesStub.stubBaseEndpoints('starwars');
|
|
13
|
+
cy.presetRepository('starwars');
|
|
14
|
+
TTYGStubs.stubChatsListGet("/ttyg/chats/create/get-chats-before-create.json");
|
|
15
|
+
TTYGStubs.stubAgentListGet();
|
|
16
|
+
TTYGStubs.stubChatGet();
|
|
17
|
+
|
|
18
|
+
// When visiting the TTYG page where there is a chat with questions and answers
|
|
19
|
+
TTYGViewSteps.visit();
|
|
20
|
+
cy.wait('@get-chat-list');
|
|
21
|
+
cy.wait('@get-agent-list');
|
|
22
|
+
cy.wait('@get-chat');
|
|
23
|
+
cy.wait('@get-all-repositories');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('Should persist the newly created chat in local store', () => {
|
|
27
|
+
// When I visit the TTYG page
|
|
28
|
+
// the first chat should be selected
|
|
29
|
+
TTYGViewSteps.getChatFromGroup(0, 0).should('have.class', 'selected');
|
|
30
|
+
TTYGViewSteps.getChatsFromGroup(0).should('have.length', 1);
|
|
31
|
+
|
|
32
|
+
// When I click on "Create a new chat" button
|
|
33
|
+
TTYGViewSteps.createANewChat();
|
|
34
|
+
// Then I expect no new chat be created
|
|
35
|
+
TTYGViewSteps.getChatFromGroup(0, 0).should('have.not.class', 'selected');
|
|
36
|
+
TTYGViewSteps.getChatsFromGroup(0).should('have.length', 1);
|
|
37
|
+
|
|
38
|
+
// When I type a question
|
|
39
|
+
ChatPanelSteps.getQuestionInputElement()
|
|
40
|
+
.should('be.visible')
|
|
41
|
+
.and('not.be.disabled')
|
|
42
|
+
.type('Who is Han Solo?');
|
|
43
|
+
|
|
44
|
+
// Then I expect the "Ask" button be active.
|
|
45
|
+
ChatPanelSteps.getAskButtonElement().should('be.enabled');
|
|
46
|
+
|
|
47
|
+
// When I click on "Ask" button.
|
|
48
|
+
TTYGStubs.stubCrateNewChat();
|
|
49
|
+
ChatPanelSteps.getAskButtonElement().scrollIntoView().click();
|
|
50
|
+
cy.wait('@create-chat');
|
|
51
|
+
|
|
52
|
+
// Then I expect new chat to be created in a new group "Today" and be selected
|
|
53
|
+
TTYGViewSteps.getChatGroup(0).should('contain', 'Today');
|
|
54
|
+
TTYGViewSteps.getChatFromGroup(0, 0).should('have.class', 'selected');
|
|
55
|
+
TTYGViewSteps.getChatsFromGroup(1).should('have.length', 1);
|
|
56
|
+
|
|
57
|
+
// When I go to another page
|
|
58
|
+
HomeSteps.visit();
|
|
59
|
+
// and returns to the TTYG page
|
|
60
|
+
TTYGStubs.stubChatsListGet("/ttyg/chats/create/get-chats-after-create.json");
|
|
61
|
+
TTYGStubs.stubAgentGet();
|
|
62
|
+
TTYGViewSteps.visit();
|
|
63
|
+
cy.wait('@get-chat-list');
|
|
64
|
+
cy.wait('@get-agent');
|
|
65
|
+
// Then I expect newly created chat be selected.
|
|
66
|
+
TTYGViewSteps.getChatFromGroup(0, 0).should('contain', 'New chat of Han Solo is a character');
|
|
67
|
+
TTYGViewSteps.getChatFromGroup(0, 0).should('have.class', 'selected');
|
|
68
|
+
});
|
|
69
|
+
});
|