Skip to content

Commit 7f7dddf

Browse files
committed
Add more test
Signed-off-by: Lin Wang <[email protected]>
1 parent 5f4e124 commit 7f7dddf

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,41 @@ const testSuggestAD = (url) => {
8888
.click();
8989
});
9090

91-
it.only("test before and after",()=>{
91+
it.only('test before and after', () => {
9292
cy.get('button[aria-label="OpenSearch assistant trigger button"]', {
9393
timeout: 60000,
9494
}).click();
95-
})
95+
cy.contains('Suggest anomaly detector').click();
96+
97+
cy.intercept('POST', 'w/*/api/assistant/agent/_execute**', (req) => {
98+
req.reply(() => {
99+
return {
100+
statusCode: 200,
101+
headers: {
102+
'content-type': 'application/json',
103+
},
104+
body: {
105+
inference_results: [
106+
{
107+
output: [
108+
{
109+
name: 'response',
110+
result:
111+
'{"index":"opensearch_dashboards_sample_data_logs","categoryField":"geo.src","aggregationField":"bytes,memory,phpmemory","aggregationMethod":"sum,avg,max","dateFields":"utc_time,timestamp"}',
112+
},
113+
],
114+
},
115+
],
116+
},
117+
};
118+
});
119+
}).as('suggestParameters');
120+
121+
cy.wait('@suggestParameters');
122+
123+
// Check main UI elements are present
124+
cy.get('[data-test-subj="detectorNameTextInputFlyout"]').should('exist');
125+
});
96126

97127
it('should create detector successfully', () => {
98128
cy.get('button[aria-label="OpenSearch assistant trigger button"]', {

0 commit comments

Comments
 (0)