graphdb-workbench-tests 2.7.6 → 2.8.0-RC2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/cypress.config.js +3 -0
  2. package/fixtures/cluster/2-nodes-cluster-group-status-deleted.json +30 -0
  3. package/fixtures/cluster/2-nodes-cluster-group-status.json +30 -0
  4. package/fixtures/cluster/3-nodes-cluster-group-status-after-replace.json +44 -0
  5. package/fixtures/cluster/3-nodes-cluster-group-status-building-snapshot.json +4 -1
  6. package/fixtures/cluster/3-nodes-cluster-group-status-receiving-snapshot.json +4 -1
  7. package/fixtures/cluster/3-nodes-cluster-group-status-sending-snapshot.json +4 -1
  8. package/fixtures/cluster/3-nodes-cluster-group-status-waiting-for-snapshot.json +4 -1
  9. package/fixtures/cluster/3-nodes-cluster-group-status.json +12 -3
  10. package/fixtures/cluster/4-nodes-cluster-group-status.json +58 -0
  11. package/fixtures/cluster/cluster-config.json +1 -0
  12. package/fixtures/cluster/cluster-node-status.json +4 -1
  13. package/fixtures/connectors/get-connectors.json +8 -0
  14. package/fixtures/connectors/get-retrieval-connector-0.json +1 -0
  15. package/fixtures/connectors/get-retrieval-connector.json +29 -0
  16. package/fixtures/connectors/get-ttyg-chatgpt-connectors.json +188 -0
  17. package/fixtures/locale-en.json +630 -61
  18. package/fixtures/namespaces/get-repository-starwars-namespaces.json +252 -0
  19. package/fixtures/remote-location/get-0-remote-locations.json +1 -2
  20. package/fixtures/remote-location/get-1-remote-locations.json +2 -4
  21. package/fixtures/remote-location/get-2-remote-locations.json +3 -6
  22. package/fixtures/remote-location/get-3-remote-locations.json +4 -8
  23. package/fixtures/remote-location/get-4-remote-locations.json +54 -0
  24. package/fixtures/remote-location/remote-location-status-in-cluster.json +1 -2
  25. package/fixtures/remote-location/remote-location-status-not-in-cluster.json +1 -2
  26. package/fixtures/remote-location/remote-locations-filter.json +1 -2
  27. package/fixtures/repositories/get-locations.json +67 -0
  28. package/fixtures/repositories/get-repositories.json +106 -0
  29. package/fixtures/repositories/get-repository-config-starwars-disabled-fts.json +201 -0
  30. package/fixtures/repositories/get-repository-config-starwars-enabled-fts.json +201 -0
  31. package/fixtures/repositories/get-ttyg-repositories.json +74 -0
  32. package/fixtures/similarity/get-similarity-indexes-0.json +1 -0
  33. package/fixtures/similarity/get-similarity-indexes.json +15 -0
  34. package/fixtures/similarity/get-ttyg-similarity-connectors.json +46 -0
  35. package/fixtures/ttyg/agent/create-agent.json +20 -0
  36. package/fixtures/ttyg/agent/get-agent-defaults.json +42 -0
  37. package/fixtures/ttyg/agent/get-agent-list-0.json +1 -0
  38. package/fixtures/ttyg/agent/get-agent-list-after-deleted.json +56 -0
  39. package/fixtures/ttyg/agent/get-agent-list-new-agent.json +22 -0
  40. package/fixtures/ttyg/agent/get-agent-list.json +77 -0
  41. package/fixtures/ttyg/agent/get-agent.json +25 -0
  42. package/fixtures/ttyg/chats/ask-question.json +25 -0
  43. package/fixtures/ttyg/chats/create/create-chat-response.json +16 -0
  44. package/fixtures/ttyg/chats/create/get-chats-after-create.json +12 -0
  45. package/fixtures/ttyg/chats/create/get-chats-before-create.json +7 -0
  46. package/fixtures/ttyg/chats/deleted-chat.json +3 -0
  47. package/fixtures/ttyg/chats/explain-response-1.json +59 -0
  48. package/fixtures/ttyg/chats/explain-response-2.json +59 -0
  49. package/fixtures/ttyg/chats/export-chat.json +34 -0
  50. package/fixtures/ttyg/chats/get-chat-list-0.json +1 -0
  51. package/fixtures/ttyg/chats/get-chat-list-with-deleted-chat.json +17 -0
  52. package/fixtures/ttyg/chats/get-chat-list-with-renamed-chat.json +22 -0
  53. package/fixtures/ttyg/chats/get-chat-list.json +22 -0
  54. package/fixtures/ttyg/chats/get-chat.json +199 -0
  55. package/fixtures/ttyg/chats/renamed-chat.json +4 -0
  56. package/integration/cluster/cluster-management.spec.js +0 -170
  57. package/integration/cluster/edit-cluster-nodes-modal.spec.js +425 -0
  58. package/integration/explore/graphs.overview.spec.js +4 -0
  59. package/integration/home/cookie-policy.spec.js +65 -0
  60. package/integration/home/create-repository.spec.js +35 -0
  61. package/integration/home/documentation-link.spec.js +60 -0
  62. package/integration/home/google-analytics.spec.js +60 -0
  63. package/integration/home/language-selector.spec.js +19 -0
  64. package/integration/home/rdf-resource-search.spec.js +192 -0
  65. package/integration/home/view-resource-autocomplete.spec.js +52 -0
  66. package/integration/home/workbench.home.spec.js +1 -277
  67. package/integration/import/import-user-data-file-upload.spec.js +13 -0
  68. package/integration/import/import-user-data.spec.js +8 -2
  69. package/integration/import/import-view.spec.js +6 -1
  70. package/integration/repository/attach-remote-location.spec.js +203 -0
  71. package/integration/repository/ontop-repository.spec.js +87 -1
  72. package/integration/repository/repositories.spec.js +4 -19
  73. package/integration/setup/my-settings.spec.js +2 -0
  74. package/integration/ttyg/agent-list.spec.js +76 -0
  75. package/integration/ttyg/agent-select-menu.spec.js +141 -0
  76. package/integration/ttyg/chat-list.spec.js +286 -0
  77. package/integration/ttyg/chat-panel.spec.js +175 -0
  78. package/integration/ttyg/clone-agent.spec.js +75 -0
  79. package/integration/ttyg/create-agent.spec.js +560 -0
  80. package/integration/ttyg/create-chat.spec.js +69 -0
  81. package/integration/ttyg/delete-agent.spec.js +51 -0
  82. package/integration/ttyg/edit-agent.spec.js +54 -0
  83. package/integration/ttyg/ttyg-permission.spec.js +66 -0
  84. package/integration/ttyg/ttyg-view.spec.js +75 -0
  85. package/npm-shrinkwrap.json +215 -220
  86. package/package.json +5 -6
  87. package/steps/alert-dialog-steps.js +25 -0
  88. package/steps/cluster/cluster-page-steps.js +8 -0
  89. package/steps/cluster/custer-nodes-configuration-steps.js +107 -0
  90. package/steps/home-steps.js +48 -5
  91. package/steps/import/import-steps.js +11 -11
  92. package/steps/modal-dialog-steps.js +8 -0
  93. package/steps/ontop-repository-steps.js +26 -0
  94. package/steps/repositories/attach-repository-steps.js +118 -0
  95. package/steps/repository-steps.js +53 -5
  96. package/steps/setup/settings-steps.js +17 -0
  97. package/steps/ttyg/chat-panel-steps.js +62 -0
  98. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +462 -0
  99. package/steps/ttyg/ttyg-view-steps.js +333 -0
  100. package/steps/window-steps.js +5 -0
  101. package/stubs/cluster/cluster-stubs.js +127 -7
  102. package/stubs/cluster/remote-location-stubs.js +46 -0
  103. package/stubs/connector-stubs.js +39 -0
  104. package/stubs/environment-stubs.js +27 -0
  105. package/stubs/license-stubs.js +101 -0
  106. package/stubs/repositories/repositories-stubs.js +133 -0
  107. package/stubs/repositories-stub.js +15 -0
  108. package/stubs/security-stubs.js +7 -0
  109. package/stubs/similarity-index-stubs.js +32 -0
  110. package/stubs/stubs.js +4 -0
  111. package/stubs/ttyg/ttyg-stubs.js +166 -0
  112. package/support/commands.js +2 -0
  113. package/support/index.js +17 -0
  114. package/support/security-command.js +25 -0
  115. package/support/settings-commands.js +4 -5
  116. package/support/user-commands.js +31 -0
  117. package/steps/cluster/add-remote-location-dialog-steps.js +0 -11
  118. package/steps/cluster/create-cluster-dialog-steps.js +0 -39
  119. package/steps/cluster/replace-nodes-dialog-steps.js +0 -39
