graphdb-workbench-tests 2.7.4 → 2.8.0-TR2

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 (50) hide show
  1. package/fixtures/connectors/get-connectors.json +8 -0
  2. package/fixtures/connectors/get-retrieval-connector-0.json +1 -0
  3. package/fixtures/connectors/get-retrieval-connector.json +29 -0
  4. package/fixtures/locale-en.json +282 -21
  5. package/fixtures/namespaces/get-repository-starwars-namespaces.json +252 -0
  6. package/fixtures/repositories/get-locations.json +72 -0
  7. package/fixtures/repositories/get-repositories.json +106 -0
  8. package/fixtures/repositories/get-repository-config-starwars-disabled-fts.json +201 -0
  9. package/fixtures/repositories/get-repository-config-starwars-enabled-fts.json +201 -0
  10. package/fixtures/repositories/get-ttyg-repositories.json +46 -0
  11. package/fixtures/similarity/get-similarity-indexes-0.json +1 -0
  12. package/fixtures/similarity/get-similarity-indexes.json +15 -0
  13. package/fixtures/ttyg/agent/create-agent.json +19 -0
  14. package/fixtures/ttyg/agent/get-agent-list-0.json +1 -0
  15. package/fixtures/ttyg/agent/get-agent-list-after-deleted.json +56 -0
  16. package/fixtures/ttyg/agent/get-agent-list-new-agent.json +93 -0
  17. package/fixtures/ttyg/agent/get-agent-list.json +74 -0
  18. package/fixtures/ttyg/chats/deleted-chat.json +3 -0
  19. package/fixtures/ttyg/chats/get-chat-1.json +34 -0
  20. package/fixtures/ttyg/chats/get-chat-list-0.json +1 -0
  21. package/fixtures/ttyg/chats/get-chat-list-with-deleted-chat.json +17 -0
  22. package/fixtures/ttyg/chats/get-chat-list-with-renamed-chat.json +22 -0
  23. package/fixtures/ttyg/chats/get-chat-list.json +22 -0
  24. package/fixtures/ttyg/chats/renamed-chat.json +4 -0
  25. package/integration/import/import-user-data.spec.js +2 -1
  26. package/integration/repository/attach-remote-location.spec.js +154 -0
  27. package/integration/repository/ontop-repository.spec.js +87 -1
  28. package/integration/repository/repositories.spec.js +4 -13
  29. package/integration/ttyg/agent-list.spec.js +69 -0
  30. package/integration/ttyg/agent-select-menu.spec.js +139 -0
  31. package/integration/ttyg/chat-list.spec.js +158 -0
  32. package/integration/ttyg/chat-panel.spec.js +79 -0
  33. package/integration/ttyg/create-agent.spec.js +348 -0
  34. package/integration/ttyg/delete-agent.spec.js +50 -0
  35. package/integration/ttyg/ttyg-view.spec.js +72 -0
  36. package/npm-shrinkwrap.json +2 -2
  37. package/package.json +1 -1
  38. package/steps/import/import-steps.js +0 -4
  39. package/steps/modal-dialog-steps.js +8 -0
  40. package/steps/ontop-repository-steps.js +26 -0
  41. package/steps/repositories/attach-repository-steps.js +85 -0
  42. package/steps/repository-steps.js +33 -0
  43. package/steps/ttyg/chat-panel-steps.js +37 -0
  44. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +363 -0
  45. package/steps/ttyg/ttyg-view-steps.js +253 -0
  46. package/steps/window-steps.js +5 -0
  47. package/stubs/connector-stubs.js +15 -0
  48. package/stubs/repositories/repositories-stubs.js +138 -0
  49. package/stubs/similarity-index-stubs.js +7 -0
  50. package/stubs/ttyg/ttyg-stubs.js +106 -0
