test: cover the unmarshalled (WASM) data channel - #373
Open
damyanpetev wants to merge 3 commits into
Open
Conversation
20 tasks
Contributor
There was a problem hiding this comment.
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 componentdata. - 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inUnmarshalledDataSourceshipped 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)IgniteUI.Blazor.Lite.TestBed.Clientproject; the existing Server sweep is unchanged (render mode moved fromRoutesto per-page)./combo-datapage (WASM, prerender off) renders anIgbCombowith the scenario from the query string; tests drive mutations/swaps through aDotNetObjectReferenceexposed aswindow.clientPageRef(staticDotNet.invokeMethodAsyncthrows when a page hosts a second .NET runtime).data— typed fields (int/double/bool/long/string/DateTime), nullable fields preserving nulls, nested objects, primitive collections,ObservableCollectionadd/remove/replace/clear, full data swap, and selection with noValueKeyround-tripping the same .NET instances back through the change event.app.MapStaticAssets()(WASM boot assets) and theMicrosoft.AspNetCore.Components.WebAssembly*packages.In-process unit twin (
UnmarshalledDataChannelTests, xUnit + bUnit)RendererMessageInteropHarnessgains a non-forced-JSON mode: the service's runtime is a decorator whoseInvokeUnmarshalledmethodRuntimeHelperdiscovers by reflection (the seam replacing the API modern runtimes removed), soDataSourceManagergenuinely selectsUnmarshalledDataSourceand every column message is recorded for assertion. The facts mirror the e2e scenarios against the emittedUnmarshalledColumns (typed values,NullValuesflags, 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.Commitstores typed field getters in aFunc<object, object>[]→ArrayTypeMismatchException; the property arrays already useDelegate[]). 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
dotnet test tests\IgniteUI.Blazor.Lite.IntegrationTests --settings .runsettings --filter "FullyQualifiedName~ComboDataTest"(settings required — serializes workers on the fixed port) anddotnet 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
UnmarshalledDataSourcecoverage comes from the unit twin; e2e owns behavior including the JS reader.