-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathmds_chatbot_agent_framework_spec.js
More file actions
67 lines (53 loc) · 2.15 KB
/
Copy pathmds_chatbot_agent_framework_spec.js
File metadata and controls
67 lines (53 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { BASE_PATH } from '../../../utils/constants';
if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
describe('Assistant basic spec', () => {
before(() => {
cy.setDefaultDataSourceForAssistant();
// Set welcome screen tracking to false
localStorage.setItem('home:welcome:show', 'false');
});
after(() => {
cy.clearDataSourceForAssistant();
});
beforeEach(() => {
// Visit ISM OSD
cy.visit(`${BASE_PATH}/app/home`);
cy.get(`button[aria-label="toggle chat flyout icon"]`, {
timeout: 60000,
}).should('be.length', 1);
});
describe('Interact with Agent framework', () => {
it('toggle Chatbot and enable to interact', () => {
// enable to toggle and show Chatbot
cy.openAssistantChatbot();
cy.startNewAssistantConversation();
// click suggestions to generate response
cy.contains('What are the indices in my cluster?').click();
// should have a LLM Response
cy.contains(
'The indices in your cluster are the names listed in the response obtained from using a tool to get information about the OpenSearch indices.'
);
// should have a suggestion section
cy.get(`[aria-label="chat suggestions"]`).should('be.length', 1);
cy.contains('suggestion1');
// Click regenerate button
cy.get(`[aria-label="regenerate message"]`).click();
// The previous message and the regenerate button should be gone
cy.get(`[aria-label="regenerate message"]`).should('be.length', 0);
// suggestions should be gone
cy.get(`[aria-label="chat suggestions"]`).should('be.length', 0);
// The regenrate message should be there
cy.contains(
'The indices in your cluster are the names listed in the response obtained from using a tool to get information about the OpenSearch indices.'
);
// should have a suggestion section
cy.get(`[aria-label="chat suggestions"]`).should('be.length', 1);
cy.contains('suggestion2');
});
});
});
}