@@ -0,0 +1,348 @@
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 {NamespaceStubs} from "../../stubs/namespace-stubs";
6
+ import {SimilarityIndexStubs} from "../../stubs/similarity-index-stubs";
7
+ import {ConnectorStubs} from "../../stubs/connector-stubs";
8
+
9
+ describe('TTYG create new agent', () => {
10
+ const repositoryId = 'starwars';
11
+
12
+ beforeEach(() => {
13
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
14
+ cy.presetRepository(repositoryId);
15
+ NamespaceStubs.stubNameSpaceResponse(repositoryId, '/namespaces/get-repository-starwars-namespaces.json');
16
+ });
17
+
18
+ it('Should be able to cancel the new agent creation on the no agents view', () => {
19
+ TTYGStubs.stubChatsListGetNoResults();
20
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
21
+ // Given I have opened the ttyg page
22
+ TTYGViewSteps.visit();
23
+ // When I click on the create agent button
24
+ TTYGViewSteps.createFirstAgent();
25
+ // Then I should see the create agent modal
26
+ TtygAgentSettingsModalSteps.getDialog().should('be.visible');
27
+ // When I cancel the agent creation
28
+ TtygAgentSettingsModalSteps.cancel();
29
+ // Then the modal should be closed and I should see the no agents view again
30
+ TtygAgentSettingsModalSteps.getDialog().should('not.exist');
31
+ TTYGViewSteps.getNoAgentsView().should('be.visible');
32
+ });
33
+
34
+ it('Should be able to create a new agent with SPARQL extraction method on the no agents view', () => {
35
+ TTYGStubs.stubChatsListGetNoResults();
36
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
37
+ // Given I have opened the ttyg page
38
+ TTYGViewSteps.visit();
39
+ cy.wait('@get-all-repositories');
40
+ // When I click on the create agent button
41
+ TTYGViewSteps.createFirstAgent();
42
+ // Then I should see the create agent modal
43
+ TtygAgentSettingsModalSteps.getDialog().should('be.visible');
44
+ // And the save button should be disabled because the form is not configured yet
45
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
46
+ // Validate agent settings for SPARQL extraction method
47
+
48
+ // agent name
49
+ fillAgentName('Test Agent');
50
+
51
+ // repository ID
52
+ fillRepository(repositoryId);
53
+
54
+ // SPARQL extraction method settings
55
+
56
+ // At least one extraction method must be selected
57
+ // enable SPARQL extraction method and disable it again to check the error message for the extraction methods
58
+ TtygAgentSettingsModalSteps.toggleSparqlExtractionMethodPanel();
59
+ TtygAgentSettingsModalSteps.enableSparqlExtractionMethod();
60
+ TtygAgentSettingsModalSteps.disableSparqlExtractionMethod();
61
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
62
+ TtygAgentSettingsModalSteps.getExtractionMethodError().should('be.visible').and('contain', 'At least one query method must be selected');
63
+ TtygAgentSettingsModalSteps.enableSparqlExtractionMethod();
64
+ TtygAgentSettingsModalSteps.getExtractionMethodError().should('not.exist');
65
+ // the save button should be disabled because the SPARQL method options are not configured yet
66
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
67
+ // and there should be an error message for the SPARQL extraction method
68
+ TtygAgentSettingsModalSteps.getSparqlExtractionMethodError().should('be.visible').and('contain', 'Select how an ontology should be fetched');
69
+ // select the ontology graph SPARQL extraction method option
70
+ TtygAgentSettingsModalSteps.selectSparqlMethodOntologyGraph();
71
+ // the ontology graph default value should be visible
72
+ TtygAgentSettingsModalSteps.getSparqlMethodOntologyGraphField().should('have.value', 'http://example.com/swgraph');
73
+ // if the value is removed, the save button should be disabled because these fields are required if the option is selected
74
+ TtygAgentSettingsModalSteps.clearSparqlMethodOntologyGraphField();
75
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
76
+ TtygAgentSettingsModalSteps.typeSparqlMethodOntologyGraphField('http://example.com/swgraph');
77
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
78
+ // select the sparql query SPARQL extraction method option
79
+ TtygAgentSettingsModalSteps.selectSparqlMethodSparqlQuery();
80
+ TtygAgentSettingsModalSteps.getSparqlMethodSparqlQueryField().should('have.value', 'select ?s ?p ?o where {?s ?p ?o .}');
81
+ // if the value is removed, the save button should be disabled because these fields are required if the option is selected
82
+ TtygAgentSettingsModalSteps.clearSparqlMethodSparqlQueryField();
83
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
84
+ TtygAgentSettingsModalSteps.typeSparqlMethodSparqlQueryField('select ?s ?p ?o where {?s ?p ?o .}');
85
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
86
+
87
+ // Validate the other agent settings
88
+
89
+ // gpt model
90
+ TtygAgentSettingsModalSteps.getGptModelField().should('have.value', 'gpt-4o');
91
+ TtygAgentSettingsModalSteps.clearGptModel();
92
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
93
+ TtygAgentSettingsModalSteps.getGptModelError().should('be.visible').and('contain', 'This field is required');
94
+ TtygAgentSettingsModalSteps.typeGptModel('gpt-4o');
95
+
96
+ // temperature
97
+ TtygAgentSettingsModalSteps.getTemperatureField().should('have.value', '0.7');
98
+ TtygAgentSettingsModalSteps.setTemperature('0.2');
99
+ TtygAgentSettingsModalSteps.getTemperatureField().should('have.value', '0.2');
100
+
101
+ // Top P
102
+ TtygAgentSettingsModalSteps.getTopPField().should('have.value', '1');
103
+ TtygAgentSettingsModalSteps.setTopP('0.2');
104
+ TtygAgentSettingsModalSteps.getTopPField().should('have.value', '0.2');
105
+
106
+ // Seed
107
+ TtygAgentSettingsModalSteps.getSeedField().should('have.value', '1');
108
+ // The seed field is optional, so the save button should be enabled
109
+ TtygAgentSettingsModalSteps.clearSeed();
110
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
111
+ TtygAgentSettingsModalSteps.typeSeed('2');
112
+
113
+ // Validate the advanced settings
114
+
115
+ // System instructions
116
+ TtygAgentSettingsModalSteps.getSystemInstructionsField().should('have.value', '');
117
+
118
+ // User instructions
119
+ TtygAgentSettingsModalSteps.getUserInstructionsField().should('have.value', '');
120
+
121
+ // Save the agent
122
+ // stub the agent create request
123
+ TTYGStubs.stubAgentCreate();
124
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
125
+ TtygAgentSettingsModalSteps.saveAgent();
126
+ // the modal should be closed and the agent should be created
127
+ TtygAgentSettingsModalSteps.getDialog().should('not.exist');
128
+ TTYGViewSteps.getNoAgentsView().should('not.exist');
129
+ // the new agent should be visible in the agent list (there were 4 agents before, so now there should be 5)
130
+ TTYGViewSteps.getAgents().should('have.length', 5);
131
+ TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
132
+ });
133
+
134
+ it('Should require repository ID to be selected to be able to configure the FTS extraction method', () => {
135
+ RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-disabled-fts.json');
136
+ TTYGStubs.stubChatsListGetNoResults();
137
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
138
+ // Given I have opened the ttyg page
139
+ TTYGViewSteps.visit();
140
+ cy.wait('@get-all-repositories');
141
+ // When I click on the create agent button
142
+ TTYGViewSteps.createFirstAgent();
143
+ // When I open the full text search extraction method panel
144
+ TtygAgentSettingsModalSteps.toggleFTSExtractionMethodPanel();
145
+ // Then I should see an error alert for repository id not selected
146
+ TtygAgentSettingsModalSteps.getMissingRepositoryIdErrorInFtsSearchPanel().should('be.visible')
147
+ .and('contain', 'Repository ID must be selected');
148
+ // And I should not see the max triples field
149
+ TtygAgentSettingsModalSteps.getFtsSearchMaxTriplesFormGroup().should('be.hidden');
150
+ // When I select a repository
151
+ TtygAgentSettingsModalSteps.selectRepository(repositoryId);
152
+ // Then the error alert should be hidden
153
+ TtygAgentSettingsModalSteps.getMissingRepositoryIdErrorInFtsSearchPanel().should('not.exist');
154
+ });
155
+
156
+ it('Should require FTS to be enabled for selected repository when creating agent with FTS extraction method', () => {
157
+ RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-disabled-fts.json');
158
+ TTYGStubs.stubChatsListGetNoResults();
159
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
160
+ // Given I have opened the ttyg page
161
+ TTYGViewSteps.visit();
162
+ cy.wait('@get-all-repositories');
163
+ // When I click on the create agent button
164
+ TTYGViewSteps.createFirstAgent();
165
+ // And I select a repository
166
+ TtygAgentSettingsModalSteps.selectRepository(repositoryId);
167
+ // When I open the full text search extraction method panel
168
+ TtygAgentSettingsModalSteps.toggleFTSExtractionMethodPanel();
169
+ // Then I should see a help message for FTS not enabled
170
+ TtygAgentSettingsModalSteps.getFtsDisabledHelp().should('be.visible');
171
+ });
172
+
173
+ it('Should be able to create agent with FTS extraction method', () => {
174
+ RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-enabled-fts.json');
175
+ TTYGStubs.stubChatsListGetNoResults();
176
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
177
+ // Given I have opened the ttyg page
178
+ TTYGViewSteps.visit();
179
+ cy.wait('@get-all-repositories');
180
+ // When I click on the create agent button
181
+ TTYGViewSteps.createFirstAgent();
182
+ // And I fill in the agent name
183
+ TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
184
+ // And I select a repository
185
+ TtygAgentSettingsModalSteps.selectRepository(repositoryId);
186
+ // When I open the full text search extraction method panel
187
+ TtygAgentSettingsModalSteps.toggleFTSExtractionMethodPanel();
188
+ // The save button should be disabled because the FTS extraction method is not enabled
189
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
190
+ // And I enable the FTS extraction method
191
+ TtygAgentSettingsModalSteps.enableFtsExtractionMethod();
192
+ // The save button should be enabled
193
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
194
+ // When I save the agent
195
+ TTYGStubs.stubAgentCreate();
196
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
197
+ TtygAgentSettingsModalSteps.saveAgent();
198
+ // the modal should be closed and the agent should be created
199
+ TtygAgentSettingsModalSteps.getDialog().should('not.exist');
200
+ TTYGViewSteps.getNoAgentsView().should('not.exist');
201
+ // the new agent should be visible in the agent list (there were 4 agents before, so now there should be 5)
202
+ TTYGViewSteps.getAgents().should('have.length', 5);
203
+ TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
204
+ });
205
+
206
+ it('Should require similarity index in order to create agent with similarity search method', () => {
207
+ TTYGStubs.stubChatsListGetNoResults();
208
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
209
+ SimilarityIndexStubs.stubGetSimilarityIndexes('/similarity/get-similarity-indexes-0.json');
210
+ // Given I have opened the ttyg page
211
+ TTYGViewSteps.visit();
212
+ cy.wait('@get-all-repositories');
213
+ // When I click on the create agent button
214
+ TTYGViewSteps.createFirstAgent();
215
+ // When I open the similarity search extraction method panel
216
+ TtygAgentSettingsModalSteps.toggleSimilaritySearchMethodPanel();
217
+ // Then I should see a help message for similarity index missing
218
+ TtygAgentSettingsModalSteps.getSimilaritySearchIndexMissingHelp().should('be.visible');
219
+ // When I select the similarity search extraction method
220
+ TtygAgentSettingsModalSteps.enableSimilaritySearchMethodPanel();
221
+ // Then the help message should stay
222
+ TtygAgentSettingsModalSteps.getSimilaritySearchIndexMissingHelp().should('be.visible');
223
+ // And the agent save button should be disabled because the similarity index method is not configured yet
224
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
225
+ });
226
+
227
+ it('Should be able to configure and create agent with similarity index search method', () => {
228
+ TTYGStubs.stubChatsListGetNoResults();
229
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
230
+ SimilarityIndexStubs.stubGetSimilarityIndexes();
231
+ // Given I have opened the ttyg page
232
+ TTYGViewSteps.visit();
233
+ cy.wait('@get-all-repositories');
234
+ // When I click on the create agent button
235
+ TTYGViewSteps.createFirstAgent();
236
+ TtygAgentSettingsModalSteps.getDialog().should('be.visible');
237
+ TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
238
+ TtygAgentSettingsModalSteps.selectRepository(repositoryId);
239
+ // When I open the similarity search extraction method panel
240
+ TtygAgentSettingsModalSteps.toggleSimilaritySearchMethodPanel();
241
+ // And I enable the similarity search extraction method
242
+ TtygAgentSettingsModalSteps.enableSimilaritySearchMethodPanel();
243
+ // And I select a similarity index
244
+ TtygAgentSettingsModalSteps.getSimilarityIndexField().should('have.value', '');
245
+ TtygAgentSettingsModalSteps.selectSimilarityIndex('similarity-index');
246
+ // Then agent save button should be enabled
247
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
248
+ // When I set the similarity index threshold
249
+ TtygAgentSettingsModalSteps.getSimilarityIndexThresholdField().should('have.value', '0.6');
250
+ TtygAgentSettingsModalSteps.setSimilarityIndexThreshold('0.8');
251
+ // And I set the max triples per call
252
+ TtygAgentSettingsModalSteps.getSimilarityIndexMaxTriplesField().should('have.value', '');
253
+ TtygAgentSettingsModalSteps.setSimilarityIndexMaxTriples('100');
254
+ // When I save the agent
255
+ TTYGStubs.stubAgentCreate();
256
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
257
+ TtygAgentSettingsModalSteps.saveAgent();
258
+ // the modal should be closed and the agent should be created
259
+ TtygAgentSettingsModalSteps.getDialog().should('not.exist');
260
+ TTYGViewSteps.getNoAgentsView().should('not.exist');
261
+ // the new agent should be visible in the agent list (there were 4 agents before, so now there should be 5)
262
+ TTYGViewSteps.getAgents().should('have.length', 5);
263
+ TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
264
+ });
265
+
266
+ it('Should require retrieval connector in order to create an agent with GPT retrieval connector method', () => {
267
+ TTYGStubs.stubChatsListGetNoResults();
268
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
269
+ ConnectorStubs.stubGetConnectors();
270
+ ConnectorStubs.stubGetRetrievalConnector('/connectors/get-retrieval-connector-0.json');
271
+ // Given I have opened the ttyg page
272
+ TTYGViewSteps.visit();
273
+ cy.wait('@get-all-repositories');
274
+ // When I click on the create agent button
275
+ TTYGViewSteps.createFirstAgent();
276
+ TtygAgentSettingsModalSteps.getDialog().should('be.visible');
277
+ TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
278
+ TtygAgentSettingsModalSteps.selectRepository(repositoryId);
279
+ // When I select and open the GPT retrieval connector method panel
280
+ TtygAgentSettingsModalSteps.toggleRetrievalMethodPanel();
281
+ TtygAgentSettingsModalSteps.enableRetrievalMethodPanel();
282
+ // Then I should see the missing connector help message
283
+ TtygAgentSettingsModalSteps.getMissingRetrievalConnectorHelp().should('be.visible');
284
+ // And the save button should be disabled
285
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
286
+ });
287
+
288
+ it('Should be able to configure and create an agent with retrieval connector method', () => {
289
+ TTYGStubs.stubChatsListGetNoResults();
290
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
291
+ ConnectorStubs.stubGetConnectors();
292
+ ConnectorStubs.stubGetRetrievalConnector();
293
+ // Given I have opened the ttyg page
294
+ TTYGViewSteps.visit();
295
+ cy.wait('@get-all-repositories');
296
+ // When I click on the create agent button
297
+ TTYGViewSteps.createFirstAgent();
298
+ TtygAgentSettingsModalSteps.getDialog().should('be.visible');
299
+ TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
300
+ TtygAgentSettingsModalSteps.selectRepository(repositoryId);
301
+ // When I select and open the GPT retrieval connector method panel
302
+ TtygAgentSettingsModalSteps.toggleRetrievalMethodPanel();
303
+ TtygAgentSettingsModalSteps.enableRetrievalMethodPanel();
304
+ // And I select a retrieval connector
305
+ TtygAgentSettingsModalSteps.getRetrievalConnectorField().should('have.value', '');
306
+ TtygAgentSettingsModalSteps.selectRetrievalConnector('gpt-connector');
307
+ // Then the save button should be enabled
308
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
309
+ // When I remove the query template
310
+ TtygAgentSettingsModalSteps.getQueryTemplateField().should('have.value', '{"query": "string"}');
311
+ TtygAgentSettingsModalSteps.clearQueryTemplate();
312
+ // Then the save button should be disabled
313
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
314
+ // And I set the query template
315
+ TtygAgentSettingsModalSteps.typeQueryTemplate('{"query": "string"}');
316
+ // Then the save button should be enabled
317
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
318
+ // When I set the max triples per call
319
+ TtygAgentSettingsModalSteps.getRetrievalMaxTriplesField().should('have.value', '');
320
+ TtygAgentSettingsModalSteps.setRetrievalMaxTriples('100');
321
+ // When I save the agent
322
+ TTYGStubs.stubAgentCreate();
323
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
324
+ TtygAgentSettingsModalSteps.saveAgent();
325
+ // the modal should be closed and the agent should be created
326
+ TtygAgentSettingsModalSteps.getDialog().should('not.exist');
327
+ TTYGViewSteps.getNoAgentsView().should('not.exist');
328
+ // the new agent should be visible in the agent list (there were 4 agents before, so now there should be 5)
329
+ TTYGViewSteps.getAgents().should('have.length', 5);
330
+ TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
331
+ });
332
+ });
333
+
334
+ function fillAgentName(name) {
335
+ TtygAgentSettingsModalSteps.typeAgentName(name);
336
+ // the save button should be disabled because there are other required fields that are not filled in yet
337
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
338
+ TtygAgentSettingsModalSteps.clearAgentName();
339
+ TtygAgentSettingsModalSteps.getAgentNameError().should('be.visible').and('contain', 'This field is required');
340
+ TtygAgentSettingsModalSteps.typeAgentName(name);
341
+ }
342
+
343
+ function fillRepository(repositoryId) {
344
+ TtygAgentSettingsModalSteps.getRepositoryIdError().should('be.visible').and('contain', 'This field is required');
345
+ TtygAgentSettingsModalSteps.selectRepository(repositoryId);
346
+ // the save button should be disabled because there are other required fields that are not filled in yet
347
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
348
+ }
@@ -0,0 +1,50 @@
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 {NamespaceStubs} from "../../stubs/namespace-stubs";
5
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
6
+
7
+ describe('TTYG delete agent', () => {
8
+ const repositoryId = 'starwars';
9
+
10
+ beforeEach(() => {
11
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
12
+ cy.presetRepository(repositoryId);
13
+ NamespaceStubs.stubNameSpaceResponse(repositoryId, '/namespaces/get-repository-starwars-namespaces.json');
14
+ });
15
+
16
+ it('Should be able to delete agent', () => {
17
+ TTYGStubs.stubChatsListGetNoResults();
18
+ TTYGStubs.stubAgentListGet();
19
+ // Given I have opened the ttyg page
20
+ TTYGViewSteps.visit();
21
+ TTYGViewSteps.getAgents().should('have.length', 2);
22
+ TTYGViewSteps.filterAgentsByRepository('All');
23
+ TTYGViewSteps.getAgents().should('have.length', 4);
24
+ // When I select the delete agent action
25
+ TTYGViewSteps.triggerDeleteAgentActionMenu(0);
26
+ // Then I should see the delete agent dialog
27
+ ModalDialogSteps.getDialog().should('be.visible');
28
+ ModalDialogSteps.getDialogBody().contains('Do you really want to delete the agent agent-1?');
29
+ // When I cancel the delete agent action
30
+ ModalDialogSteps.cancel();
31
+ // Then the modal dialog should be closed
32
+ ModalDialogSteps.getDialog().should('not.exist');
33
+ // When I select the delete agent action
34
+ TTYGStubs.stubAgentDelete(1000);
35
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-after-deleted.json');
36
+ TTYGViewSteps.triggerDeleteAgentActionMenu(0);
37
+ // And I confirm the delete agent action
38
+ ModalDialogSteps.confirm();
39
+ // Then the modal dialog should be closed
40
+ ModalDialogSteps.getDialog().should('not.exist');
41
+ // And the agent should be deleted
42
+ TTYGViewSteps.getAgentDeletingLoader().should('be.visible');
43
+ TTYGViewSteps.getAgents().should('have.length', 3);
44
+ TTYGViewSteps.verifyAgentList([
45
+ {name: 'agent-2', repositoryId: 'Deleted repository'},
46
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars'},
47
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers'}
48
+ ]);
49
+ });
50
+ });
@@ -0,0 +1,72 @@
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 {ApplicationSteps} from "../../steps/application-steps";
5
+ import {NamespaceStubs} from "../../stubs/namespace-stubs";
6
+
7
+ describe('TTYG view', () => {
8
+
9
+ const repositoryId = 'starwars';
10
+
11
+ beforeEach(() => {
12
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
13
+ cy.presetRepository(repositoryId);
14
+ NamespaceStubs.stubNameSpaceResponse(repositoryId, '/namespaces/get-repository-starwars-namespaces.json');
15
+ });
16
+
17
+ // TODO: This test is skipped because it fails on CI. For some reason the chat list panel is not visible.
18
+ it.skip('Should load ttyg page and render main components', () => {
19
+ TTYGStubs.stubChatsListGet();
20
+ TTYGStubs.stubAgentListGet();
21
+ TTYGStubs.stubChatGet();
22
+ // Given I have opened the ttyg page
23
+ TTYGViewSteps.visit();
24
+ // When the ttyg page is loaded
25
+ // Then I should see the ttyg view
26
+ TTYGViewSteps.getTtygView().should('exist');
27
+ TTYGViewSteps.getTtygViewTitle().should('contain', 'Talk to Your Graph');
28
+ // Verify the chats sidebar
29
+ TTYGViewSteps.getChatsPanel().should('be.visible');
30
+ TTYGViewSteps.getToggleChatsSidebarButton().should('be.visible');
31
+ // The create chat button is hidden by default when there are no chats
32
+ TTYGViewSteps.getCreateChatButton().should('not.exist');
33
+ // Verify the agents sidebar
34
+ TTYGViewSteps.getAgentsPanel().should('be.visible');
35
+ TTYGViewSteps.getHelpButton().should('be.visible');
36
+ TTYGViewSteps.getCreateAgentButton().should('be.visible');
37
+ TTYGViewSteps.getToggleAgentsSidebarButton().should('be.visible');
38
+ // Verify the chat panel
39
+ TTYGViewSteps.getChat().should('be.visible');
40
+ TTYGViewSteps.getChatPanelToolbar().should('be.visible');
41
+ TTYGViewSteps.getEditCurrentAgentButton().should('be.visible');
42
+ TTYGViewSteps.getExportCurrentChatButton().should('be.visible');
43
+ });
44
+
45
+ it('Should render no agents view if no agent is created yet', () => {
46
+ TTYGStubs.stubChatsListGetNoResults();
47
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
48
+ // Given I have opened the ttyg page
49
+ TTYGViewSteps.visit();
50
+ // When the ttyg page is loaded
51
+ // Then I should see the ttyg view
52
+ TTYGViewSteps.getTtygView().should('exist');
53
+ // And the no agents view should be rendered
54
+ TTYGViewSteps.getNoAgentsView().should('be.visible');
55
+ // And the create agent button should be visible
56
+ TTYGViewSteps.getCreateFirstAgentButton().should('be.visible');
57
+ });
58
+
59
+ it('Should show error notification if agents loading fails', () => {
60
+ TTYGStubs.stubChatsListGet();
61
+ TTYGStubs.stubAgentListGetError();
62
+ TTYGStubs.stubChatGet();
63
+ // Given I have opened the ttyg page
64
+ TTYGViewSteps.visit();
65
+ // When the agents loading fails
66
+ // Then I should see an error notification
67
+ ApplicationSteps.getErrorNotifications().should('be.visible');
68
+ // And the no agents view should be rendered
69
+ TTYGViewSteps.getNoAgentsView().should('be.visible');
70
+ });
71
+ });
72
+
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.7.4",
3
+ "version": "2.8.0-TR2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "2.7.4",
9
+ "version": "2.8.0-TR2",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "cypress": "^13.3.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.7.4",
3
+ "version": "2.8.0-TR2",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
@@ -139,10 +139,6 @@ class ImportSteps {
139
139
  return this.getImportUserDataHelp().find('.copy-btn').click();
140
140
  }
