Skip to content

Commit adcc396

Browse files
vikhy-awsopensearch-ci-bot
authored andcommitted
Fix alerting dashboards multi-index update tests failing without security (#2125)
Break the Cypress command chain between .type() and .trigger('blur') in the "to have multiple indices" tests. Typing {enter} into the index combo box triggers a React re-render that detaches the input element, causing the chained .trigger('blur') to fail with a stale DOM reference. Re-querying the element with cy.get('#index') after the type command ensures Cypress operates on the newly-rendered input. Resolves opensearch-project/alerting-dashboards-plugin#1492 Signed-off-by: Vikhyat Khare <kvikhy@amazon.com> (cherry picked from commit 46edba2) Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com>
1 parent bdbc224 commit adcc396

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,11 @@ describe('Bucket-Level Monitors', () => {
353353
.click({ force: true })
354354
.type(`${TESTING_INDEX_A}{enter}${TESTING_INDEX_B}{enter}`, {
355355
force: true,
356-
})
357-
.trigger('blur', { 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
360+
cy.get('#index').trigger('blur', { force: true });
358361

359362
// Confirm Index field only contains the expected text
360363
cy.get('[data-test-subj="indicesComboBox"]').contains('*', {

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,11 @@ describe('Query-Level Monitors', () => {
227227
.click({ force: true })
228228
.type(`${TESTING_INDEX_A}{enter}${TESTING_INDEX_B}{enter}`, {
229229
force: true,
230-
})
231-
.trigger('blur', { 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
234+
cy.get('#index').trigger('blur', { force: true });
232235

233236
// Confirm Index field only contains the expected text
234237
cy.get('[data-test-subj="indicesComboBox"]').contains('*', {

0 commit comments

Comments
 (0)