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
@@ -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
 
@@ -425,7 +425,7 @@ describe('Repositories', () => {
425
425
  cy.get('#wb-repositories-repositoryInGetRepositories .repository')
426
426
  .should('have.length.greaterThan', 0)
427
427
  .then(() => {
428
- assertRepositoryStatus(repositoryId, "RUNNING");
428
+ RepositorySteps.assertRepositoryStatus(repositoryId, "RUNNING");
429
429
  });
430
430
 
431
431
  //Restart the repository
@@ -434,11 +434,11 @@ describe('Repositories', () => {
434
434
  //Check toast for RESTARTING status and repo row for RUNNING status
435
435
  ToasterSteps.verifySuccess('Restarting repository ' + repositoryId);
436
436
 
437
- assertRepositoryStatus(repositoryId, "RESTARTING");
437
+ RepositorySteps.assertRepositoryStatus(repositoryId, "RESTARTING");
438
438
 
439
439
  ToasterSteps.getToast().should('not.exist');
440
440
 
441
- assertRepositoryStatus(repositoryId, "RUNNING");
441
+ RepositorySteps.assertRepositoryStatus(repositoryId, "RUNNING");
442
442
  });
443
443
 
444
444
  it('should create SHACL repo and test shapes validation', () => {
@@ -509,15 +509,6 @@ describe('Repositories', () => {
509
509
  ModalDialogSteps.verifyDialogBody('Changing the repository ID is a dangerous operation since it renames the repository folder and enforces repository shutdown.');
510
510
  });
511
511
 
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
512
  function interceptRulesetFileUpload() {
522
513
  cy.intercept(
523
514
  {
@@ -0,0 +1,69 @@
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
+
5
+ describe('TTYG agent list', () => {
6
+ beforeEach(() => {
7
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
8
+ cy.presetRepository('starwars');
9
+ });
10
+
11
+ it('Should render the agent list', () => {
12
+ TTYGStubs.stubAgentListGet();
13
+ TTYGStubs.stubChatsListGet();
14
+ // Given I have opened the ttyg page
15
+ TTYGViewSteps.visit();
16
+ // When the ttyg page is loaded
17
+ // Then I should see the agent list with agents filtered by the current repository
18
+ TTYGViewSteps.getAgentsPanel().should('be.visible');
19
+ TTYGViewSteps.verifyAgentList([
20
+ {name: 'agent-1', repositoryId: 'starwars'},
21
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars'}
22
+ ]);
23
+ });
24
+
25
+ it('Should be able to toggle agents panel', () => {
26
+ TTYGStubs.stubChatsListGet();
27
+ TTYGStubs.stubAgentListGet();
28
+ // Given I have opened the ttyg page
29
+ TTYGViewSteps.visit();
30
+ // When the ttyg page is loaded
31
+ // Then I should see the agent list
32
+ TTYGViewSteps.getAgents().should('have.length', 2);
33
+ // When I close the agent list panel
34
+ TTYGViewSteps.collapseAgentsSidebar();
35
+ // Then I expect agent list panel to be closed
36
+ TTYGViewSteps.getAgentsPanel().should('be.hidden');
37
+ // When I open the agent list panel
38
+ TTYGViewSteps.expandAgentsSidebar();
39
+ // Then I should see no agents
40
+ TTYGViewSteps.getAgentsPanel().should('be.visible');
41
+ TTYGViewSteps.getAgents().should('have.length', 2);
42
+ });
43
+
44
+ it('Should be able to filter the agent list by repository', () => {
45
+ TTYGStubs.stubAgentListGet();
46
+ TTYGStubs.stubChatsListGet();
47
+ // Given I have opened the ttyg page
48
+ TTYGViewSteps.visit();
49
+ // When the ttyg page is loaded
50
+ TTYGViewSteps.getAgents().should('have.length', 2);
51
+ // Then Agent list filter should be set to All
52
+ TTYGViewSteps.getSelectedAgentFilter().should('contain', 'starwars');
53
+ // When I filter the agents by repository 'biomarkers'
54
+ TTYGViewSteps.filterAgentsByRepository('biomarkers');
55
+ // Then I should see only 1 agent
56
+ TTYGViewSteps.verifyAgentList([
57
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers'}
58
+ ]);
59
+ // When I select the 'All' filter
60
+ TTYGViewSteps.filterAgentsByRepository('All');
61
+ // Then I should see all agents
62
+ TTYGViewSteps.verifyAgentList([
63
+ {name: 'agent-1', repositoryId: 'starwars'},
64
+ {name: 'agent-2', repositoryId: 'Deleted repository'},
65
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars'},
66
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers'}
67
+ ]);
68
+ });
69
+ });
@@ -0,0 +1,139 @@
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 agent select menu', () => {
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
+ 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'},
26
+ {name: 'agent-2', repositoryId: 'Deleted repository'}, // the agent has no repository id
27
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars'},
28
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers'}
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-0');
63
+ // When I delete an agent from the sidebar
64
+ TTYGStubs.stubAgentDelete();
65
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-after-deleted.json');
66
+ TTYGViewSteps.filterAgentsByRepository('All');
67
+ TTYGViewSteps.triggerDeleteAgentActionMenu(0);
68
+ ModalDialogSteps.confirm();
69
+ ModalDialogSteps.getDialog().should('not.exist');
70
+ // TODO: the agents list filter brakes after deleting an agent!!!
71
+ TTYGViewSteps.getAgents().should('have.length', 3);
72
+ TTYGViewSteps.verifySelectAgentMenuItems([
73
+ {name: 'agent-2', repositoryId: 'Deleted repository'}, // the agent has no repository id
74
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars'},
75
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers'}
76
+ ]);
77
+ });
78
+
79
+ it('Should mark selected agent as deleted when the agent is deleted from the sidebar', () => {
80
+ TTYGStubs.stubChatsListGetNoResults();
81
+ TTYGStubs.stubAgentListGet();
82
+ // Given I have opened the ttyg page
83
+ TTYGViewSteps.visit();
84
+ cy.wait('@get-agent-list-0');
85
+ // And I have selected an agent from the menu
86
+ TTYGViewSteps.openAgentsMenu();
87
+ TTYGViewSteps.selectAgent(0);
88
+ TTYGViewSteps.getAgentsMenuToggleButton().should('contain', 'agent-1');
89
+ // When I delete an agent from the sidebar
90
+ TTYGStubs.stubAgentDelete();
91
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-after-deleted.json');
92
+ TTYGViewSteps.filterAgentsByRepository('All');
93
+ TTYGViewSteps.triggerDeleteAgentActionMenu(1);
94
+ ModalDialogSteps.confirm();
95
+ ModalDialogSteps.getDialog().should('not.exist');
96
+ // TODO: the agents list filter brakes after deleting an agent!!!
97
+ TTYGViewSteps.verifySelectAgentMenuItems([
98
+ {name: 'agent-2', repositoryId: 'Deleted repository'}, // the agent has no repository id
99
+ {name: 'Databricks-general-unbiased', repositoryId: 'starwars'},
100
+ {name: 'Databricks-biomarkers', repositoryId: 'biomarkers'}
101
+ ]);
102
+ });
103
+
104
+ it('Should ask user to configure the agent when it has missing repository', () => {
105
+ TTYGStubs.stubChatsListGetNoResults();
106
+ TTYGStubs.stubAgentListGet();
107
+ // Given I have opened the ttyg page
108
+ TTYGViewSteps.visit();
109
+ cy.wait('@get-agent-list-0');
110
+ // When I select an agent which has no repository id from the menu
111
+ TTYGViewSteps.openAgentsMenu();
112
+ TTYGViewSteps.selectAgent(1);
113
+ // Then I expect a confirmation dialog to be opened for the user to configure the agent
114
+ ModalDialogSteps.getDialog().should('be.visible');
115
+ // When I cancel the configuration
116
+ ModalDialogSteps.cancel();
117
+ // Then the agent should be selected in the menu immediately
118
+ TTYGViewSteps.getAgentsMenuToggleButton().should('contain', 'agent-2');
119
+ // When I select the agent again
120
+ TTYGViewSteps.openAgentsMenu();
121
+ TTYGViewSteps.selectAgent(0);
122
+ TTYGViewSteps.openAgentsMenu();
123
+ TTYGViewSteps.selectAgent(1);
124
+ ModalDialogSteps.getDialog().should('be.visible');
125
+ // And I confirm that I want to configure the agent
126
+ ModalDialogSteps.confirm();
127
+ // TODO: Next steps should be implemented when agent edit action is implemented
128
+ // TODO: Then I expect that the confirmation dialog is closed
129
+ // TODO: And I expect that the agent edit dialog is opened
130
+ // TODO: When I configure the agent repository and save it
131
+ // TODO: Then I expect that the agent is selected in the menu
132
+ // TODO: And the sgent should have the repository id in the menu
133
+ });
134
+
135
+ it.skip('Should load the agent which was last used', () => {
136
+
137
+ });
138
+ });
139
+
@@ -0,0 +1,158 @@
1
+ import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
2
+ import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
4
+ import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
5
+ import {ApplicationSteps} from "../../steps/application-steps";
6
+
7
+ // TODO: This test is skipped because it fails on CI. For some reason the chat list panel is not visible.
8
+ describe.skip('TTYG chat list', () => {
9
+
10
+ beforeEach(() => {
11
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
12
+ cy.presetRepository('starwars');
13
+ });
14
+
15
+ it('Should render chat list', () => {
16
+ TTYGStubs.stubChatsListGet();
17
+ TTYGStubs.stubAgentListGet();
18
+ // Given I have opened the ttyg page
19
+ TTYGViewSteps.visit();
20
+ // When the ttyg page is loaded
21
+ // Then I should see the chat list
22
+ // TODO: Temporary removed because it fails on CI.
23
+ // TTYGViewSteps.getChatListLoadingIndicator().should('be.visible');
24
+ TTYGViewSteps.getChatsPanel().should('be.visible');
25
+ // And I should see 7 chat groups by day
26
+ TTYGViewSteps.getChatByDayGroups().should('have.length', 2);
27
+ // And the first chat group should have 3 chats
28
+ verifyChatList([
29
+ [
30
+ {name: 'Very long chat name which does not fit in the sidebar'},
31
+ {name: 'Test chat 2'},
32
+ {name: 'Test chat 3'}
33
+ ],
34
+ [{name: 'Test chat 4'}]
35
+ ]);
36
+ });
37
+
38
+ it('Should render no results when there are no chats', () => {
39
+ TTYGStubs.stubChatsListGetNoResults();
40
+ TTYGStubs.stubAgentListGet();
41
+ // Given I have opened the ttyg page
42
+ TTYGViewSteps.visit();
43
+ // When the ttyg page is loaded
44
+ // And there are no chats
45
+ // Then I expect chat list panel to be hidden
46
+ TTYGViewSteps.getChatsPanel().should('be.hidden');
47
+ // When I open the chat list
48
+ TTYGViewSteps.expandChatsSidebar();
49
+ // Then I should see no chats
50
+ TTYGViewSteps.getChatByDayGroups().should('have.length', 0);
51
+ });
52
+
53
+ it('Should be able to edit an existing chat name by double click on the chat in the list', () => {
54
+ TTYGStubs.stubChatsListGet();
55
+ TTYGStubs.stubAgentListGet();
56
+ TTYGStubs.stubChatUpdate();
57
+ // Given I have opened the ttyg page and there are chats loaded
58
+ TTYGViewSteps.visit();
59
+ // And I double-click on the chat name I want to rename
60
+ TTYGViewSteps.editChatName(1, 0);
61
+ // Then I should see the chat name input
62
+ TTYGViewSteps.getChatNameInput(1, 0).should('be.visible').and('have.value', 'Test chat 4');
63
+ // When I change the chat name
64
+ TTYGViewSteps.writeChatName(1, 0, 'New chat name');
65
+ // And I hit [enter] key
66
+ TTYGStubs.stubChatsListGet('/ttyg/chats/get-chat-list-with-renamed-chat.json');
67
+ TTYGViewSteps.saveChatName(1, 0);
68
+ // Then I should see the new chat name
69
+ TTYGViewSteps.getChatFromGroup(1, 0).should('contain', 'New chat name');
70
+ });
71
+
72
+ it('Should be able to edit an existing chat name through the action menu', () => {
73
+ TTYGStubs.stubChatsListGet();
74
+ TTYGStubs.stubAgentListGet();
75
+ TTYGStubs.stubChatUpdate();
76
+ // Given I have opened the ttyg page and there are chats loaded
77
+ TTYGViewSteps.visit();
78
+ // And I open the action menu for the chat I want to rename
79
+ TTYGViewSteps.selectChat(1, 0);
80
+ TTYGViewSteps.triggerEditChatActionMenu(1, 0);
81
+ // Then I should see the chat name input
82
+ TTYGViewSteps.getChatNameInput(1, 0).should('be.visible').and('have.value', 'Test chat 4');
83
+ // When I change the chat name
84
+ TTYGViewSteps.writeChatName(1, 0, 'New chat name');
85
+ // And I hit [enter] key
86
+ TTYGStubs.stubChatsListGet('/ttyg/chats/get-chat-list-with-renamed-chat.json');
87
+ TTYGViewSteps.saveChatName(1, 0);
88
+ // Then I should see the new chat name
89
+ TTYGViewSteps.getChatFromGroup(1, 0).should('contain', 'New chat name');
90
+ });
91
+
92
+ it('Should be able to cancel a chat name editing', () => {
93
+ TTYGStubs.stubChatsListGet();
94
+ TTYGStubs.stubAgentListGet();
95
+ // Given I have opened the ttyg page and there are chats loaded
96
+ TTYGViewSteps.visit();
97
+ // And I double-click on the first chat
98
+ TTYGViewSteps.editChatName(0, 0);
99
+ // Then I should see the chat name input
100
+ TTYGViewSteps.getChatNameInput(0, 0).should('be.visible').and('have.value', 'Very long chat name which does not fit in the sidebar');
101
+ // When I change the chat name
102
+ TTYGViewSteps.writeChatName(0, 0, 'New chat name');
103
+ // And I hit [esc] key
104
+ TTYGViewSteps.cancelChatNameSaving(0, 0);
105
+ // Then I should see the old chat name
106
+ TTYGViewSteps.getChatFromGroup(0, 0).should('contain', 'Very long chat name which does not fit in the sidebar');
107
+ });
108
+
109
+ it('Should be able to delete a chat', () => {
110
+ TTYGStubs.stubChatsListGet();
111
+ TTYGStubs.stubAgentListGet();
112
+ TTYGStubs.stubChatDelete();
113
+ // Given I have opened the ttyg page and there are chats loaded
114
+ TTYGViewSteps.visit();
115
+ // When I select the delete action from the chat action menu
116
+ TTYGViewSteps.triggerDeleteChatActionMenu(1, 0);
117
+ // Then I should see the chat deletion confirmation dialog
118
+ ModalDialogSteps.getDialog().should('be.visible');
119
+ // If I reject the deletion
120
+ ModalDialogSteps.clickOnCancelButton();
121
+ // Then the chat should not be deleted
122
+ TTYGViewSteps.getChatFromGroup(1, 0).should('contain', 'Test chat 4');
123
+ // When I select the delete action from the chat action menu again
124
+ TTYGViewSteps.triggerDeleteChatActionMenu(1, 0);
125
+ // And I confirm the deletion
126
+ TTYGStubs.stubChatsListGet('/ttyg/chats/get-chat-list-with-deleted-chat.json');
127
+ ModalDialogSteps.clickOnConfirmButton();
128
+ // Then the chat should be deleted
129
+ TTYGViewSteps.getChatByDayGroups().should('have.length', 1);
130
+ });
131
+
132
+ it('Should show error notification if chat list fails to load', () => {
133
+ TTYGStubs.stubChatListGetError();
134
+ TTYGStubs.stubAgentListGet();
135
+ // Given I have opened the ttyg page
136
+ TTYGViewSteps.visit();
137
+ // When the chat list fails to load
138
+ // Then I should see an error notification
139
+ TTYGViewSteps.getChatListLoadingIndicator().should('not.exist');
140
+ // And the error notification should be visible
141
+ ApplicationSteps.getErrorNotifications().should('be.visible');
142
+ // And the chat list should not be visible
143
+ TTYGViewSteps.getChatsPanel().should('be.hidden');
144
+ });
145
+ });
146
+
147
+ /**
148
+ * @param {*[]} data
149
+ */
150
+ function verifyChatList(data) {
151
+ TTYGViewSteps.getChatByDayGroups().should('have.length', data.length);
152
+ data.forEach((group, index) => {
153
+ TTYGViewSteps.getChatsFromGroup(index).should('have.length', group.length);
154
+ group.forEach((chat, chatIndex) => {
155
+ TTYGViewSteps.getChatFromGroup(index, chatIndex).should('contain', chat.name);
156
+ });
157
+ });
158
+ }
@@ -0,0 +1,79 @@
1
+ import {RepositoriesStubs} from "../../stubs/repositories/repositories-stubs";
2
+ import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
+ import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
4
+ import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
5
+ import {ApplicationSteps} from "../../steps/application-steps";
6
+
7
+ describe('Ttyg ChatPanel', () => {
8
+
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
+ cy.presetRepository('starwars');
13
+ TTYGStubs.stubChatsListGet();
14
+ TTYGStubs.stubAgentListGet();
15
+ TTYGStubs.stubChatGet();
16
+
17
+ // When visiting the TTYG page where there is a chat with questions and answers
18
+ TTYGViewSteps.visit();
19
+ });
20
+
21
+ it('Should load chat history and show answer actions', () => {
22
+
23
+ // Then I expect chat history to be displayed
24
+ ChatPanelSteps.getChatDetailsElements().should('have.length', 2);
25
+ // and only the actions for the last message are visible.
26
+ ChatPanelSteps.getChatDetailActions(0).should('not.be.visible');
27
+ ChatPanelSteps.getChatDetailActions(1).should('be.visible');
28
+
29
+ // When I hover over the hidden answer actions.
30
+ ChatPanelSteps.getChatDetailActions(0).realHover();
31
+
32
+ // Then I expect answer actions to be visible.
33
+ ChatPanelSteps.getChatDetailActions(0).should('be.visible');
34
+
35
+ // When the new question input is empty.
36
+ // The "Ask" button must be disabled.
37
+ ChatPanelSteps.getAskButtonElement().should('be.disabled');
38
+
39
+ // When I type a question
40
+ ChatPanelSteps.getQuestionInputElement().type('Who is Han Solo?');
41
+
42
+ // Then I expect the "Ask" button be not active because agent is not selected
43
+ ChatPanelSteps.getAskButtonElement().should('not.be.enabled');
44
+
45
+ // When I select an agent
46
+ TTYGViewSteps.openAgentsMenu();
47
+ TTYGViewSteps.selectAgent(0);
48
+
49
+ // Then I expect the "Ask" button be active.
50
+ ChatPanelSteps.getAskButtonElement().should('be.enabled');
51
+
52
+ // When I click on "Ask" button.
53
+ ChatPanelSteps.getAskButtonElement().scrollIntoView().click();
54
+
55
+ // Then I expect the question be in chat history,
56
+ ChatPanelSteps.getChatDetailsElements().should('have.length', 3);
57
+ ChatPanelSteps.getChatDetailQuestionElement(2).contains('Who is Han Solo?');
58
+ // and input field be empty,
59
+ ChatPanelSteps.getQuestionInputElement().should('have.value', '');
60
+ // and "Ask" button be disabled.
61
+ ChatPanelSteps.getAskButtonElement().should('be.disabled');
62
+
63
+ // When I click on regenerate button.
64
+ ChatPanelSteps.regenerateQuestion(2);
65
+
66
+ // Then I expect the question to be regenerated and appear in the chat history.
67
+ ChatPanelSteps.getChatDetailsElements().should('have.length', 4);
68
+
69
+ });
70
+
71
+ // Can't test this on CI
72
+ it.skip('Should copy an answer when click on copy button', () => {
73
+ // When I click on copy button
74
+ ChatPanelSteps.copyAnswer();
75
+
76
+ // Then I expect the answer to be copied.
77
+ ApplicationSteps.getSuccessNotifications().contains('The answer was successfully copied to the clipboard.');
78
+ });
79
+ });