graphdb-workbench-tests 2.8.0-Test → 2.8.1-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.
Files changed (135) hide show
  1. package/cypress.config.js +4 -1
  2. package/fixtures/cluster/2-nodes-cluster-group-status-deleted.json +30 -0
  3. package/fixtures/cluster/2-nodes-cluster-group-status.json +30 -0
  4. package/fixtures/cluster/3-nodes-cluster-group-status-after-replace.json +44 -0
  5. package/fixtures/cluster/3-nodes-cluster-group-status-building-snapshot.json +4 -1
  6. package/fixtures/cluster/3-nodes-cluster-group-status-receiving-snapshot.json +4 -1
  7. package/fixtures/cluster/3-nodes-cluster-group-status-sending-snapshot.json +4 -1
  8. package/fixtures/cluster/3-nodes-cluster-group-status-waiting-for-snapshot.json +4 -1
  9. package/fixtures/cluster/3-nodes-cluster-group-status-with-tag.json +47 -0
  10. package/fixtures/cluster/3-nodes-cluster-group-status.json +12 -3
  11. package/fixtures/cluster/4-nodes-cluster-group-status.json +58 -0
  12. package/fixtures/cluster/cluster-config.json +1 -0
  13. package/fixtures/cluster/cluster-node-status.json +4 -1
  14. package/fixtures/cluster/no-cluster-group-status.json +2 -1
  15. package/fixtures/cluster/no-cluster-node-status.json +2 -1
  16. package/fixtures/cluster/save-cluster-configuration-response.json +10 -0
  17. package/fixtures/connectors/get-retrieval-connector.json +1 -1
  18. package/fixtures/connectors/get-ttyg-chatgpt-connectors.json +188 -0
  19. package/fixtures/locale-en.json +386 -103
  20. package/fixtures/remote-location/get-0-remote-locations.json +1 -2
  21. package/fixtures/remote-location/get-1-remote-locations.json +2 -4
  22. package/fixtures/remote-location/get-2-remote-locations.json +3 -6
  23. package/fixtures/remote-location/get-3-remote-locations.json +4 -8
  24. package/fixtures/remote-location/get-4-remote-locations.json +54 -0
  25. package/fixtures/remote-location/remote-location-status-in-cluster.json +1 -2
  26. package/fixtures/remote-location/remote-location-status-not-in-cluster.json +1 -2
  27. package/fixtures/remote-location/remote-locations-filter.json +1 -2
  28. package/fixtures/repositories/get-locations.json +5 -10
  29. package/fixtures/repositories/get-remote-and-local-repositories.json +34 -0
  30. package/fixtures/repositories/get-ttyg-repositories.json +28 -0
  31. package/fixtures/security/get-admin-user.json +22 -0
  32. package/fixtures/similarity/get-ttyg-similarity-connectors.json +46 -0
  33. package/fixtures/ttyg/agent/create-agent.json +2 -1
  34. package/fixtures/ttyg/agent/get-agent-defaults.json +42 -0
  35. package/fixtures/ttyg/agent/get-agent-list-after-deleted.json +1 -1
  36. package/fixtures/ttyg/agent/get-agent-list-new-agent.json +2 -73
  37. package/fixtures/ttyg/agent/get-agent-list.json +1 -1
  38. package/fixtures/ttyg/agent/get-agent.json +25 -0
  39. package/fixtures/ttyg/chats/ask-question.json +25 -0
  40. package/fixtures/ttyg/chats/create/create-chat-response.json +16 -0
  41. package/fixtures/ttyg/chats/create/get-chats-after-create.json +12 -0
  42. package/fixtures/ttyg/chats/create/get-chats-before-create.json +7 -0
  43. package/fixtures/ttyg/chats/explain-response-1.json +59 -0
  44. package/fixtures/ttyg/chats/explain-response-2.json +59 -0
  45. package/fixtures/ttyg/chats/get-chat.json +199 -0
  46. package/integration/cluster/cluster-configuration/cluster-configuration-multi-region.spec.js +97 -0
  47. package/integration/cluster/cluster-configuration/cluster-configuration-nodes.spec.js +70 -0
  48. package/integration/cluster/cluster-configuration/cluster-configuration-properties.spec.js +95 -0
  49. package/integration/cluster/cluster-configuration/cluster-configuration.spec.js +38 -0
  50. package/integration/cluster/cluster-legend.spec.js +1 -0
  51. package/integration/cluster/edit-cluster-nodes-modal.spec.js +425 -0
  52. package/integration/explore/graphs.overview.spec.js +4 -0
  53. package/integration/explore/{similariti-index-create.spec.js → similarity-index/similarity-index-create.spec.js} +4 -4
  54. package/integration/explore/{similarity-index.spec.js → similarity-index/similarity-index.spec.js} +6 -6
  55. package/integration/explore/{similarity.spec.js → similarity-index/similarity.spec.js} +7 -8
  56. package/integration/explore/visual-graph/visual.graph.spec.js +34 -35
  57. package/integration/home/cookie-policy.spec.js +83 -0
  58. package/integration/home/create-repository.spec.js +35 -0
  59. package/integration/home/documentation-link.spec.js +60 -0
  60. package/integration/home/google-analytics.spec.js +60 -0
  61. package/integration/home/language-selector.spec.js +19 -0
  62. package/integration/home/rdf-resource-search.spec.js +192 -0
  63. package/integration/home/view-resource-autocomplete.spec.js +52 -0
  64. package/integration/home/workbench.home.spec.js +1 -277
  65. package/integration/import/import-user-data-file-upload.spec.js +13 -0
  66. package/integration/import/import-user-data.spec.js +6 -1
  67. package/integration/import/import-view.spec.js +6 -1
  68. package/integration/license/license.spec.js +26 -0
  69. package/integration/repository/attach-remote-location.spec.js +94 -40
  70. package/integration/repository/repositories.spec.js +40 -7
  71. package/integration/setup/autocomplete.spec.js +21 -70
  72. package/integration/setup/{jdbc-create.spec.js → jdbc/jdbc-create.spec.js} +9 -10
  73. package/integration/setup/{jdbc.spec.js → jdbc/jdbc.spec.js} +56 -25
  74. package/integration/setup/my-settings.spec.js +13 -21
  75. package/integration/setup/namespaces.spec.js +132 -264
  76. package/integration/setup/plugins.spec.js +22 -51
  77. package/integration/setup/rdf-rank.spec.js +42 -138
  78. package/integration/ttyg/agent-list.spec.js +27 -25
  79. package/integration/ttyg/agent-select-menu.spec.js +18 -16
  80. package/integration/ttyg/chat-list.spec.js +72 -9
  81. package/integration/ttyg/chat-panel.spec.js +106 -10
  82. package/integration/ttyg/clone-agent.spec.js +8 -4
  83. package/integration/ttyg/create-agent.spec.js +303 -51
  84. package/integration/ttyg/create-chat.spec.js +68 -0
  85. package/integration/ttyg/delete-agent.spec.js +6 -5
  86. package/integration/ttyg/edit-agent.spec.js +16 -5
  87. package/integration/ttyg/ttyg-permission.spec.js +66 -0
  88. package/integration/ttyg/ttyg-view.spec.js +8 -4
  89. package/npm-shrinkwrap.json +215 -220
  90. package/package.json +5 -6
  91. package/steps/alert-dialog-steps.js +25 -0
  92. package/steps/cluster/cluster-configuration-steps.js +173 -5
  93. package/steps/cluster/cluster-page-steps.js +8 -0
  94. package/steps/cluster/custer-nodes-configuration-steps.js +107 -0
  95. package/steps/guides/guide-steps.js +1 -1
  96. package/steps/home-steps.js +48 -5
  97. package/steps/import/import-steps.js +11 -7
  98. package/steps/license-steps.js +25 -0
  99. package/steps/repositories/attach-repository-steps.js +33 -0
  100. package/steps/repository-steps.js +40 -11
  101. package/steps/setup/autocomplete-steps.js +59 -0
  102. package/steps/setup/namespace-steps.js +211 -0
  103. package/steps/setup/plugins-steps.js +37 -0
  104. package/steps/setup/rdf-rank-steps.js +106 -0
  105. package/steps/setup/settings-steps.js +17 -0
  106. package/steps/ttyg/chat-panel-steps.js +31 -6
  107. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +82 -4
  108. package/steps/ttyg/ttyg-view-steps.js +77 -3
  109. package/steps/visual-graph-steps.js +29 -1
  110. package/steps/yasgui/yasqe-steps.js +3 -0
  111. package/stubs/cluster/cluster-stubs.js +162 -7
  112. package/stubs/cluster/remote-location-stubs.js +46 -0
  113. package/stubs/connector-stubs.js +24 -0
  114. package/stubs/environment-stubs.js +27 -0
  115. package/stubs/jdbc/jdbc-stubs.js +19 -0
  116. package/stubs/license-stubs.js +112 -0
  117. package/stubs/namespace-stubs.js +5 -0
  118. package/stubs/repositories/repositories-stubs.js +11 -8
  119. package/stubs/repositories-stub.js +15 -0
  120. package/stubs/security-stubs.js +29 -0
  121. package/stubs/setup/plugins-stubs.js +5 -0
  122. package/stubs/similarity-index-stubs.js +25 -0
  123. package/stubs/stubs.js +4 -0
  124. package/stubs/ttyg/ttyg-stubs.js +79 -40
  125. package/support/commands.js +2 -0
  126. package/support/index.js +18 -0
  127. package/support/security-command.js +25 -0
  128. package/support/settings-commands.js +4 -5
  129. package/support/user-commands.js +31 -0
  130. package/fixtures/ttyg/chats/get-chat-1.json +0 -43
  131. package/integration/cluster/cluster-management.spec.js +0 -220
  132. package/steps/autocomplete-steps.js +0 -10
  133. package/steps/cluster/add-remote-location-dialog-steps.js +0 -11
  134. package/steps/cluster/create-cluster-dialog-steps.js +0 -39
  135. package/steps/cluster/replace-nodes-dialog-steps.js +0 -39
