-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathmds_chatbot_feedback_spec.js
More file actions
57 lines (49 loc) · 1.88 KB
/
Copy pathmds_chatbot_feedback_spec.js
File metadata and controls
57 lines (49 loc) · 1.88 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
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { BASE_PATH } from '../../../utils/constants';
if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
describe('Assistant feedback spec', () => {
before(() => {
cy.setDefaultDataSourceForAssistant();
// Set welcome screen tracking to false
localStorage.setItem('home:welcome:show', 'false');
});
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);
});
// clean up localStorage items
after(() => {
cy.clearDataSourceForAssistant();
localStorage.removeItem('home:welcome:show');
});
describe('conversation feedback', () => {
it('display feedback button and able 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();
cy.wait(10000);
// should have a thumb up and a thumb down feedback button
cy.get(`[aria-label="feedback thumbs up"]`).should('be.length', 1);
cy.get(`[aria-label="feedback thumbs down"]`).should('be.length', 1);
// click thumb up button to feedback
cy.get(`[aria-label="feedback thumbs up"]`).click();
// only thumb up button displays and thumb down button is hidden
cy.get(`[aria-label="feedback thumbs down"]`).should('be.length', 0);
cy.get(`[aria-label="feedback thumbs up"]`).should('be.length', 1);
// The type of clicked button should be primary.
cy.get(`[aria-label="feedback thumbs up"]`).should(
'have.class',
'euiButtonIcon--primary'
);
});
});
});
}