The GitHub Actions job "Required Checks" on texera.git/main has failed.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
8acc6c1486e136ced7cf90acee2b4eee103967ac / Meng Wang <[email protected]>
test(frontend): stabilize flaky Plotly chart tests (UserQuota, 
WorkflowExecutionHistory) (#6542)

### What changes were proposed in this PR?

Fixes flaky chart tests in two frontend specs that mocked
`plotly.js-basic-dist-min` at the module level (`vi.mock`) to assert the
Plotly
calls:
- `user-quota.component.spec.ts` — `generatePieChart` /
`generateLineChart` (added in #6524)
- `workflow-execution-history.component.spec.ts` — `charts
(ngAfterViewInit)`

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 '…' exists on the page.`. The
tests passed
on macOS but failed on ubuntu/windows (a flaky failure now on `main`).
The
`workflow-execution-history` mock also tripped a vitest "`vi.mock` … is
not at
the top level … will become an error in a future version" warning.

Both are fixed the same way — drop the module mock and render into a
real DOM
element, then assert on the `data` / `layout` Plotly attaches to each
graph div:
- `user-quota`: each chart test appends a `<div id="…">`, then reads the
graph div.
- `workflow-execution-history`: the fixture is attached to
`document.body` in
`setup()` so `ngAfterViewInit`'s charts resolve their target divs by id.

This is deterministic across platforms and also clears the hoist
warning. No
production code was changed.

### Any related issues, documentation, discussions?

Closes #6541 (follow-up to #6524).

### How was this PR tested?

Both specs run locally in `frontend/` (all green; the failure path was
verified
for each by breaking a chart 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)
ng test --watch=false --include 
src/app/dashboard/component/user/user-workflow/ngbd-modal-workflow-executions/workflow-execution-history.component.spec.ts
# Test Files 1 passed (1) | Tests 46 passed (46)   (and the vi.mock hoist 
warning is gone)
prettier --write <specs>   # clean
eslint  <specs>            # clean
```

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.8 [1M context])

Report URL: https://github.com/apache/texera/actions/runs/29670421201

With regards,
GitHub Actions via GitBox

Reply via email to