@@ -2,20 +2,28 @@ import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
2
2
  import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
3
  import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
4
4
  import {TtygAgentSettingsModalSteps} from "../../steps/ttyg/ttyg-agent-settings-modal.steps";
5
- import {NamespaceStubs} from "../../stubs/namespace-stubs";
6
5
  import {SimilarityIndexStubs} from "../../stubs/similarity-index-stubs";
7
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";
8
10
 
9
11
  describe('TTYG create new agent', () => {
10
12
  const repositoryId = 'starwars';
11
13
 
12
14
  beforeEach(() => {
13
15
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
16
+ RepositoriesStub.stubBaseEndpoints(repositoryId);
14
17
  cy.presetRepository(repositoryId);
15
- NamespaceStubs.stubNameSpaceResponse(repositoryId, '/namespaces/get-repository-starwars-namespaces.json');
18
+ TTYGStubs.stubAgentDefaultsGet();
16
19
  });
17
20
 
18
- it('Should be able to cancel the new agent creation on the no agents view', () => {
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
+ }, () => {
19
27
  TTYGStubs.stubChatsListGetNoResults();
20
28
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
21
29
  // Given I have opened the ttyg page
@@ -38,10 +46,11 @@ describe('TTYG create new agent', () => {
38
46
  }
39
47
  }, () => {
40
48
  TTYGStubs.stubChatsListGetNoResults();
41
- TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
49
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json', 1000);
42
50
  // Given I have opened the ttyg page
43
51
  TTYGViewSteps.visit();
44
52
  cy.wait('@get-all-repositories');
53
+ cy.wait('@get-agent-list');
45
54
  // When I click on the create agent button
46
55
  TTYGViewSteps.createFirstAgent();
47
56
  // Then I should see the create agent modal
@@ -57,9 +66,14 @@ describe('TTYG create new agent', () => {
57
66
 
58
67
  // At least one extraction method must be selected
59
68
  // enable SPARQL extraction method and disable it again to check the error message for the extraction methods
60
- TtygAgentSettingsModalSteps.toggleSparqlExtractionMethodPanel();
61
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');
62
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');
63
77
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
64
78
  TtygAgentSettingsModalSteps.getExtractionMethodError().should('be.visible').and('contain', 'At least one query method must be selected');
65
79
  TtygAgentSettingsModalSteps.enableSparqlExtractionMethod();
@@ -71,7 +85,7 @@ describe('TTYG create new agent', () => {
71
85
  // select the ontology graph SPARQL extraction method option
72
86
  TtygAgentSettingsModalSteps.selectSparqlMethodOntologyGraph();
73
87
  // the ontology graph default value should be visible
74
- TtygAgentSettingsModalSteps.getSparqlMethodOntologyGraphField().should('have.value', 'http://example.com/swgraph');
88
+ TtygAgentSettingsModalSteps.getSparqlMethodOntologyGraphField().should('have.value', 'http://example.com');
75
89
  // if the value is removed, the save button should be disabled because these fields are required if the option is selected
76
90
  TtygAgentSettingsModalSteps.clearSparqlMethodOntologyGraphField();
77
91
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
@@ -79,12 +93,15 @@ describe('TTYG create new agent', () => {
79
93
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
80
94
  // select the sparql query SPARQL extraction method option
81
95
  TtygAgentSettingsModalSteps.selectSparqlMethodSparqlQuery();
82
- TtygAgentSettingsModalSteps.getSparqlMethodSparqlQueryField().should('have.value', 'select ?s ?p ?o where {?s ?p ?o .}');
96
+ TtygAgentSettingsModalSteps.getSparqlMethodSparqlQueryField().should('have.value', 'CONSTRUCT {?s ?p ?o} WHERE {GRAPH <http://example.org/ontology> {?s ?p ?o .}}');
83
97
  // if the value is removed, the save button should be disabled because these fields are required if the option is selected
84
98
  TtygAgentSettingsModalSteps.clearSparqlMethodSparqlQueryField();
85
99
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
86
100
  TtygAgentSettingsModalSteps.typeSparqlMethodSparqlQueryField('select ?s ?p ?o where {?s ?p ?o .}');
87
101
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
102
+ // check the add missing namespaces checkbox
103
+ TtygAgentSettingsModalSteps.getAddMissingNamespacesCheckbox().should('not.be.checked');
104
+ TtygAgentSettingsModalSteps.toggleAddMissingNamespacesCheckbox();
88
105
 
89
106
  // Validate the other agent settings
90
107
 
@@ -96,9 +113,8 @@ describe('TTYG create new agent', () => {
96
113
  TtygAgentSettingsModalSteps.typeGptModel('gpt-4o');
97
114
 
98
115
  // temperature
99
- TtygAgentSettingsModalSteps.getTemperatureField().should('have.value', '0.7');
100
116
  TtygAgentSettingsModalSteps.setTemperature('0.2');
101
- TtygAgentSettingsModalSteps.getTemperatureField().should('have.value', '0.2');
117
+ TtygAgentSettingsModalSteps.getTemperatureSliderField().should('have.value', '0.2');
102
118
 
103
119
  // Top P
104
120
  TtygAgentSettingsModalSteps.getTopPField().should('have.value', '1');
@@ -106,11 +122,12 @@ describe('TTYG create new agent', () => {
106
122
  TtygAgentSettingsModalSteps.getTopPField().should('have.value', '0.2');
107
123
 
108
124
  // Seed
109
- TtygAgentSettingsModalSteps.getSeedField().should('have.value', '1');
110
- // The seed field is optional, so the save button should be enabled
111
- TtygAgentSettingsModalSteps.clearSeed();
112
- TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
113
- TtygAgentSettingsModalSteps.typeSeed('2');
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');
114
131
 
115
132
  // Validate the advanced settings
116
133
 
@@ -118,22 +135,56 @@ describe('TTYG create new agent', () => {
118
135
  TtygAgentSettingsModalSteps.getSystemInstructionsField().should('have.value', '');
119
136
 
120
137
  // User instructions
121
- TtygAgentSettingsModalSteps.getUserInstructionsField().should('have.value', '');
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.');
122
139
 
123
140
  // Save the agent
124
- // stub the agent create request
125
- TTYGStubs.stubAgentCreate();
126
- TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
141
+ TTYGStubs.stubAgentCreate(1000);
142
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json', 1000);
127
143
  TtygAgentSettingsModalSteps.saveAgent();
128
- // the modal should be closed and the agent should be created
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
129
170
  TtygAgentSettingsModalSteps.getDialog().should('not.exist');
171
+ cy.wait('@get-agent-list');
130
172
  TTYGViewSteps.getNoAgentsView().should('not.exist');
131
- // the new agent should be visible in the agent list (there were 4 agents before, so now there should be 5)
132
- TTYGViewSteps.getAgents().should('have.length', 5);
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);
133
179
  TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
134
180
  });
135
181
 
136
- it('Should require FTS to be enabled for selected repository when creating agent with FTS extraction method', () => {
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
+ }, () => {
137
188
  RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-disabled-fts.json');
138
189
  TTYGStubs.stubChatsListGetNoResults();
139
190
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
@@ -150,13 +201,19 @@ describe('TTYG create new agent', () => {
150
201
  TtygAgentSettingsModalSteps.getFtsDisabledHelp().should('be.visible');
151
202
  });
152
203
 
153
- it('Should be able to create agent with FTS extraction method', () => {
204
+ it('Should be able to create agent with FTS extraction method', {
205
+ retries: {
206
+ runMode: 1,
207
+ openMode: 0
208
+ }
209
+ }, () => {
154
210
  RepositoriesStubs.stubGetRepositoryConfig(repositoryId, '/repositories/get-repository-config-starwars-enabled-fts.json');
155
211
  TTYGStubs.stubChatsListGetNoResults();
156
212
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
157
213
  // Given I have opened the ttyg page
158
214
  TTYGViewSteps.visit();
159
215
  cy.wait('@get-all-repositories');
216
+ cy.wait('@get-agent-list');
160
217
  // When I click on the create agent button
161
218
  TTYGViewSteps.createFirstAgent();
162
219
  // And I fill in the agent name
@@ -164,7 +221,6 @@ describe('TTYG create new agent', () => {
164
221
  // And I select a repository
165
222
  TtygAgentSettingsModalSteps.selectRepository(repositoryId);
166
223
  // When I open the full text search extraction method panel
167
- TtygAgentSettingsModalSteps.toggleFTSExtractionMethodPanel();
168
224
  // The save button should be disabled because the FTS extraction method is not enabled
169
225
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
170
226
  // And I enable the FTS extraction method
@@ -175,54 +231,62 @@ describe('TTYG create new agent', () => {
175
231
  TTYGStubs.stubAgentCreate();
176
232
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
177
233
  TtygAgentSettingsModalSteps.saveAgent();
178
- // the modal should be closed and the agent should be created
234
+ cy.wait('@create-agent');
235
+ // the modal should be closed
179
236
  TtygAgentSettingsModalSteps.getDialog().should('not.exist');
237
+ cy.wait('@get-agent-list');
238
+ // and the agent should be created
180
239
  TTYGViewSteps.getNoAgentsView().should('not.exist');
181
- // the new agent should be visible in the agent list (there were 4 agents before, so now there should be 5)
182
- TTYGViewSteps.getAgents().should('have.length', 5);
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);
183
242
  TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
184
243
  });
185
244
 
186
- it('Should require similarity index in order to create agent with similarity search method', () => {
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
+ }, () => {
187
251
  TTYGStubs.stubChatsListGetNoResults();
188
252
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
189
253
  SimilarityIndexStubs.stubGetSimilarityIndexes('/similarity/get-similarity-indexes-0.json');
190
254
  // Given I have opened the ttyg page
191
255
  TTYGViewSteps.visit();
192
256
  cy.wait('@get-all-repositories');
257
+ cy.wait('@get-agent-list');
193
258
  // When I click on the create agent button
194
259
  TTYGViewSteps.createFirstAgent();
195
- // When I open the similarity search extraction method panel
196
- TtygAgentSettingsModalSteps.toggleSimilaritySearchMethodPanel();
197
- // Then I should see a help message for similarity index missing
198
- TtygAgentSettingsModalSteps.getSimilaritySearchIndexMissingHelp().should('be.visible');
199
260
  // When I select the similarity search extraction method
200
261
  TtygAgentSettingsModalSteps.enableSimilaritySearchMethodPanel();
201
- // Then the help message should stay
262
+ // Then I should see a help message for similarity index missing
202
263
  TtygAgentSettingsModalSteps.getSimilaritySearchIndexMissingHelp().should('be.visible');
203
264
  // And the agent save button should be disabled because the similarity index method is not configured yet
204
265
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
205
266
  });
206
267
 
207
- it('Should be able to configure and create agent with similarity index search method', () => {
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
+ }, () => {
208
274
  TTYGStubs.stubChatsListGetNoResults();
209
275
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
210
276
  SimilarityIndexStubs.stubGetSimilarityIndexes();
211
277
  // Given I have opened the ttyg page
212
278
  TTYGViewSteps.visit();
213
279
  cy.wait('@get-all-repositories');
280
+ cy.wait('@get-agent-list');
214
281
  // When I click on the create agent button
215
282
  TTYGViewSteps.createFirstAgent();
216
283
  TtygAgentSettingsModalSteps.getDialog().should('be.visible');
217
284
  TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
218
285
  TtygAgentSettingsModalSteps.selectRepository(repositoryId);
219
- // When I open the similarity search extraction method panel
220
- TtygAgentSettingsModalSteps.toggleSimilaritySearchMethodPanel();
221
286
  // And I enable the similarity search extraction method
222
287
  TtygAgentSettingsModalSteps.enableSimilaritySearchMethodPanel();
223
- // And I select a similarity index
224
- TtygAgentSettingsModalSteps.getSimilarityIndexField().should('have.value', '');
225
- TtygAgentSettingsModalSteps.selectSimilarityIndex('similarity-index');
288
+ // Then I expect similarity index to be selected
289
+ TtygAgentSettingsModalSteps.getSimilarityIndexField().should('have.value', '0');
226
290
  // Then agent save button should be enabled
227
291
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
228
292
  // When I set the similarity index threshold
@@ -235,15 +299,23 @@ describe('TTYG create new agent', () => {
235
299
  TTYGStubs.stubAgentCreate();
236
300
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
237
301
  TtygAgentSettingsModalSteps.saveAgent();
238
- // the modal should be closed and the agent should be created
302
+ cy.wait('@create-agent');
303
+ // the modal should be closed
239
304
  TtygAgentSettingsModalSteps.getDialog().should('not.exist');
305
+ cy.wait('@get-agent-list');
306
+ // and the agent should be created
240
307
  TTYGViewSteps.getNoAgentsView().should('not.exist');
241
- // the new agent should be visible in the agent list (there were 4 agents before, so now there should be 5)
242
- TTYGViewSteps.getAgents().should('have.length', 5);
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);
243
310
  TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
244
311
  });
245
312
 
246
- it('Should require retrieval connector in order to create an agent with GPT retrieval connector method', () => {
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
+ }, () => {
247
319
  TTYGStubs.stubChatsListGetNoResults();
248
320
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
249
321
  ConnectorStubs.stubGetConnectors();
@@ -251,13 +323,13 @@ describe('TTYG create new agent', () => {
251
323
  // Given I have opened the ttyg page
252
324
  TTYGViewSteps.visit();
253
325
  cy.wait('@get-all-repositories');
326
+ cy.wait('@get-agent-list');
254
327
  // When I click on the create agent button
255
328
  TTYGViewSteps.createFirstAgent();
256
329
  TtygAgentSettingsModalSteps.getDialog().should('be.visible');
257
330
  TtygAgentSettingsModalSteps.typeAgentName('Test Agent');
258
331
  TtygAgentSettingsModalSteps.selectRepository(repositoryId);
259
332
  // When I select and open the GPT retrieval connector method panel
260
- TtygAgentSettingsModalSteps.toggleRetrievalMethodPanel();
261
333
  TtygAgentSettingsModalSteps.enableRetrievalMethodPanel();
262
334
  // Then I should see the missing connector help message
263
335
  TtygAgentSettingsModalSteps.getMissingRetrievalConnectorHelp().should('be.visible');
@@ -265,7 +337,12 @@ describe('TTYG create new agent', () => {
265
337
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
266
338
  });
267
339
 
268
- it('Should be able to configure and create an agent with retrieval connector method', () => {
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
+ }, () => {
269
346
  TTYGStubs.stubChatsListGetNoResults();
270
347
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-0.json');
271
348
  ConnectorStubs.stubGetConnectors();
@@ -273,6 +350,7 @@ describe('TTYG create new agent', () => {
273
350
  // Given I have opened the ttyg page
274
351
  TTYGViewSteps.visit();
275
352
  cy.wait('@get-all-repositories');
353
+ cy.wait('@get-agent-list');
276
354
  // When I click on the create agent button
277
355
  TTYGViewSteps.createFirstAgent();
278
356
  TtygAgentSettingsModalSteps.getDialog().should('be.visible');
@@ -280,9 +358,8 @@ describe('TTYG create new agent', () => {
280
358
  TtygAgentSettingsModalSteps.selectRepository(repositoryId);
281
359
  // When I select and open the GPT retrieval connector method panel
282
360
  TtygAgentSettingsModalSteps.enableRetrievalMethodPanel();
283
- // And I select a retrieval connector
284
- TtygAgentSettingsModalSteps.getRetrievalConnectorField().should('have.value', '');
285
- TtygAgentSettingsModalSteps.selectRetrievalConnector('gpt-connector');
361
+ // Then I expect retrieval connector to be selected
362
+ TtygAgentSettingsModalSteps.getRetrievalConnectorField().should('have.value', '0');
286
363
  // Then the save button should be enabled
287
364
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
288
365
  // When I remove the query template
@@ -301,16 +378,191 @@ describe('TTYG create new agent', () => {
301
378
  TTYGStubs.stubAgentCreate();
302
379
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-new-agent.json');
303
380
  TtygAgentSettingsModalSteps.saveAgent();
304
- // the modal should be closed and the agent should be created
381
+ cy.wait('@create-agent');
382
+ // the modal should be closed
305
383
  TtygAgentSettingsModalSteps.getDialog().should('not.exist');
384
+ cy.wait('@get-agent-list');
385
+ // and the agent should be created
306
386
  TTYGViewSteps.getNoAgentsView().should('not.exist');
307
- // the new agent should be visible in the agent list (there were 4 agents before, so now there should be 5)
308
- TTYGViewSteps.getAgents().should('have.length', 5);
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);
309
389
  TTYGViewSteps.getAgent(0).should('contain', 'Test Agent').and('contain', 'starwars');
310
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 FTS, similarity search or 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
+ SimilarityIndexStubs.stubGetSimilarityIndexes('/similarity/get-similarity-indexes-0.json');
525
+ TTYGViewSteps.visit();
526
+ cy.wait('@get-all-repositories');
527
+ TTYGViewSteps.createFirstAgent();
528
+ TtygAgentSettingsModalSteps.enableSparqlExtractionMethod();
529
+ TtygAgentSettingsModalSteps.selectSparqlMethodOntologyGraph();
530
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
531
+
532
+ // When enable FTS extraction method and selected repository has not fts search enabled.
533
+ TtygAgentSettingsModalSteps.enableFtsExtractionMethod();
534
+ // Then I expect the create button be disabled.
535
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
536
+
537
+ // When I disable FTS extraction method
538
+ TtygAgentSettingsModalSteps.disableFtsExtractionMethod();
539
+ // Then I expect the save button be enabled because is deselected
540
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
541
+
542
+ // When enable the similarity index method
543
+ TtygAgentSettingsModalSteps.enableSimilaritySearchMethodPanel();
544
+ // Then I expect the save button be disabled because there aren't indexes in the selected repo.
545
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
546
+
547
+ // When I disable the similarity index method
548
+ TtygAgentSettingsModalSteps.disableSimilaritySearchMethodPanel();
549
+ // Then I expect the save button be enabled because the method is disabled.
550
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
551
+
552
+ // When enable the ChatGPT Retrieval connector method
553
+ TtygAgentSettingsModalSteps.enableRetrievalMethodPanel();
554
+ // Then I expect the save button be disabled because there aren't retrieval connectors in the selected repo.
555
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
556
+
557
+ // When I disable the ChatGPT Retrieval connector method
558
+ TtygAgentSettingsModalSteps.disableRetrievalMethodPanel();
559
+ // Then I expect the save button be enabled because the method is disabled.
560
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.enabled');
561
+ });
311
562
  });
312
563
 
313
564
  function fillAgentName(name) {
565
+ TtygAgentSettingsModalSteps.clearAgentName();
314
566
  TtygAgentSettingsModalSteps.typeAgentName(name);
315
567
  // the save button should be disabled because there are other required fields that are not filled in yet
316
568
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
@@ -0,0 +1,68 @@
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
+ // Then I expect newly created chat be selected.
65
+ TTYGViewSteps.getChatFromGroup(0, 0).should('contain', 'New chat of Han Solo is a character');
66
+ TTYGViewSteps.getChatFromGroup(0, 0).should('have.class', 'selected');
67
+ });
68
+ });