Repository navigation
Description
Task Summary
workflow-execution-history.component.html has 25 uncovered template lines at 78.86 %, while its component class sits at 93.43 %. The spec is mature — 46 it() blocks — but calls detectChanges() only four times, so it exercises the handlers directly and almost never renders the markup that invokes them. Its spec does not call TestBed.overrideComponent, so template coverage attributes normally and the gap is genuinely reachable.
Pure EXTEND. Vitest/jsdom; see frontend/TESTING.md and frontend/AGENTS.md.
Behavior to add
Execution-history template (frontend/src/app/dashboard/component/user/user-workflow/ngbd-modal-workflow-executions/workflow-execution-history.component.html, codecov 78.86 % — EXTEND workflow-execution-history.component.spec.ts)
The mechanics throughout: fixture.detectChanges() after every state change, query with fixture.debugElement.query(By.css(...)) and fire .triggerEventHandler(...) instead of calling the handler on the instance, and seed the rows/state each *ngIf and *ngFor needs so its arm renders.
- Search-criteria panel (43–58) — one contiguous help block that only appears when the criteria popover is open: the criteria list (execution name,
user:John,status:…), the double-quote note, and the worked example. Open the panel, render, and assert the list items and example text are present. Static markup — no async. - Search input (31) — the
[(ngModel)]="executionSearchValue"binding, exercised by typing into the rendered input. - Bulk actions (80, 89, 116–117) —
setBookmarked(), thenzOnConfirmon group delete (onGroupDelete()), and the header checkbox's(nzCheckedChange)="onAllChecked($event)"/[(nzChecked)]="checked". Cover checking and unchecking all. - Sortable headers (128, 137) —
(click)="onHit(column, i)"on both header cells; fire the click and assert the sort state changed rather than callingonHitdirectly. - Per-row controls (153, 158, 166, 185, 230, 244) — the row checkbox
(nzCheckedChange)="onItemChecked(row, $event)", the bookmark toggle(click)="onBookmarkToggle(row)", the[avatar]="row.avatar"binding, entering rename mode viaworkflowExecutionsIsEditingName.push(i),showRuntimeStatistics(row.eId, row.cuId), and the delete confirmation(nzOnConfirm)="onDelete(row)". Seed at least two rows so the*ngForexpands and the index-based rename push is meaningful.
Determinism notes — this component renders Plotly charts, and its tests were flaky once before (fixed in #6542):
- Do NOT
vi.mock("plotly.js-basic-dist-min"). Module-level Plotly mocking is unreliable across the CI matrix — if another spec loads the module first the mock does not apply, realPlotly.newPlotruns, and it throwsNo DOM element with id '…'.vi.spyOn(Plotly, "newPlot")also fails (ESM namespace not configurable). - Instead follow test(frontend): stabilize flaky Plotly chart tests (UserQuota, WorkflowExecutionHistory) #6542: attach the fixture to
document.bodyso the chart's target div resolves by id, let real Plotly render, and assert on thedata/layoutPlotly attaches to the graph div. - Do not assert on
DatePipe-rendered timestamps — a fixed epoch renders a different day under a UTC runner. Rendering them is fine; asserting the text is not. - No layout or geometry assertions —
getBoundingClientRect/scrollHeightreturn zeros under jsdom. fixture.destroy()inafterEachso any@UntilDestroysubscription stops, andvi.restoreAllMocks()so spies do not leak. Clone row fixtures per test, since rename and bookmark handlers mutate rows in place.- Stub the HTTP layer with
HttpClientTestingModuleand flush synchronously.
Note #7752 is open and touches this component's spec — rebase before finishing.
Task Type
- Refactor / Cleanup
- DevOps / Deployment / CI
- Testing / QA
- Documentation
- Performance
- Other
Activity
test(frontend): render the execution-history table instead of calling…