mengw15 opened a new pull request, #6542:
URL: https://github.com/apache/texera/pull/6542

   ### What changes were proposed in this PR?
   
   Fixes two flaky tests introduced in #6524
   
(`frontend/src/app/dashboard/component/user/user-quota/user-quota.component.spec.ts`,
   the `generatePieChart` / `generateLineChart` cases).
   
   They mocked `plotly.js-basic-dist-min` at the module level (`vi.mock(...)`) 
to
   assert the call arguments. That interception is **not reliable across the CI
   matrix** — when another spec loads the module first, the mock does not apply,
   the real `Plotly.newPlot` runs, and it throws
   `No DOM element with id 'pieDiv' exists on the page.`. The tests passed on 
macOS
   but failed on ubuntu/windows (a flaky failure now on `main`).
   
   The fix drops the module mock and instead renders into a real DOM element: 
each
   test appends a `<div id="…">`, calls the method (real `Plotly.newPlot` 
succeeds
   against jsdom when the target element exists), and asserts on the `data` /
   `layout` that Plotly attaches to the graph div. This is deterministic across
   platforms.
   
   No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6541 (follow-up to #6524).
   
   ### How was this PR tested?
   
   Run locally in `frontend/` (all green; the failure path was verified by 
breaking
   a chart-data assertion to confirm the suite goes red):
   
   ```
   ng test --watch=false --include 
src/app/dashboard/component/user/user-quota/user-quota.component.spec.ts
   # Test Files 1 passed (1) | Tests 11 passed (11)
   prettier --write <spec>   # unchanged
   eslint  <spec>            # clean
   ```
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8 [1M context])
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to