Skip to content

Commit

Permalink
feat: add flag config
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Jan 23, 2024
1 parent 53c3d39 commit e2f88fd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/assistant-release-e2e-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
uses: ./.github/workflows/release-e2e-workflow-template.yml
with:
test-name: dashboards assistant
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/*'
test-command: env CYPRESS_DASHBOARDS_ASSISTANT_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/*'
osd-serve-args: --assistant.chat.enabled=true --assistant.chat.rootAgentName="Cypress test agent"
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"VISBUILDER_ENABLED": true,
"DATASOURCE_MANAGEMENT_ENABLED": false,
"ML_COMMONS_DASHBOARDS_ENABLED": true,
"WAIT_FOR_LOADER_BUFFER_MS": 0
"WAIT_FOR_LOADER_BUFFER_MS": 0,
"DASHBOARDS_ASSISTANT_ENABLED": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,51 @@
*/
import { BASE_PATH } from '../../../utils/constants';

describe('Assistant basic 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');

cy.addAssistantRequiredSettings();
cy.registerRootAgent();
cy.startDummyServer();
});
if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
describe('Assistant basic 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');

cy.addAssistantRequiredSettings();
cy.registerRootAgent();
cy.startDummyServer();
});

beforeEach(() => {
// Visit ISM OSD
cy.visit(`${BASE_PATH}/app/home`);
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
);
});
// 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
);
});

describe('Interact with Agent framework', () => {
it('toggle Chatbot and enable to interact', () => {
// enable to toggle and show Chatbot
cy.get(`img[aria-label="toggle chat flyout icon"]`).click();
describe('Interact with Agent framework', () => {
it('toggle Chatbot and enable to interact', () => {
// enable to toggle and show Chatbot
cy.get(`img[aria-label="toggle chat flyout icon"]`).click();

// click suggestions to generate response
cy.contains('What are the indices in my cluster?').click();
// 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 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);
// should have a suggestion section
cy.get(`[aria-label="chat suggestions"]`).should('be.length', 1);
});
});
});

after(() => {
cy.cleanRootAgent();
cy.stopDummyServer();
after(() => {
cy.cleanRootAgent();
cy.stopDummyServer();
});
});
});
}

0 comments on commit e2f88fd

Please sign in to comment.