Skip to content

Commit f1844dc

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

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,48 @@ const testSuggestAD = (url) => {
182182
);
183183
}
184184
});
185+
186+
// Test interval input
187+
cy.get('[data-test-subj="detectionInterval"]').clear().type('15');
188+
189+
// Test window delay input
190+
cy.get('[data-test-subj="windowDelay"]').clear().type('5');
191+
192+
// Mock the create detector API call
193+
cy.intercept('POST', 'w/*/api/anomaly_detectors/detectors/*', (req) => {
194+
req.reply({
195+
statusCode: 200,
196+
body: {
197+
ok: true,
198+
response: {
199+
id: 'test-detector-id',
200+
},
201+
},
202+
});
203+
}).as('createDetector');
204+
205+
// Mock the start detector API call
206+
cy.intercept(
207+
'POST',
208+
'w/*/api/anomaly_detectors/detectors/test-detector-id/start/*',
209+
(req) => {
210+
req.reply({
211+
statusCode: 200,
212+
body: {
213+
ok: true,
214+
response: {
215+
_id: 'test-detector-id',
216+
},
217+
},
218+
});
219+
}
220+
).as('startDetector');
221+
222+
// Click create button
223+
cy.contains('button', 'Create detector').click();
224+
cy.wait('@createDetector');
225+
cy.contains('Detector created').should('be.visible');
226+
cy.wait('@startDetector');
185227
});
186228

187229
it('should create detector successfully', () => {

0 commit comments

Comments
 (0)