Skip to content

test(frontend): render ConsoleFrameComponent template branches for coverage - #7333

Open
mengw15 wants to merge 2 commits into
apache:mainfrom
mengw15:chore/7329-console-frame-template-test
Open

test(frontend): render ConsoleFrameComponent template branches for coverage#7333
mengw15 wants to merge 2 commits into
apache:mainfrom
mengw15:chore/7329-console-frame-template-test

Conversation

@mengw15

@mengw15 mengw15 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Extends the ConsoleFrameComponent spec so its template actually renders,
covering the .component.html branches the class-level tests never exercised
(frontend/src/app/workspace/component/result-panel/console-frame/). The class
was already well covered; only the template was low. No production code changed.

Path note: the component lives under result-panel/console-frame/, not the
console-frame/ path the issue lists.

+4 tests, each seeding component state then calling detectChanges() so the
template executes:

  • One row per console message — the *ngFor list, the collapse panel (non-empty
    message) vs the plain-title branch (empty message), and the source / timestamp /
    worker tags. Only the message that carries a workerId renders the worker tag.
  • The source and timestamp tags disappear when showSource / showTimestamp are
    toggled off (the *ngIf false arms).
  • The debug input group is absent when consoleInputEnabled is false and present
    when true; clicking each of the four action buttons reaches its handler, and
    pressing enter in the command input submits the command through the websocket.

Per the component's determinism constraints:

  • the timestamp cell is rendered through the | date pipe but its formatted
    string is not asserted (it is timezone-dependent under a UTC CI runner) —
    the assertions check the tag's presence and other cell text instead;
  • no fake timers are introduced for the ngAfterViewChecked auto-scroll
    setTimeout (a synchronous test body never lets it fire), and nothing asserts
    on layout/geometry (scrollHeight etc., which are zero under jsdom).

Any related issues, documentation, discussions?

Closes #7329

How was this PR tested?

Extended unit tests, run locally in frontend/ (all green; the failure path was
verified by breaking an assertion to confirm the suite goes red):

ng test --watch=false --include src/app/workspace/component/result-panel/console-frame/console-frame.component.spec.ts
# Test Files 1 passed (1) | Tests 23 passed (23)
prettier --write <spec>   # clean
eslint  <spec>            # clean

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

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

@mengw15
mengw15 requested a lite review from Copilot August 5, 2026 11:12
@mengw15 mengw15 self-assigned this Aug 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Extends ConsoleFrameComponent unit tests to render and exercise template branches (*ngFor, *ngIf, click handlers, and command input submission) that were previously untested, improving coverage without changing production code.

Changes:

  • Added template-rendering tests covering message rows, collapse vs plain title branches, and conditional tags (source/timestamp/worker).
  • Added tests for toggling showSource / showTimestamp off to hit *ngIf false branches.
  • Added tests for debug input group presence/absence and basic button/cmd wiring when enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Assert the ALL_WORKERS broadcast reaches every worker id (the test set
  targetWorker=ALL_WORKERS but only checked w-0, missing w-1).
- Assert the collapse-message-header element exists before reading its text.
- Pass null (not {}) to triggerEventHandler — the handlers don't read the event.
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Aug 5, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.49%. Comparing base (0f2cd49) to head (e4e68bb).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7333      +/-   ##
============================================
+ Coverage     83.36%   83.49%   +0.13%     
  Complexity     4128     4128              
============================================
  Files          1166     1166              
  Lines         46428    46428              
  Branches       5174     5174              
============================================
+ Hits          38705    38767      +62     
+ Misses         6003     5941      -62     
  Partials       1720     1720              
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 0f2cd49
agent-service 83.65% <ø> (ø) Carriedforward from 0f2cd49
amber 80.65% <ø> (ø) Carriedforward from 0f2cd49
computing-unit-managing-service 43.60% <ø> (ø) Carriedforward from 0f2cd49
config-service 65.97% <ø> (ø) Carriedforward from 0f2cd49
file-service 69.05% <ø> (ø) Carriedforward from 0f2cd49
frontend 84.33% <ø> (+0.30%) ⬆️
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 0f2cd49
pyamber 97.36% <ø> (ø) Carriedforward from 0f2cd49
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 0f2cd49

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mengw15
mengw15 requested a review from aglinxinyuan August 5, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extend ConsoleFrameComponent template coverage

3 participants