Skip to content

test: cover the unmarshalled (WASM) data channel - #373

Open
damyanpetev wants to merge 3 commits into
masterfrom
dpetev/unmarshalled-coverage
Open

test: cover the unmarshalled (WASM) data channel#373
damyanpetev wants to merge 3 commits into
masterfrom
dpetev/unmarshalled-coverage

Conversation

@damyanpetev

Copy link
Copy Markdown
Member

Noticed in #365 that the unmarshalled data paths are not covered. Started with a WASM-hosted e2e scenarios, but sadly there's no coverage support for that so ended up also doubling that in unit tests.

Motivation / Context

Until now no suite exercised the unmarshalled data channel: the TestBed is Server-hosted (data rides JsonDataSource) and the bUnit harness deliberately forces JSON marshalling. Two recent regressions in UnmarshalledDataSource shipped undetected because of that gap. This PR covers the channel from both ends, with both suites driving the same shared data shapes (ComboDataScenarios).

Browser e2e (ComboDataTest, NUnit + Playwright)

  • The TestBed gains an InteractiveWebAssembly render mode via a new IgniteUI.Blazor.Lite.TestBed.Client project; the existing Server sweep is unchanged (render mode moved from Routes to per-page).
  • New /combo-data page (WASM, prerender off) renders an IgbCombo with the scenario from the query string; tests drive mutations/swaps through a DotNetObjectReference exposed as window.clientPageRef (static DotNet.invokeMethodAsync throws when a page hosts a second .NET runtime).
  • Scenarios assert on the live web component's data — typed fields (int/double/bool/long/string/DateTime), nullable fields preserving nulls, nested objects, primitive collections, ObservableCollection add/remove/replace/clear, full data swap, and selection with no ValueKey round-tripping the same .NET instances back through the change event.
  • Requires app.MapStaticAssets() (WASM boot assets) and the Microsoft.AspNetCore.Components.WebAssembly* packages.

In-process unit twin (UnmarshalledDataChannelTests, xUnit + bUnit)

RendererMessageInteropHarness gains a non-forced-JSON mode: the service's runtime is a decorator whose InvokeUnmarshalled method RuntimeHelper discovers by reflection (the seam replacing the API modern runtimes removed), so DataSourceManager genuinely selects UnmarshalledDataSource and every column message is recorded for assertion. The facts mirror the e2e scenarios against the emitted UnmarshalledColumns (typed values, NullValues flags, dotted nested paths, ___id, mutation messages — a replace crosses as remove + insert; clear carries no columns). Runs on all TFMs and, unlike the browser suite, registers in code coverage. The pointer transport and the JS-side reader remain covered by the e2e suite only.

Suppressed test (both suites)

NestedPublicFields_Transfer* pins items whose nested type has public primitive-typed fields. Ignored/skipped: such types currently crash schema creation (JsonDataSourceSchema.Commit stores typed field getters in a Func<object, object>[]ArrayTypeMismatchException; the property arrays already use Delegate[]). Enable once that fix lands — on master the nested-field loop bound (sized from the root schema) also needs the fix from the nullable-annotations PR.

Verification

  • e2e: 7 passed / 1 ignored — and all scenarios time out (red) against the pre-fix nullable-branch code, confirming they guard the channel.
  • Unit: 969 passed / 22 skipped on net8.0, net9.0, net10.0.
  • Run: dotnet test tests\IgniteUI.Blazor.Lite.IntegrationTests --settings .runsettings --filter "FullyQualifiedName~ComboDataTest" (settings required — serializes workers on the fixed port) and dotnet test tests\IgniteUI.Blazor.Tests --filter "FullyQualifiedName~UnmarshalledDataChannel".

Note: browser-executed .NET is invisible to the VSTest coverage collector (no tooling supports WASM coverage today), so UnmarshalledDataSource coverage comes from the unit twin; e2e owns behavior including the JS reader.

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

Adds coverage for the WebAssembly “unmarshalled” data-transfer channel used by Ignite UI Blazor data sources (previously unexercised due to Server-hosted TestBed and bUnit forcing JSON marshalling). This closes the testing gap that allowed regressions in UnmarshalledDataSource to ship undetected, by validating the channel both in-browser (Playwright) and in-process (bUnit) using shared scenario data shapes.

Changes:

  • Introduces a WASM-rendered TestBed client page (/combo-data) plus Playwright e2e tests asserting on the live web component data.
  • Adds an in-process xUnit/bUnit “twin” suite that records unmarshalled column messages via a runtime decorator that exposes InvokeUnmarshalled.
  • Shares scenario definitions between e2e and unit tests, and wires up solution/projects/packages to support Interactive WebAssembly render mode in the TestBed.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/IgniteUI.Blazor.Tests/UnmarshalledDataChannelTests.cs New bUnit suite asserting unmarshalled column messages for shared scenarios.
tests/IgniteUI.Blazor.Tests/Interop/RendererMessageInteropHarness.cs Adds optional non-forced-JSON mode and an InvokeUnmarshalled recording runtime wrapper.
tests/IgniteUI.Blazor.Tests/IgniteUI.Blazor.Tests.csproj Links shared ComboDataScenarios.cs into the unit test project.
tests/IgniteUI.Blazor.Lite.TestBed/wwwroot/app.js Adds registerClientPageRef for Playwright to invoke JSInvokable hooks on WASM pages.
tests/IgniteUI.Blazor.Lite.TestBed/Program.cs Enables Interactive WebAssembly render mode and maps static assets needed for WASM boot.
tests/IgniteUI.Blazor.Lite.TestBed/IgniteUI.Blazor.Lite.TestBed.csproj Adds WebAssembly.Server package + references the new client project.
tests/IgniteUI.Blazor.Lite.TestBed/Components/Routes.razor Extends Router discovery to include the client project assembly pages.
tests/IgniteUI.Blazor.Lite.TestBed/Components/Pages/Home.razor Moves InteractiveServer render mode to the page level.
tests/IgniteUI.Blazor.Lite.TestBed/Components/App.razor Removes global render mode so pages can choose Server vs WASM rendering.
tests/IgniteUI.Blazor.Lite.TestBed.Client/Program.cs New WASM client host setup for the TestBed’s InteractiveWebAssembly mode.
tests/IgniteUI.Blazor.Lite.TestBed.Client/Pages/ComboDataPage.razor New WASM scenario page hosting IgbCombo and JSInvokable hooks for e2e.
tests/IgniteUI.Blazor.Lite.TestBed.Client/IgniteUI.Blazor.Lite.TestBed.Client.csproj New Blazor WebAssembly project targeting net10.0.
tests/IgniteUI.Blazor.Lite.TestBed.Client/ComboDataScenarios.cs Shared scenario data shapes (typed, nullable, nested, observable, primitive collection).
tests/IgniteUI.Blazor.Lite.TestBed.Client/_Imports.razor Client project imports for render modes, JS interop, and Ignite UI controls.
tests/IgniteUI.Blazor.Lite.IntegrationTests/ComboDataTest.cs New Playwright integration test suite covering unmarshalled behavior end-to-end.
IgniteUI.Blazor.Lite.slnx Adds the new TestBed client project to the solution.
Directory.Packages.props Adds package versions for WebAssembly and WebAssembly.Server dependencies.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/IgniteUI.Blazor.Lite.TestBed.Client/Pages/ComboDataPage.razor
Comment thread tests/IgniteUI.Blazor.Lite.IntegrationTests/ComboDataTest.cs
@damyanpetev damyanpetev added the squash-merge Merge PR with "Squash and Merge" option label Aug 28, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squash-merge Merge PR with "Squash and Merge" option 🧪 ci: tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants