Skip to content

tests: Dashboard.Ui bUnit component tests (Phase 1 of #126) - #132

Merged
blehnen merged 1 commit into
masterfrom
tests/dashboard-ui-bunit-playwright
Apr 21, 2026
Merged

tests: Dashboard.Ui bUnit component tests (Phase 1 of #126)#132
blehnen merged 1 commit into
masterfrom
tests/dashboard-ui-bunit-playwright

Conversation

@blehnen

@blehnen blehnen commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 1 of #126 — adds bUnit 2.5.3 and 18 component tests covering Razor components that were sitting at 0% coverage.

Coverage added

Component Tests What's exercised
Pages/Login.razor 4 sign-in render, ?error=1 alert, no-error default, auth-disabled redirect
Layout/MainLayout.razor 5 auth-disabled render, authenticated render, logout visibility, unauthenticated redirect to /login
Shared/HistoryTab.razor 6 loads on init, purge button visibility matrix, error-alert on load failure, expand control for exception rows
Pages/Home.razor 3 single-source redirect, source-not-found alert, multi-source grouped view

Shared BunitTestBase registers MudBlazor services + loose JSInterop; RenderWithMudProvider<T>() wraps components that need MudPopoverProvider in the render tree (MudSelect / MudTable internals).

Test plan

  • dotnet build — clean on net10.0 + net8.0
  • dotnet test Source/DotNetWorkQueue.Dashboard.Ui.Tests — 66/66 passing on both TFMs (48 existing + 18 new)
  • Jenkins matrix green on this PR

Phase 2 (incoming on this branch)

  • New DotNetWorkQueue.Dashboard.Ui.E2E.Tests project with Playwright + WebApplicationFactory
  • 2-3 smoke flows (login → drill down → History expand; auth-disabled path)
  • New Jenkins stage 15 using mcr.microsoft.com/playwright/dotnet image

Marked draft until Jenkins is green and Phase 2 lands.

🤖 Generated with Claude Code

Adds bUnit 2.5.3 + 18 component tests covering the Razor components
called out in the issue's acceptance criteria:

- Login.razor (4 tests): sign-in render, error-query-param alert,
  no-error-default, auth-disabled redirect to root.
- MainLayout.razor (5 tests): renders when auth disabled, renders when
  authenticated, logout button visibility, unauthenticated redirect
  to /login.
- HistoryTab.razor (6 tests): loads on init, purge-button visibility
  (readonly + zero-records), writable+has-records shows purge,
  error-alert on load failure, expand control for exception rows.
- Home.razor (3 tests): single-source redirect, source-not-found
  alert, multi-source grouped view.

Shared BunitTestBase registers MudBlazor services and a loose
JSInterop mode; RenderWithMudProvider<T>() wraps components that
require MudPopoverProvider (MudSelect, MudTable, etc.) in the render
tree.

Phase 2 (Playwright E2E on a new Jenkins stage) will follow in a
separate commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Apr 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.91%. Comparing base (392c9ab) to head (a6c1a67).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #132      +/-   ##
==========================================
+ Coverage   89.63%   89.91%   +0.28%     
==========================================
  Files         993      993              
  Lines       29297    29297              
  Branches     2369     2369              
==========================================
+ Hits        26259    26343      +84     
+ Misses       2194     2120      -74     
+ Partials      844      834      -10     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blehnen
blehnen marked this pull request as ready for review April 21, 2026 20:16
@blehnen
blehnen merged commit 958d3b7 into master Apr 21, 2026
4 checks passed
@blehnen
blehnen deleted the tests/dashboard-ui-bunit-playwright branch April 21, 2026 20:16
blehnen added a commit that referenced this pull request Apr 21, 2026
Captures four findings from PRs #132 / #133:
- Microsoft.Playwright.MSTest pins MSTest 2.x — use raw Microsoft.Playwright
- WebApplicationFactory + Playwright is a dead end on Blazor Server
- Blazor Server OnAfterRender redirects race the SignalR circuit in E2E
- Jenkins 'docker' label means agent IS a container (no docker-in-docker)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
blehnen added a commit that referenced this pull request Jul 21, 2026
Reconciliation finished: the Codecov/badge gap is NOT a pipeline defect.
Codecov excludes partially-covered lines from hits; ReportGenerator
counts them as covered. 867 partial lines on master account for the
entire ~2.5 point difference (87.45% vs 90.04% on identical denominators).

Master build #132 was fully green with all 24 coverage inputs merged and
still read 87.45%, which rules out the stale-upload and missing-stage
theories recorded earlier in this doc.

Coverage also did not erode gradually. Removing Dashboard.Ui (1,303 lines
at 23.6%) from today's totals reproduces the historical figure exactly
(29,066/32,282 = 90.04%), so one untested Blazor project accounts for the
whole decline from the 90.25% Codecov reported in 2024.

Changes:
- Codecov is now documented as the authoritative number (it gates PRs).
- project status: auto/2% -> auto/0%. Coverage may rise or stay flat but
  never drop below the parent commit. The old 2% slack is what let the
  number drift down unnoticed, since auto rebaselines every merge.
- Documented that reaching 90% requires Dashboard.Ui specifically, and
  that partial lines are a cheaper secondary lever.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant