Skip to content

Fix ISM e2e tests for OS 2.5: conditional toast dismiss and failOnStatusCode - #2122

Merged
ruanyl merged 1 commit into
opensearch-project:2.5from
aditi-1601:fix-ism-e2e-2.5
Jul 30, 2026
Merged

Fix ISM e2e tests for OS 2.5: conditional toast dismiss and failOnStatusCode#2122
ruanyl merged 1 commit into
opensearch-project:2.5from
aditi-1601:fix-ism-e2e-2.5

Conversation

@aditi-1601

Copy link
Copy Markdown

Description

Fixes index-management-e2e (test_e2e_ism) failures on OS 2.5.

  • managed_indices_spec.js: replace unconditional toast dismiss calls with a
    conditional dismiss (no failure when no toast is present)
  • indices_spec.js: dismiss overlaying toast before the shrink form input and
    increase targetIndexNameInput timeout to 120s for slower UI load
  • commands.js: deleteAllIndices uses failOnStatusCode: false for robustness

Issues Resolved

[List any issues this PR will resolve]

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…tusCode

Signed-off-by: Aditi Chaudhry <aditiac@amazon.com>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 Multiple PR themes

Sub-PR theme: Make deleteAllIndices robust with failOnStatusCode false

Relevant files:

  • cypress/utils/commands.js

Sub-PR theme: Conditional toast dismiss and increased timeouts for ISM e2e tests

Relevant files:

  • cypress/integration/plugins/index-management-dashboards-plugin/managed_indices_spec.js
  • cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js

⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Make toast dismissal and input entry more robust

The conditional toast-dismiss uses a synchronous $body.find check but the toast may
appear asynchronously, causing flakiness. Consider waiting for the form input to be
visible/enabled first, and also scope the close-button click within $body to avoid
re-querying an already-detached element.

cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js [431-439]

 // Dismiss any toast that may overlay the form
 cy.get('body').then(($body) => {
-  if ($body.find('[data-test-subj="toastCloseButton"]').length) {
-    cy.get('[data-test-subj="toastCloseButton"]').click({ force: true });
+  const $btn = $body.find('[data-test-subj="toastCloseButton"]');
+  if ($btn.length) {
+    cy.wrap($btn).click({ force: true, multiple: true });
   }
 });
 
 // Enter target index name
-cy.get(`input[data-test-subj="targetIndexNameInput"]`, { timeout: 120000 }).type(
-  `${SAMPLE_INDEX}_shrunken`
-);
+cy.get(`input[data-test-subj="targetIndexNameInput"]`, { timeout: 120000 })
+  .should('be.visible')
+  .type(`${SAMPLE_INDEX}_shrunken`);
Suggestion importance[1-10]: 5

__

Why: The suggestion improves robustness by wrapping the already-found element and asserting visibility before typing, which can reduce flakiness. It's a reasonable but moderate improvement.

Low
Avoid silently swallowing all request errors

Setting failOnStatusCode: false silently swallows all errors including auth/network
failures, which can mask real issues in cleanup. Consider allowing only expected
status codes (e.g., 404 when no indices match) rather than accepting any status
code.

cypress/utils/commands.js [101-107]

 cy.request({
   method: 'DELETE',
   url: `${Cypress.env(
     'openSearchUrl'
   )}/index*,sample*,opensearch_dashboards*,test*,cypress*`,
   failOnStatusCode: false,
+}).then((response) => {
+  if (response.status >= 400 && response.status !== 404) {
+    throw new Error(`Unexpected delete indices status: ${response.status}`);
+  }
 });
Suggestion importance[1-10]: 4

__

Why: Valid point that failOnStatusCode: false can hide real errors, but for a cleanup step this is often acceptable. The improvement is moderate and could actually add noise if the endpoint returns other benign codes.

Low

@aditi-1601 aditi-1601 changed the title Fix ISM e2e tests for OS 2.5: conditional toast dismiss and failOnStatusCodeenecccfntbgbnchhtrcbvgltlrinlbdugrnnfirrtrrh Fix ISM e2e tests for OS 2.5: conditional toast dismiss and failOnStatusCode Jul 30, 2026
@ruanyl
ruanyl merged commit 9d5e6e6 into opensearch-project:2.5 Jul 30, 2026
19 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants