extract tenant-dialog helper & improve forecaster list test robustness - #1823
Merged
Conversation
kaituo
requested review from
CCongWang,
Hailong-am,
SuZhou-Joe,
ananzh,
ashwin-pc,
kavilla,
ohltyler,
peterzhuamazon,
prudhvigodithi,
raintygao,
ruanyl,
tianleh,
wanglam,
xluo-aws,
yubonluo,
yujin-emma and
zhongnansu
as code owners
August 7, 2025 03:04
This PR:
* Create `cy.handleTenantDialog` custom command to handle the optional **"Select your tenant"** pop-up.
* Refactor `forecaster_list_spec.js` and `createForecaster` helper to leverage the new command, reducing duplicate code.
* Introduce explicit waits (`cy.contains('Loading OpenSearch Dashboards').should('not.exist')`, `cy.wait(500)`) and additional `cy.log` statements to handle cases where the home page loads slowly, improving stability and aiding debugging.
* Replace thrown error during action-menu retries with a `cy.log` to enable fallback logic in future enhancements.
* Implement fallback logic to use **"Stop forecasting"** when the **"Cancel forecast"** modal
does not appear, covering both *Initializing* and *Running* forecast states.
Signed-off-by: Kaituo Li <kaituo@amazon.com>
amitgalitz
reviewed
Aug 7, 2025
| } | ||
| }); | ||
| // tenant dialog can appear at any time, so we need to handle it between each clicks | ||
| cy.handleTenantDialog(); |
Member
There was a problem hiding this comment.
we can't wait for it to show up and then confirm and it shouldn't show up again?
Contributor
Author
There was a problem hiding this comment.
We can do it. Since I cannot reproduce the issue locally, should I commit the change you suggested, wait for another test run in jenkis, and check if things get fixed?
Member
There was a problem hiding this comment.
I am good with either, just seems like it can be more deterministic, locally if it passes with my suggestions thats also a good sign
Contributor
Author
There was a problem hiding this comment.
Discussed with Amit offline, he is ok keep things as it is.
amitgalitz
approved these changes
Aug 7, 2025
ohltyler
approved these changes
Aug 7, 2025
kaituo
force-pushed
the
forecasterList
branch
2 times, most recently
from
August 7, 2025 22:56
4917e9f to
cd673b0
Compare
Signed-off-by: Kaituo Li <kaituo@amazon.com>
yubonluo
approved these changes
Aug 8, 2025
opensearch-trigger-bot Bot
pushed a commit
that referenced
this pull request
Aug 8, 2025
#1823) * extract tenant-dialog helper & improve forecaster list test robustness This PR: * Create `cy.handleTenantDialog` custom command to handle the optional **"Select your tenant"** pop-up. * Refactor `forecaster_list_spec.js` and `createForecaster` helper to leverage the new command, reducing duplicate code. * Introduce explicit waits (`cy.contains('Loading OpenSearch Dashboards').should('not.exist')`, `cy.wait(500)`) and additional `cy.log` statements to handle cases where the home page loads slowly, improving stability and aiding debugging. * Replace thrown error during action-menu retries with a `cy.log` to enable fallback logic in future enhancements. * Implement fallback logic to use **"Stop forecasting"** when the **"Cancel forecast"** modal does not appear, covering both *Initializing* and *Running* forecast states. Signed-off-by: Kaituo Li <kaituo@amazon.com> * check if deleted detector matches of of known existing one Signed-off-by: Kaituo Li <kaituo@amazon.com> --------- Signed-off-by: Kaituo Li <kaituo@amazon.com> Co-authored-by: yuboluo <yubonluo@amazon.com> (cherry picked from commit 5397438)
opensearch-trigger-bot Bot
pushed a commit
that referenced
this pull request
Aug 8, 2025
#1823) * extract tenant-dialog helper & improve forecaster list test robustness This PR: * Create `cy.handleTenantDialog` custom command to handle the optional **"Select your tenant"** pop-up. * Refactor `forecaster_list_spec.js` and `createForecaster` helper to leverage the new command, reducing duplicate code. * Introduce explicit waits (`cy.contains('Loading OpenSearch Dashboards').should('not.exist')`, `cy.wait(500)`) and additional `cy.log` statements to handle cases where the home page loads slowly, improving stability and aiding debugging. * Replace thrown error during action-menu retries with a `cy.log` to enable fallback logic in future enhancements. * Implement fallback logic to use **"Stop forecasting"** when the **"Cancel forecast"** modal does not appear, covering both *Initializing* and *Running* forecast states. Signed-off-by: Kaituo Li <kaituo@amazon.com> * check if deleted detector matches of of known existing one Signed-off-by: Kaituo Li <kaituo@amazon.com> --------- Signed-off-by: Kaituo Li <kaituo@amazon.com> Co-authored-by: yuboluo <yubonluo@amazon.com> (cherry picked from commit 5397438)
yubonluo
added a commit
that referenced
this pull request
Aug 8, 2025
#1823) (#1832) * extract tenant-dialog helper & improve forecaster list test robustness This PR: * Create `cy.handleTenantDialog` custom command to handle the optional **"Select your tenant"** pop-up. * Refactor `forecaster_list_spec.js` and `createForecaster` helper to leverage the new command, reducing duplicate code. * Introduce explicit waits (`cy.contains('Loading OpenSearch Dashboards').should('not.exist')`, `cy.wait(500)`) and additional `cy.log` statements to handle cases where the home page loads slowly, improving stability and aiding debugging. * Replace thrown error during action-menu retries with a `cy.log` to enable fallback logic in future enhancements. * Implement fallback logic to use **"Stop forecasting"** when the **"Cancel forecast"** modal does not appear, covering both *Initializing* and *Running* forecast states. * check if deleted detector matches of of known existing one --------- (cherry picked from commit 5397438) Signed-off-by: Kaituo Li <kaituo@amazon.com> Co-authored-by: Kaituo Li <kaituo@amazon.com> Co-authored-by: yuboluo <yubonluo@amazon.com>
kaituo
added a commit
to kaituo/opensearch-dashboards-functional-test
that referenced
this pull request
Aug 10, 2025
opensearch-project#1823) * extract tenant-dialog helper & improve forecaster list test robustness This PR: * Create `cy.handleTenantDialog` custom command to handle the optional **"Select your tenant"** pop-up. * Refactor `forecaster_list_spec.js` and `createForecaster` helper to leverage the new command, reducing duplicate code. * Introduce explicit waits (`cy.contains('Loading OpenSearch Dashboards').should('not.exist')`, `cy.wait(500)`) and additional `cy.log` statements to handle cases where the home page loads slowly, improving stability and aiding debugging. * Replace thrown error during action-menu retries with a `cy.log` to enable fallback logic in future enhancements. * Implement fallback logic to use **"Stop forecasting"** when the **"Cancel forecast"** modal does not appear, covering both *Initializing* and *Running* forecast states. Signed-off-by: Kaituo Li <kaituo@amazon.com> * check if deleted detector matches of of known existing one Signed-off-by: Kaituo Li <kaituo@amazon.com> --------- Signed-off-by: Kaituo Li <kaituo@amazon.com> Co-authored-by: yuboluo <yubonluo@amazon.com>
1 task
yubonluo
added a commit
that referenced
this pull request
Aug 10, 2025
* extract tenant-dialog helper & improve forecaster list test robustness (#1823) * extract tenant-dialog helper & improve forecaster list test robustness This PR: * Create `cy.handleTenantDialog` custom command to handle the optional **"Select your tenant"** pop-up. * Refactor `forecaster_list_spec.js` and `createForecaster` helper to leverage the new command, reducing duplicate code. * Introduce explicit waits (`cy.contains('Loading OpenSearch Dashboards').should('not.exist')`, `cy.wait(500)`) and additional `cy.log` statements to handle cases where the home page loads slowly, improving stability and aiding debugging. * Replace thrown error during action-menu retries with a `cy.log` to enable fallback logic in future enhancements. * Implement fallback logic to use **"Stop forecasting"** when the **"Cancel forecast"** modal does not appear, covering both *Initializing* and *Running* forecast states. Signed-off-by: Kaituo Li <kaituo@amazon.com> * check if deleted detector matches of of known existing one Signed-off-by: Kaituo Li <kaituo@amazon.com> --------- Signed-off-by: Kaituo Li <kaituo@amazon.com> Co-authored-by: yuboluo <yubonluo@amazon.com> * test: improve resilience in forecast tests - In `daily_forecaster_spec.js`, after clicking the “Start test” button, wait for the “Initializing test” message before verifying “Test complete” to ensure previous messages have cleared and avoid race conditions. - In `forecaster_list_spec.js`: • Preemptively set the tenant to “global” via localStorage within `onBeforeLoad` when visiting `/`—this avoids the non-deterministic “Select your tenant” popup. • Removed multiple scattered calls to `cy.handleTenantDialog()`, relying on tenant pre-setting instead. • Increased UI rendering wait from 500 ms to 2000 ms for menu visibility. - In `forecaster_list_spec_mock.js`: • Applied the same “global” tenant override on page load to avoid the popup. - In `commands.js`: • Added `typeInEuiCombo(testSubj, value)` Cypress command to reliably enter text into EUI combo boxes by clicking the wrapper, typing into the actual input, and asserting the resulting pill—this reduces flakiness compared to typing directly in the wrapper. • Updated `createForecaster()` to use `typeInEuiCombo` for both `indicesFilter` and `timestampFilter`. Signed-off-by: Kaituo Li <kaituo@amazon.com> --------- Signed-off-by: Kaituo Li <kaituo@amazon.com> Co-authored-by: yuboluo <yubonluo@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR:
cy.handleTenantDialogcustom command to handle the optional "Select your tenant" pop-up.forecaster_list_spec.jsandcreateForecasterhelper to leverage the new command, reducing duplicate code.cy.contains('Loading OpenSearch Dashboards').should('not.exist'),cy.wait(500)) and additionalcy.logstatements to handle cases where the home page loads slowly, improving stability and aiding debugging.cy.logto enable fallback logic in future enhancements.does not appear, covering both Initializing and Running forecast states.
Issues Resolved
opensearch-project/anomaly-detection-dashboards-plugin#1072
Check List
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.