@@ -1,6 +1,8 @@
1
1
  import {RepositorySteps} from "../../steps/repository-steps";
2
2
  import {OntopRepositorySteps} from "../../steps/ontop-repository-steps";
3
3
  import {ToasterSteps} from "../../steps/toaster-steps";
4
+ import {RepositoriesStubs as RepositoryStubs} from "../../stubs/repositories/repositories-stubs";
5
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
4
6
 
5
7
  describe('Ontop repositories', () => {
6
8
  let repositoryId;
@@ -137,6 +139,91 @@ describe('Ontop repositories', () => {
137
139
  OntopRepositorySteps.getTestConnectionButton().should('not.be.disabled');
138
140
  });
139
141
 
142
+ it('should create ontop repository', () => {
143
+ RepositoryStubs.stubRepoCreationEndpoints(repositoryId);
144
+ // When I visit the create ontop page
145
+ OntopRepositorySteps.visitCreate();
146
+ // The test connection button should be disabled
147
+ OntopRepositorySteps.getTestConnectionButton().should('be.disabled');
148
+ // Then I fill the repository ID
149
+ RepositorySteps.typeRepositoryId(repositoryId);
150
+ // And I fill the driver class
151
+ OntopRepositorySteps.typeDriverClass('org.test.some.DriverClass');
152
+ // And I fill the URL
153
+ RepositorySteps.typeURL('url:to://database');
154
+ // The test connection button should be enabled
155
+ OntopRepositorySteps.getTestConnectionButton().should('not.be.disabled');
156
+ // When I select MySql database driver
157
+ OntopRepositorySteps.selectMySqlDatabase();
158
+ // Then I expect the driver class to be changed
159
+ OntopRepositorySteps.getDriverClassInput().should('have.value', 'com.mysql.cj.jdbc.Driver');
160
+ // The test connection button should be disabled
161
+ OntopRepositorySteps.getTestConnectionButton().should('be.disabled');
162
+
163
+ const hostName = 'localhost';
164
+ // When I fill the host name
165
+ OntopRepositorySteps.typeHostName(hostName);
166
+ // Then I expect url to be filed with the host name
167
+ OntopRepositorySteps.getUrlInput().should('have.value', 'jdbc:mysql://localhost/{database}');
168
+ // When I change the database driver for which the port field is required
169
+ OntopRepositorySteps.selectOracleDatabase();
170
+ // When I fill the host name
171
+ OntopRepositorySteps.typeHostName(hostName);
172
+ // When I fill the port field
173
+ OntopRepositorySteps.typePort(5423);
174
+ // Then I expect the URL to be filed with the host name and port
175
+ OntopRepositorySteps.getUrlInput().should('have.value', 'jdbc:oracle:thin:@localhost:5423:{database}');
176
+ // When I fill the database name field
177
+ OntopRepositorySteps.typeDatabaseName('database-name');
178
+ // Then I expect the URL to be filed with the host name and port
179
+ OntopRepositorySteps.getUrlInput().should('have.value', 'jdbc:oracle:thin:@localhost:5423:database-name');
180
+ // And the test connection button to be enabled
181
+ OntopRepositorySteps.getTestConnectionButton().should('not.be.disabled');
182
+ // And I add an OBDA file
183
+ OntopRepositorySteps.clickObdaFileUploadButton();
184
+ OntopRepositorySteps.uploadObdaFile('fixtures/ontop/university-complete.obda');
185
+ // When I click on create repository button
186
+ OntopRepositorySteps.clickOnCreateRepositoryButton();
187
+ // The Ontop repository should be created
188
+ RepositorySteps.visit();
189
+ // The repository list should contain the new repository, which can be activated
190
+ RepositorySteps.clickRepositoryConnectionOffBtn(repositoryId);
191
+ // When the repository is restarted
192
+ RepositorySteps.restartRepository(repositoryId);
193
+ RepositorySteps.confirmModal();
194
+ // Then the correct messages are shown
195
+ ToasterSteps.verifySuccess('Restarting repository ' + repositoryId);
196
+ ToasterSteps.getToast().should('not.exist');
197
+ RepositorySteps.assertRepositoryStatus(repositoryId, "ACTIVE");
198
+ // And the repo icon remains Ontop
199
+ RepositorySteps.getRepoIcon('ontop').should('be.visible');
200
+ });
201
+
202
+ it('should edit ontop repository', () => {
203
+ RepositoryStubs.stubEditOntopResponse(repositoryId);
204
+ RepositoryStubs.stubSaveOntopResponse(repositoryId);
205
+ RepositoryStubs.stubRepoCreationEndpoints(repositoryId);
206
+ // When I open the repositories view
207
+ RepositorySteps.visit();
208
+ // Then I should see an Ontop repository
209
+ RepositorySteps.getRepositoriesList().should('have.length', 1);
210
+ RepositorySteps.getRepoIcon('ontop').should('be.visible');
211
+ // And I edit the Ontop repository
212
+ RepositorySteps.editRepository(repositoryId);
213
+ // Then I expect the repository to be opened for editing
214
+ RepositorySteps.getRepositoryCreateForm();
215
+ RepositorySteps.getRepositoryIdField().should('have.value', repositoryId);
216
+ // When I add a username
217
+ RepositorySteps.typeUsernameInEditRepo('Example');
218
+ // When I fill the host name
219
+ RepositorySteps.typeURL('jdbc:oracle:thin:@localhost:5423:database-name');
220
+ // And save the changes
221
+ RepositorySteps.clickSaveEditedRepo();
222
+ ModalDialogSteps.clickOnConfirmButton();
223
+ // The icon should still be Ontop
224
+ RepositorySteps.getRepoIcon('ontop').should('be.visible');
225
+ });
226
+
140
227
  it('should populate url when Snowflake driver is selected', () => {
141
228
  // When I open create ontop repository page,
142
229
  OntopRepositorySteps.visitCreate();
@@ -152,6 +239,5 @@ describe('Ontop repositories', () => {
152
239
 
153
240
  // Then I expect url to be calculated properly
154
241
  OntopRepositorySteps.getUrlInput().should('have.value', 'jdbc:snowflake://someHostName.snowflakecomputing.com:1234/?warehouse=test_database');
155
-
156
242
  });
157
243
  });
@@ -399,7 +399,7 @@ describe('Repositories', () => {
399
399
  });
400
400
 
401
401
  //Make sure that repository is in status INACTIVE
402
- assertRepositoryStatus(repositoryId, "INACTIVE");
402
+ RepositorySteps.assertRepositoryStatus(repositoryId, "INACTIVE");
403
403
 
404
404
  RepositorySteps.getRepositoriesDropdown().click().within(() => {
405
405
 
@@ -420,13 +420,7 @@ describe('Repositories', () => {
420
420
  HomeSteps.visitAndWaitLoader();
421
421
  cy.visit('/repository');
422
422
 
423
- // Verify that the repositories are loaded
424
- // and only afterwards continue with the check
425
- cy.get('#wb-repositories-repositoryInGetRepositories .repository')
426
- .should('have.length.greaterThan', 0)
427
- .then(() => {
428
- assertRepositoryStatus(repositoryId, "RUNNING");
429
- });
423
+ RepositorySteps.assertRepositoryStatus(repositoryId, "RUNNING");
430
424
 
431
425
  //Restart the repository
432
426
  RepositorySteps.restartRepository(repositoryId);
@@ -434,11 +428,11 @@ describe('Repositories', () => {
434
428
  //Check toast for RESTARTING status and repo row for RUNNING status
435
429
  ToasterSteps.verifySuccess('Restarting repository ' + repositoryId);
436
430
 
437
- assertRepositoryStatus(repositoryId, "RESTARTING");
431
+ RepositorySteps.assertRepositoryStatus(repositoryId, "RESTARTING");
438
432
 
439
433
  ToasterSteps.getToast().should('not.exist');
440
434
 
441
- assertRepositoryStatus(repositoryId, "RUNNING");
435
+ RepositorySteps.assertRepositoryStatus(repositoryId, "RUNNING");
442
436
  });
443
437
 
444
438
  it('should create SHACL repo and test shapes validation', () => {
@@ -509,15 +503,6 @@ describe('Repositories', () => {
509
503
  ModalDialogSteps.verifyDialogBody('Changing the repository ID is a dangerous operation since it renames the repository folder and enforces repository shutdown.');
510
504
  });
511
505
 
512
- function assertRepositoryStatus(repositoryId, status) {
513
- cy.waitUntil(() =>
514
- RepositorySteps.getRepositoryFromList(repositoryId)
515
- .should('be.visible')
516
- .find('.repository-status .text-secondary')
517
- .then(($el) => $el)
518
- .then(($el) => $el && $el.text() === status));
519
- }
520
-
521
506
  function interceptRulesetFileUpload() {
522
507
  cy.intercept(
523
508
  {
@@ -1,6 +1,8 @@
1
1
  import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
2
2
  import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
3
3
 
4
+ Cypress.env('set_default_user_data', false);
5
+
4
6
  describe('My Settings', () => {
5
7
 
6
8
  let repositoryId;
@@ -0,0 +1,76 @@
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 {RepositoriesStub} from "../../stubs/repositories-stub";
5
+
6
+ describe('TTYG agent list', () => {
7
+ beforeEach(() => {
8
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
9
+ RepositoriesStub.stubBaseEndpoints('starwars');
10
+ cy.presetRepository('starwars');
11
+ });
12
+
13
+ it('Should be able to toggle agents panel', () => {
14
+ TTYGStubs.stubAgentListGet();
15
+ TTYGStubs.stubChatsListGet();
16
+ TTYGStubs.stubChatGet();
17
+ // Given I have opened the ttyg page
18
+ TTYGViewSteps.visit();
19
+ cy.wait('@get-agent-list');
20
+ cy.wait('@get-chat-list');
21
+ cy.wait('@get-chat');
22
+ cy.wait('@get-all-repositories');
23
+ // When the ttyg page is loaded
24
+ // Then I expect tha agent list be closed by default.
25
+ TTYGViewSteps.getAgentsPanel().should('not.be.visible');
26
+
27
+ // When I click on "Manage agents"
28
+ TTYGViewSteps.expandAgentsSidebar();
29
+ // Then I should see the agent list with agents filtered by the current repository
30
+ TTYGViewSteps.getAgentsPanel().should('be.visible');
31
+ TTYGViewSteps.verifyAgentList([
32
+ {name: 'agent-1', repositoryId: 'starwars', isRepositoryDeleted: false},
33
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars', isRepositoryDeleted: false}
34
+ ]);
35
+
36
+ // When I close the agent list panel
37
+ TTYGViewSteps.collapseAgentsSidebar();
38
+ // Then I expect agent list panel to be closed
39
+ TTYGViewSteps.getAgentsPanel().should('be.hidden');
40
+ });
41
+
42
+ it('Should be able to filter the agent list by repository', () => {
43
+ TTYGStubs.stubAgentListGet();
44
+ TTYGStubs.stubChatGet();
45
+ TTYGStubs.stubChatsListGet();
46
+ // Given I have opened the ttyg page
47
+ TTYGViewSteps.visit();
48
+ cy.wait('@get-chat');
49
+ cy.wait('@get-agent-list');
50
+ cy.wait('@get-chat-list');
51
+ cy.wait('@get-all-repositories');
52
+ // When the ttyg page is loaded
53
+ TTYGViewSteps.getAgents().should('have.length', 2);
54
+ // Then Agent list filter should be set to All
55
+ TTYGViewSteps.getSelectedAgentFilter().should('contain', 'starwars');
56
+ TTYGViewSteps.getAgentFilter().click();
57
+ TTYGViewSteps.verifyRepositoryOptionNotExist('Fedx_repository');
58
+ TTYGViewSteps.verifyRepositoryOptionNotExist('Ontop_repository');
59
+ TTYGViewSteps.getAgentFilter().click();
60
+ // When I filter the agents by repository 'biomarkers'
61
+ TTYGViewSteps.filterAgentsByRepository('biomarkers');
62
+ // Then I should see only 1 agent
63
+ TTYGViewSteps.verifyAgentList([
64
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers', isRepositoryDeleted: false}
65
+ ]);
66
+ // When I select the 'All' filter
67
+ TTYGViewSteps.filterAgentsByRepository('All');
68
+ // Then I should see all agents
69
+ TTYGViewSteps.verifyAgentList([
70
+ {name: 'agent-1', repositoryId: 'starwars', isRepositoryDeleted: false},
71
+ {name: 'agent-2', repositoryId: 'Not existing repo', isRepositoryDeleted: true},
72
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars', isRepositoryDeleted: false},
73
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers', isRepositoryDeleted: false}
74
+ ]);
75
+ });
76
+ });
@@ -0,0 +1,141 @@
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 {ModalDialogSteps} from "../../steps/modal-dialog-steps";
5
+ import {RepositoriesStub} from "../../stubs/repositories-stub";
6
+
7
+ describe('TTYG agent select menu', () => {
8
+
9
+ const repositoryId = 'starwars';
10
+
11
+ beforeEach(() => {
12
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
13
+ RepositoriesStub.stubBaseEndpoints(repositoryId);
14
+ cy.presetRepository(repositoryId);
15
+ TTYGStubs.stubChatsListGetNoResults();
16
+ });
17
+
18
+ it('Should list all agents in the menu', () => {
19
+ TTYGStubs.stubAgentListGet();
20
+ // Given I have opened the ttyg page
21
+ TTYGViewSteps.visit();
22
+ // When The page is loaded
23
+ // Then I should see all the agents in the menu
24
+ TTYGViewSteps.verifySelectAgentMenuItems([
25
+ {name: 'agent-1', repositoryId: 'starwars', isRepositoryDeleted: false},
26
+ {name: 'agent-2', repositoryId: 'Not existing repo', isRepositoryDeleted: true},
27
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars', isRepositoryDeleted: false},
28
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers', isRepositoryDeleted: false}
29
+ ]);
30
+ });
31
+
32
+ it('Should be able to select agent from the menu', () => {
33
+ TTYGStubs.stubAgentListGet();
34
+ // Given I have opened the ttyg page
35
+ TTYGViewSteps.visit();
36
+ // When The page is loaded
37
+ // Then I should see no selected agent if no agent was used before (should be stored in the local storage)
38
+ TTYGViewSteps.getAgentsMenuToggleButton().should('contain', 'Select an agent');
39
+ // When I select an agent from the menu
40
+ TTYGViewSteps.openAgentsMenu();
41
+ TTYGViewSteps.selectAgent(2);
42
+ // The selected agent should be rendered in the menu
43
+ TTYGViewSteps.getAgentsMenuToggleButton().should('contain', 'Databricks-general-unbiased')
44
+ .and('contain', 'starwars');
45
+ // And the selected agent should be highlighted in the agents list sidebar
46
+ TTYGViewSteps.getAgent(1).should('have.class', 'selected');
47
+ // When I select another agent from the menu
48
+ TTYGViewSteps.openAgentsMenu();
49
+ TTYGViewSteps.selectAgent(0);
50
+ // The selected agent should be rendered in the menu
51
+ TTYGViewSteps.getAgentsMenuToggleButton().should('contain', 'agent-1')
52
+ .and('contain', 'starwars');
53
+ TTYGViewSteps.getAgent(0).should('have.class', 'selected');
54
+ TTYGViewSteps.getAgent(1).should('not.have.class', 'selected');
55
+ });
56
+
57
+ it('Should update the agent select menu when an agent is deleted from the sidebar', () => {
58
+ TTYGStubs.stubChatsListGetNoResults();
59
+ TTYGStubs.stubAgentListGet();
60
+ // Given I have opened the ttyg page
61
+ TTYGViewSteps.visit();
62
+ cy.wait('@get-agent-list');
63
+ // When I delete an agent from the sidebar
64
+ TTYGViewSteps.expandAgentsSidebar();
65
+ TTYGStubs.stubAgentDelete();
66
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-after-deleted.json');
67
+ TTYGViewSteps.selectAllAgentsFilter();
68
+ TTYGViewSteps.triggerDeleteAgentActionMenu(0);
69
+ ModalDialogSteps.confirm();
70
+ ModalDialogSteps.getDialog().should('not.exist');
71
+ // TODO: the agents list filter brakes after deleting an agent!!!
72
+ TTYGViewSteps.selectAllAgentsFilter();
73
+ TTYGViewSteps.getAgents().should('have.length', 3);
74
+ TTYGViewSteps.verifySelectAgentMenuItems([
75
+ {name: 'agent-2', repositoryId: 'Not existing repo', isRepositoryDeleted: true},
76
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars', isRepositoryDeleted: false},
77
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers', isRepositoryDeleted: false}
78
+ ]);
79
+ });
80
+
81
+ it('Should mark selected agent as deleted when the agent is deleted from the sidebar', () => {
82
+ TTYGStubs.stubChatsListGetNoResults();
83
+ TTYGStubs.stubAgentListGet();
84
+ // Given I have opened the ttyg page
85
+ TTYGViewSteps.visit();
86
+ cy.wait('@get-agent-list');
87
+ // And I have selected an agent from the menu
88
+ TTYGViewSteps.openAgentsMenu();
89
+ TTYGViewSteps.selectAgent(0);
90
+ TTYGViewSteps.getAgentsMenuToggleButton().should('contain', 'agent-1');
91
+ // When I delete an agent from the sidebar
92
+ TTYGStubs.stubAgentDelete();
93
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-after-deleted.json');
94
+ TTYGViewSteps.filterAgentsByRepository('All');
95
+ TTYGViewSteps.triggerDeleteAgentActionMenu(1);
96
+ ModalDialogSteps.confirm();
97
+ ModalDialogSteps.getDialog().should('not.exist');
98
+ // TODO: the agents list filter brakes after deleting an agent!!!
99
+ TTYGViewSteps.verifySelectAgentMenuItems([
100
+ {name: 'agent-2', repositoryId: 'Not existing repo', isRepositoryDeleted: true},
101
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars', isRepositoryDeleted: false},
102
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers', isRepositoryDeleted: false}
103
+ ]);
104
+ });
105
+
106
+ it('Should ask user to configure the agent when it has missing repository', () => {
107
+ TTYGStubs.stubChatsListGetNoResults();
108
+ TTYGStubs.stubAgentListGet();
109
+ // Given I have opened the ttyg page
110
+ TTYGViewSteps.visit();
111
+ cy.wait('@get-agent-list');
112
+ // When I select an agent which has no repository id from the menu
113
+ TTYGViewSteps.openAgentsMenu();
114
+ TTYGViewSteps.selectAgent(1);
115
+ // Then I expect a confirmation dialog to be opened for the user to configure the agent
116
+ ModalDialogSteps.getDialog().should('be.visible');
117
+ // When I cancel the configuration
118
+ ModalDialogSteps.cancel();
119
+ // Then the agent should be selected in the menu immediately
120
+ TTYGViewSteps.getAgentsMenuToggleButton().should('contain', 'agent-2');
121
+ // When I select the agent again
122
+ TTYGViewSteps.openAgentsMenu();
123
+ TTYGViewSteps.selectAgent(0);
124
+ TTYGViewSteps.openAgentsMenu();
125
+ TTYGViewSteps.selectAgent(1);
126
+ ModalDialogSteps.getDialog().should('be.visible');
127
+ // And I confirm that I want to configure the agent
128
+ ModalDialogSteps.confirm();
129
+ // TODO: Next steps should be implemented when agent edit action is implemented
130
+ // TODO: Then I expect that the confirmation dialog is closed
131
+ // TODO: And I expect that the agent edit dialog is opened
132
+ // TODO: When I configure the agent repository and save it
133
+ // TODO: Then I expect that the agent is selected in the menu
134
+ // TODO: And the sgent should have the repository id in the menu
135
+ });
136
+
137
+ it.skip('Should load the agent which was last used', () => {
138
+
139
+ });
140
+ });
141
+