Skip to content

Commit bf51d4e

Browse files
opensearch-trigger-bot[bot]yyfamazonwanglam
authored
Fix Integration test (#1764) (#1769)
* Fix Integration test * delete wait 12 seconds * delte wait 2 minutes * add wait time * Fix assitant failed due to join cluster --------- (cherry picked from commit e2af805) Signed-off-by: yyfamazon <[email protected]> Co-authored-by: yyfamazon <[email protected]> Co-authored-by: Lin Wang <[email protected]>
1 parent d300446 commit bf51d4e

12 files changed

+71
-70
lines changed

.github/workflows/assistant-release-e2e-workflow.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
test-name: dashboards assistant
2525
test-command: env CYPRESS_DASHBOARDS_ASSISTANT_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/*'
2626
osd-serve-args: --assistant.chat.enabled=true
27-
27+
artifact-name-suffix: "-with-security"
28+
2829
tests-without-security:
2930
needs: changes
3031
if: ${{ needs.changes.outputs.tests == 'true' }}
@@ -34,6 +35,9 @@ jobs:
3435
test-command: env CYPRESS_DASHBOARDS_ASSISTANT_ENABLED=true yarn cypress:run-without-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/*'
3536
osd-serve-args: --assistant.chat.enabled=true
3637
security-enabled: false
38+
artifact-name-suffix: "-without-security"
39+
multi-opensearch-enabled: false
40+
3741
tests-with-multiple-data-source-and-disabled-local-cluster:
3842
needs: changes
3943
if: ${{ needs.changes.outputs.tests == 'true' }}
@@ -43,4 +47,5 @@ jobs:
4347
test-command: env CYPRESS_DISABLE_LOCAL_CLUSTER=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true CYPRESS_DASHBOARDS_ASSISTANT_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/mds*.js'
4448
osd-serve-args: --data_source.enabled=true --data_source.ssl.verificationMode=none --data_source.hideLocalCluster=true --assistant.chat.enabled=true
4549
security-enabled: true
50+
artifact-name-suffix: "-with-security-and-mds"
4651

.github/workflows/release-e2e-workflow-template.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ on:
1717
artifact-name-suffix:
1818
required: false
1919
type: string
20+
multi-opensearch-enabled:
21+
required: false
22+
type: boolean
23+
default: true
2024
jobs:
2125
tests:
2226
name: Run Cypress E2E tests for ${{ inputs.test-name }}
@@ -72,11 +76,13 @@ jobs:
7276
curl https://localhost:9200 -u admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }} --insecure
7377
fi
7478
- uses: ./.github/actions/start-opensearch
79+
if: ${{ inputs.multi-opensearch-enabled }}
7580
with:
7681
opensearch-version: ${{ env.VERSION }}
7782
security-enabled: false
7883
port: 9201
7984
- uses: ./.github/actions/start-opensearch
85+
if: ${{ inputs.multi-opensearch-enabled }}
8086
with:
8187
opensearch-version: ${{ env.VERSION }}
8288
security-enabled: true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"completion": " ```json\n{\n \"thought\": \"Thought: Let me use tool to figure out\",\n \"action\": \"CatIndexTool\",\n \"action_input\": \"\"}\n```\n",
2+
"completion": " ```json\n{\n \"thought\": \"Thought: Let me use tool to figure out\",\n \"action\": \"ListIndexTool\",\n \"action_input\": \"\"}\n```\n",
33
"stop_reason": "stop_sequence",
44
"stop": "\n\nHuman:"
55
}

cypress/fixtures/plugins/dashboards-assistant/flow-template.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"x-amz-content-sha256": "required",
2626
"content-type": "application/json"
2727
},
28-
"method": "GET",
28+
"method": "POST",
2929
"request_body": "{\"prompt\":\"${parameters.prompt}\", \"max_tokens_to_sample\":${parameters.max_tokens_to_sample}, \"temperature\":${parameters.temperature}, \"anthropic_version\":\"${parameters.anthropic_version}\" }",
3030
"action_type": "predict",
3131
"url": "http://127.0.0.1:3000"
@@ -61,12 +61,12 @@
6161
}
6262
},
6363
{
64-
"id": "cat_index_tool",
64+
"id": "list_index_tool",
6565
"type": "create_tool",
6666
"previous_node_inputs": {},
6767
"user_inputs": {
68-
"type": "CatIndexTool",
69-
"name": "CatIndexTool",
68+
"type": "ListIndexTool",
69+
"name": "ListIndexTool",
7070
"description": "Use this tool to get OpenSearch index information: (health, status, index, uuid, primary count, replica count, docs.count, docs.deleted, store.size, primary.store.size).",
7171
"parameters": {
7272
"index": ".kibana"
@@ -77,7 +77,7 @@
7777
"id": "sub_agent",
7878
"type": "register_agent",
7979
"previous_node_inputs": {
80-
"cat_index_tool": "tools",
80+
"list_index_tool": "tools",
8181
"register_model_2": "model_id"
8282
},
8383
"user_inputs": {

cypress/integration/plugins/dashboards-assistant/conversation_save_to_notebook_spec.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
3535
);
3636
// Visit OSD
3737
cy.visit(`${BASE_PATH}/app/home`);
38-
// Common text to wait for to confirm page loaded, give up to 120 seconds for initial load
39-
cy.get(`input[placeholder="Ask question"]`, { timeout: 120000 }).as(
40-
'chatInput'
41-
);
42-
cy.get('@chatInput').should('be.length', 1);
4338

44-
cy.wait(10000);
39+
cy.get(`button[aria-label="toggle chat flyout icon"]`, {
40+
timeout: 60000,
41+
}).should('be.length', 1);
4542

46-
cy.get('@chatInput').click().type(`${QUESTION}{enter}`);
43+
// enable to toggle and show Chatbot
44+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
45+
46+
// click suggestions to generate response
47+
cy.contains('What are the indices in my cluster?').click();
48+
cy.wait(10000);
4749

4850
// should have a LLM Response
4951
cy.contains(FINAL_ANSWER);

cypress/integration/plugins/dashboards-assistant/mds_chatbot_agent_framework_spec.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
2222
// Visit ISM OSD
2323
cy.visit(`${BASE_PATH}/app/home`);
2424

25-
// Common text to wait for to confirm page loaded, give up to 60 seconds for initial load
26-
cy.get(`input[placeholder="Ask question"]`, { timeout: 60000 }).should(
27-
'be.length',
28-
1
29-
);
25+
cy.get(`button[aria-label="toggle chat flyout icon"]`, {
26+
timeout: 60000,
27+
}).should('be.length', 1);
3028
});
3129

3230
describe('Interact with Agent framework', () => {
@@ -35,7 +33,7 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
3533
cy.wait(5000);
3634

3735
// enable to toggle and show Chatbot
38-
cy.get(`img[aria-label="toggle chat flyout icon"]`).click();
36+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
3937

4038
// click suggestions to generate response
4139
cy.contains('What are the indices in my cluster?').click();
@@ -50,10 +48,10 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
5048
cy.contains('suggestion1');
5149

5250
// Click regenerate button
53-
cy.get(`button[title="regenerate message"]`).click();
51+
cy.get(`[aria-label="regenerate message"]`).click();
5452

5553
// The previous message and the regenerate button should be gone
56-
cy.get(`button[title="regenerate message"]`).should('be.length', 0);
54+
cy.get(`[aria-label="regenerate message"]`).should('be.length', 0);
5755

5856
// suggestions should be gone
5957
cy.get(`[aria-label="chat suggestions"]`).should('be.length', 0);

cypress/integration/plugins/dashboards-assistant/mds_chatbot_default_data_source_change.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ const manualSetDefaultDataSource = (dataSourceTitle) => {
2323
};
2424

2525
const openChatBotAndSendMessage = () => {
26-
// Common text to wait for to confirm page loaded, give up to 120 seconds for initial load
27-
cy.get(`input[placeholder="Ask question"]`, { timeout: 120000 }).as(
28-
'chatInput'
29-
);
30-
cy.get('@chatInput').should('be.length', 1);
26+
cy.wait(5000);
3127

32-
cy.wait(1000);
33-
34-
cy.get('@chatInput').click();
28+
// enable to toggle and show Chatbot
29+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
3530

36-
cy.get('@chatInput').type('What are the indices in my cluster?{enter}');
31+
// click suggestions to generate response
32+
cy.contains('What are the indices in my cluster?').click();
3733

3834
// should have a LLM Response
3935
cy.contains(
@@ -69,7 +65,7 @@ if (
6965
// The header may render multiple times, wait for UI to be stable
7066
cy.wait(5000);
7167
// enable to toggle and show Chatbot
72-
cy.get(`img[aria-label="toggle chat flyout icon"]`).click();
68+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
7369
cy.get('.llm-chat-flyout button[aria-label="history"]')
7470
.should('be.visible')
7571
.click();

cypress/integration/plugins/dashboards-assistant/mds_chatbot_interaction_trace_spec.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,16 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
1717
cy.visit(`${BASE_PATH}/app/home`);
1818
// cy.waitForLoader();
1919

20-
// Common text to wait for to confirm page loaded, give up to 120 seconds for initial load
21-
cy.get(`input[placeholder="Ask question"]`, { timeout: 120000 }).as(
22-
'chatInput'
23-
);
24-
cy.get('@chatInput').should('be.length', 1);
25-
26-
cy.wait(1000);
20+
cy.get(`button[aria-label="toggle chat flyout icon"]`, {
21+
timeout: 120000,
22+
}).should('be.length', 1);
23+
cy.wait(5000);
2724

28-
cy.get('@chatInput')
29-
.click()
30-
.type('What are the indices in my cluster?{enter}');
25+
// enable to toggle and show Chatbot
26+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
3127

28+
// click suggestions to generate response
29+
cy.contains('What are the indices in my cluster?').click();
3230
// should have a LLM Response
3331
cy.contains(
3432
'The indices in your cluster are the names listed in the response obtained from using a tool to get information about the OpenSearch indices.'
@@ -76,7 +74,7 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
7674
cy.get('@tracePage')
7775
.find('.euiAccordion')
7876
// tool name
79-
.contains('Step 2 - CatIndexTool')
77+
.contains('Step 2 - ListIndexTool')
8078
.click({ force: true });
8179

8280
// tool output

cypress/integration/plugins/dashboards-assistant/mds_chatbot_sidecar_spec.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
1717
// Visit OSD
1818
cy.visit(`${BASE_PATH}/app/home`);
1919

20-
// Common text to wait for to confirm page loaded, give up to 60 seconds for initial load
21-
cy.get(`input[placeholder="Ask question"]`, { timeout: 120000 }).should(
22-
'be.length',
23-
1
24-
);
20+
cy.get(`button[aria-label="toggle chat flyout icon"]`, {
21+
timeout: 60000,
22+
}).should('be.length', 1);
2523
});
2624

2725
describe('sidecar spec', () => {
@@ -30,7 +28,7 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
3028
cy.wait(5000);
3129

3230
// enable to toggle and open sidecar, OSD will be pushed accordingly.
33-
cy.get(`img[aria-label="toggle chat flyout icon"]`).click();
31+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
3432
cy.get('[class~="chatbot-sidecar"]').should('be.visible');
3533
cy.get('[class~="chatbot-sidecar"]').should(
3634
'have.css',
@@ -48,7 +46,7 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
4846
.should('have.css', 'padding-right', '460px');
4947

5048
// click toggle to call sidecar hide, sidecar will be hidden and paddingSize on header and wrapper will be zero.
51-
cy.get(`img[aria-label="toggle chat flyout icon"]`).click();
49+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
5250
cy.get('[class~="chatbot-sidecar"]').should(
5351
'have.css',
5452
'display',
@@ -63,7 +61,7 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
6361
.should('not.have.attr', 'padding-right');
6462

6563
// click toggle to call sidecar show
66-
cy.get(`img[aria-label="toggle chat flyout icon"]`).click();
64+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
6765
cy.get('[class~="chatbot-sidecar"]').should('be.visible');
6866
cy.get('[class~="app-wrapper"]').should(
6967
'have.css',
@@ -80,7 +78,7 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
8078
cy.wait(5000);
8179

8280
// enable to toggle and open sidecar, OSD will be pushed accordingly.
83-
cy.get(`img[aria-label="toggle chat flyout icon"]`).click();
81+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
8482
cy.get('[class~="chatbot-sidecar"]').should('be.visible');
8583
cy.get('[class~="app-wrapper"]').should(
8684
'have.css',
@@ -117,7 +115,7 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
117115
cy.wait(5000);
118116

119117
// enable to toggle and open sidecar, OSD will be pushed accordingly.
120-
cy.get(`img[aria-label="toggle chat flyout icon"]`).click();
118+
cy.get(`button[aria-label="toggle chat flyout icon"]`).click();
121119
// switch to docked left
122120
cy.get('[id="sidecarModeIcon"]').click();
123121
cy.get('[data-test-subj="sidecar-mode-icon-menu-item-left"]').click();

cypress/integration/plugins/dashboards-assistant/mds_conversation_history_spec.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
3030
// Visit OSD
3131
cy.visit(`${BASE_PATH}/app/home`);
3232
// Common text to wait for to confirm page loaded, give up to 60 seconds for initial load
33-
cy.get(`input[placeholder="Ask question"]`, { timeout: 60000 }).should(
34-
'be.length',
35-
1
36-
);
33+
cy.get(`button[aria-label="toggle chat flyout icon"]`, {
34+
timeout: 60000,
35+
}).should('be.length', 1);
3736

3837
// Open assistant flyout
3938
// The flyout button will be detached and can't be clicked, add 10s delayed fix it.
4039
cy.wait(10000);
41-
cy.get('img[aria-label="toggle chat flyout icon"]').click();
40+
cy.get('button[aria-label="toggle chat flyout icon"]').click();
4241
});
4342
after(() => {
4443
cy.clearDataSourceForAssistant();
@@ -49,7 +48,7 @@ if (Cypress.env('DASHBOARDS_ASSISTANT_ENABLED')) {
4948
restoreNewThemeModal();
5049
}
5150
// Close assistant flyout
52-
cy.get('img[aria-label="toggle chat flyout icon"]').click();
51+
cy.get('button[aria-label="toggle chat flyout icon"]').click();
5352
});
5453

5554
beforeEach(() => {

0 commit comments

Comments
 (0)