Fix reportsDashboards edit spec flakiness with API intercepts - #2112
Conversation
Add cy.intercept() helpers for the GET and PUT reportDefinitions API calls so the edit page tests wait for network responses before asserting UI state. The previous implementation clicked without waiting, causing intermittent "before all" hook failures when the edit page had not fully loaded. Fixes: opensearch-project/dashboards-reporting#785 Signed-off-by: sumukhswamy <sumukhhs@amazon.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
…#2118) Add cy.intercept() helpers for the GET and PUT reportDefinitions API calls so the edit page tests wait for network responses before asserting UI state. The previous implementation clicked without waiting, causing intermittent "before all" hook failures when the edit page had not fully loaded. Fixes: opensearch-project/dashboards-reporting#785 (cherry picked from commit 04be670) Signed-off-by: sumukhswamy <sumukhhs@amazon.com> Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com> Co-authored-by: Sumukh Swamy <sumukhhs@amazon.com>
Summary
Fixes intermittent failures in the
reportsDashboardsintegration test (02-edit.spec.js) caused by the edit page tests clicking and asserting UI state without waiting for the underlying API responses.Changes:
REPORT_DEFINITION_APIconstant for the reportDefinitions endpoint patternsetupEditIntercepts()— registerscy.interceptfor GET and PUT on the report definition APIopenEditPage()— clicks into the edit page and waits for@getReportDefinitionbefore assertingclickSaveChanges()— clicks Save and waits for@updateReportDefinitionwith status 200 assertion.should('be.checked')assertions after radio button interactionsRoot cause: Tests were clicking without waiting for API responses, causing the "before all" hook to fail when the edit page hadn't loaded yet.
Fixes: opensearch-project/dashboards-reporting#785
Test plan
reportsDashboardsintegration tests pass on 3.8.0 without-security