141
141
 
142
- static getClipboardTextContent() {
143
- return cy.window().its('navigator.clipboard').invoke('readText').then((text) => text);
144
- }
145
-
146
142
  static toggleHelpMessage() {
147
143
  // For some reason the page info box opens unexpectedly and covers the help info icon.
148
144
  this.getView().find('.toggle-help-btn').click({force: true});
@@ -39,6 +39,10 @@ export class ModalDialogSteps {
39
39
  ModalDialogSteps.getConfirmButton().click();
40
40
  }
41
41
 
42
+ static confirm() {
43
+ ModalDialogSteps.getConfirmButton().click();
44
+ }
45
+
42
46
  static getCancelButton() {
43
47
  return ModalDialogSteps.getDialogFooter().find('.cancel-btn');
44
48
  }
@@ -47,6 +51,10 @@ export class ModalDialogSteps {
47
51
  ModalDialogSteps.getCancelButton().click();
48
52
  }
49
53
 
54
+ static cancel() {
55
+ ModalDialogSteps.getCancelButton().click();
56
+ }
57
+
50
58
  static verifyUrlChangedConfirmation(verifyConfirmationDialogOptions = new VerifyConfirmationDialogOptions()) {
51
59
  // and try to change the page
52
60
  verifyConfirmationDialogOptions.changePageFunction();
@@ -79,6 +79,10 @@ export class OntopRepositorySteps {
79
79
  return cy.get('#driverClass');
80
80
  }
81
81
 
82
+ static typeDriverClass(driverClass) {
83
+ OntopRepositorySteps.getDriverClassInput().type(driverClass);
84
+ }
85
+
82
86
  static getUrlInput() {
83
87
  return cy.get('#url');
84
88
  }
@@ -87,15 +91,37 @@ export class OntopRepositorySteps {
87
91
  return cy.get('#hostName');
88
92
  }
89
93
 
94
+ static typeHostName(host) {
95
+ OntopRepositorySteps.getHostNameInput().type(host);
96
+ }
97
+
90
98
  static getPortInput() {
91
99
  return cy.get('#port');
92
100
  }
93
101
 
102
+ static typePort(port) {
103
+ OntopRepositorySteps.getPortInput().type(port);
104
+ }
105
+
94
106
  static getDatabaseNameInput() {
95
107
  return cy.get('#databaseName');
96
108
  }
97
109
 
110
+ static typeDatabaseName(database) {
111
+ OntopRepositorySteps.getDatabaseNameInput().type(database);
112
+ }
113
+
98
114
  static getTestConnectionButton() {
99
115
  return cy.get('#testConnection');
100
116
  }
117
+
118
+ static clickObdaFileUploadButton() {
119
+ OntopRepositorySteps.getOBDAUploadButton().click();
120
+ }
121
+
122
+ static uploadObdaFile(file) {
123
+ // The label for the input has visibility: hidden, so force must be used
124
+ // eq() index 0 for location of OBDA field input
125
+ cy.get('input[type=file]').eq(0).selectFile(file, {force: true});
126
+ }
101
127
  }
@@ -0,0 +1,85 @@
1
+ export class AttachRepositorySteps {
2
+
3
+ static getAttachRemoteLocationBtn() {
4
+ return cy.get('#addAttachRemoteLocation');
5
+ }
6
+
7
+ static openAttachRemoteLocationDialog() {
8
+ AttachRepositorySteps.getAttachRemoteLocationBtn().click();
9
+ }
10
+
11
+ static getAttachBtn() {
12
+ return cy.get('.attach-location');
13
+ }
14
+
15
+ static attachRemoteLocation() {
16
+ AttachRepositorySteps.getAttachBtn().click();
17
+ }
18
+
19
+ static getCancelBtn() {
20
+ return cy.get('.cancel-attaching-location');
21
+ }
22
+
23
+ static cancelAttaching() {
24
+ AttachRepositorySteps.getCancelBtn().click();
25
+ }
26
+
27
+ static saveRemoteLocation() {
28
+ AttachRepositorySteps.getAttachBtn().click();
29
+ }
30
+
31
+ static getRemoteLocationDialog() {
32
+ return cy.get('#remoteLocationForm');
33
+ }
34
+
35
+ static getAuthenticationRadioBtn() {
36
+ return AttachRepositorySteps.getRemoteLocationDialog().find('.none-authentication');
37
+ }
38
+
39
+ static selectAuthenticationRadioBtn() {
40
+ AttachRepositorySteps.getAuthenticationRadioBtn().check();
41
+ }
42
+
43
+ static getBasicRadioBtn() {
44
+ return AttachRepositorySteps.getRemoteLocationDialog().find('.basic-authentication');
45
+ }
46
+
47
+ static selectBasicRadioBtn() {
48
+ AttachRepositorySteps.getBasicRadioBtn().check();
49
+ }
50
+
51
+ static getSignatureRadioBtn() {
52
+ return AttachRepositorySteps.getRemoteLocationDialog().find('.signature-authentication');
53
+ }
54
+
55
+ static selectSignatureRadioBtn() {
56
+ AttachRepositorySteps.getSignatureRadioBtn().check();
57
+ }
58
+
59
+ static getGraphDBRadioBtn() {
60
+ return AttachRepositorySteps.getRemoteLocationDialog().find('.graph-db-instance');
61
+ }
62
+
63
+ static selectGraphDBRadioBtn() {
64
+ AttachRepositorySteps.getGraphDBRadioBtn().check();
65
+ }
66
+ static getOntopicRadioBtn() {
67
+ return AttachRepositorySteps.getRemoteLocationDialog().find('.ontopic-instance');
68
+ }
69
+
70
+ static selectOntopicRadioBtn() {
71
+ AttachRepositorySteps.getOntopicRadioBtn().check();
72
+ }
73
+
74
+ static getLocationURLInput() {
75
+ return AttachRepositorySteps.getRemoteLocationDialog().get('#location');
76
+ }
77
+
78
+ static getUsernameInput() {
79
+ return AttachRepositorySteps.getRemoteLocationDialog().get('#username');
80
+ }
81
+
82
+ static getPasswordInput() {
83
+ return AttachRepositorySteps.getRemoteLocationDialog().get('#password');
84
+ }
85
+ }