Skip to content

Commit

Permalink
wait for 30s to let flyout button not detached
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Wang <[email protected]>
  • Loading branch information
wanglam committed Jan 26, 2024
1 parent b67bc83 commit 323f7f2
Showing 1 changed file with 14 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
'home:newThemeModal:show',
'false'
);
});
after(() => {
if (restoreShowHome) {
restoreShowHome();
}
if (restoreNewThemeModal) {
restoreNewThemeModal();
}
});

beforeEach(() => {
// Visit OSD
cy.visit(`${BASE_PATH}/app/home`);
// Common text to wait for to confirm page loaded, give up to 60 seconds for initial load
Expand All @@ -49,39 +38,26 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
);

// Open assistant flyout
cy.get('body').then(($body) => {
if ($body.find('.llm-chat-flyout').length === 0) {
/**
* Use cypress.get.click got CypressError(element detached from the DOM), like
* https://github.com/opensearch-project/opensearch-dashboards-functional-test/actions/runs/7663718989/job/20887600834
* use native js call instead.
**/
$body
.find('img[aria-label="toggle chat flyout icon"]')
.trigger('click');
}
});
cy.wait(30000);
cy.get('img[aria-label="toggle chat flyout icon"]').click();
});

afterEach(() => {
after(() => {
if (restoreShowHome) {
restoreShowHome();
}
if (restoreNewThemeModal) {
restoreNewThemeModal();
}
// Close assistant flyout
cy.get('body').then(($body) => {
if ($body.find('.llm-chat-flyout').length !== 0) {
$body
.find('img[aria-label="toggle chat flyout icon"]')
.trigger('click');
}
});
cy.get('img[aria-label="toggle chat flyout icon"]').click();
});

beforeEach(() => {
cy.get('.llm-chat-flyout', { timeout: 60000 }).should('be.visible');
});

describe('panel operations', () => {
it('should toggle history list', () => {
cy.get('body').then(($body) => {
$body
.find('img[aria-label="toggle chat flyout icon"]')
.trigger('click');
});

cy.get('.llm-chat-flyout button[aria-label="history"]')
.should('be.visible')
.click();
Expand Down

0 comments on commit 323f7f2

Please sign in to comment.