Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] add test cases for assistant feedback #1042

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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(() => {
// Set welcome screen tracking to false
localStorage.setItem('home:welcome:show', 'false');
// Set new theme modal to false
localStorage.setItem('home:newThemeModal:show', 'false');
});

beforeEach(() => {
// Visit ISM OSD
cy.visit(`${BASE_PATH}/app/home`);

// Common text to wait for to confirm page loaded, give up to 60 seconds for initial load
cy.get(`input[placeholder="Ask question"]`, { timeout: 60000 }).should(
'be.length',
1
);
});

// clean up localStorage items
after(() => {
localStorage.removeItem('home:welcome:show');
localStorage.removeItem('home:newThemeModal:show');
});

describe('conversation feedback', () => {
it('display feedback button and able to interact', () => {
// input question
cy.wait(1000);
cy.get(`input[placeholder="Ask question"]`)
.click()
.type('What are the indices in my cluster?{enter}');

// should have a LLM Response
cy.contains('The indices in your cluster');

// 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'
);
});
});
});
}
Loading