Skip to content

Commit 70e9aac

Browse files
vikhy-awsopensearch-ci-bot
authored andcommitted
Fix failing alerting tests (#2129)
Signed-off-by: vikhy-aws <191836418+vikhy-aws@users.noreply.github.com> (cherry picked from commit 744b2dc) Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com>
1 parent 31219c6 commit 70e9aac

2 files changed

Lines changed: 14 additions & 18 deletions

File tree

cypress/integration/plugins/alerting-dashboards-plugin/bucket_level_monitor_spec.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,13 @@ describe('Bucket-Level Monitors', () => {
348348
// Wait for page to load
349349
cy.contains('Select data');
350350

351-
// Click on the Index field and type in multiple index names to replicate the bug
352-
cy.get('#index')
353-
.click({ force: true })
354-
.type(`${TESTING_INDEX_A}{enter}${TESTING_INDEX_B}{enter}`, {
355-
force: true,
356-
});
357-
358-
// Re-query the element before triggering blur since typing {enter}
359-
// causes a React re-render that detaches the original input element
351+
// Click on the Index field and type in multiple index names to replicate the bug.
352+
// Each step re-queries the element because clicking triggers an async fetch
353+
// of remote indexes, and each {enter} causes a React re-render that detaches
354+
// the original input element from the DOM.
355+
cy.get('#index').click({ force: true });
356+
cy.get('#index').type(`${TESTING_INDEX_A}{enter}`, { force: true });
357+
cy.get('#index').type(`${TESTING_INDEX_B}{enter}`, { force: true });
360358
cy.get('#index').trigger('blur', { force: true });
361359

362360
// Confirm Index field only contains the expected text

cypress/integration/plugins/alerting-dashboards-plugin/query_level_monitor_spec.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,13 @@ describe('Query-Level Monitors', () => {
222222
// Wait for page to load
223223
cy.contains('Select data');
224224

225-
// Click on the Index field and type in multiple index names to replicate the bug
226-
cy.get('#index')
227-
.click({ force: true })
228-
.type(`${TESTING_INDEX_A}{enter}${TESTING_INDEX_B}{enter}`, {
229-
force: true,
230-
});
231-
232-
// Re-query the element before triggering blur since typing {enter}
233-
// causes a React re-render that detaches the original input element
225+
// Click on the Index field and type in multiple index names to replicate the bug.
226+
// Each step re-queries the element because clicking triggers an async fetch
227+
// of remote indexes, and each {enter} causes a React re-render that detaches
228+
// the original input element from the DOM.
229+
cy.get('#index').click({ force: true });
230+
cy.get('#index').type(`${TESTING_INDEX_A}{enter}`, { force: true });
231+
cy.get('#index').type(`${TESTING_INDEX_B}{enter}`, { force: true });
234232
cy.get('#index').trigger('blur', { force: true });
235233

236234
// Confirm Index field only contains the expected text

0 commit comments

Comments
 (0)