Add Components.Testing E2E test infrastructure#65958
Conversation
3392836 to
7b418d3
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Microsoft.AspNetCore.Components.Testing package under src/Components/Testing that provides Playwright + xUnit v3 + YARP-based end-to-end testing infrastructure for Blazor apps, including MSBuild-time app discovery/publish support and a source generator/analyzer for cross-process service overrides.
Changes:
- Add a shipping Components.Testing library for launching real app processes behind a YARP proxy and driving real browsers via Playwright.
- Add build-time infrastructure (MSBuild task + transitive props/targets) and a source generator/analyzer for service override validation and startup hook injection.
- Add unit tests plus multiple E2E sample apps/test projects demonstrating render modes, service overrides, published-app execution, tracing, and async-state control.
Reviewed changes
Copilot reviewed 167 out of 168 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Components/Testing/testassets/ServiceOverridesApp/wwwroot/app.css | Styling for ServiceOverridesApp test asset. |
| src/Components/Testing/testassets/ServiceOverridesApp/Services/WeatherForecast.cs | Weather model used by ServiceOverridesApp. |
| src/Components/Testing/testassets/ServiceOverridesApp/Services/IWeatherService.cs | Weather service abstraction for override scenario. |
| src/Components/Testing/testassets/ServiceOverridesApp/Services/DefaultWeatherService.cs | Default weather service implementation (baseline). |
| src/Components/Testing/testassets/ServiceOverridesApp/ServiceOverridesApp.csproj | ServiceOverridesApp test asset project definition. |
| src/Components/Testing/testassets/ServiceOverridesApp/Properties/launchSettings.json | Launch settings for ServiceOverridesApp (dev convenience). |
| src/Components/Testing/testassets/ServiceOverridesApp/Program.cs | Minimal Blazor app bootstrapping for override testing. |
| src/Components/Testing/testassets/ServiceOverridesApp/Components/Routes.razor | Router setup for ServiceOverridesApp. |
| src/Components/Testing/testassets/ServiceOverridesApp/Components/Pages/Weather.razor | Weather page that consumes IWeatherService (override target). |
| src/Components/Testing/testassets/ServiceOverridesApp/Components/Pages/Home.razor | Home page for ServiceOverridesApp. |
| src/Components/Testing/testassets/ServiceOverridesApp/Components/Pages/Counter.razor | Counter page for basic interactivity checks. |
| src/Components/Testing/testassets/ServiceOverridesApp/Components/Layout/MainLayout.razor | Basic layout for ServiceOverridesApp. |
| src/Components/Testing/testassets/ServiceOverridesApp/Components/App.razor | App host HTML for ServiceOverridesApp. |
| src/Components/Testing/testassets/ServiceOverridesApp/Components/_Imports.razor | Razor imports for ServiceOverridesApp. |
| src/Components/Testing/testassets/ServiceOverridesApp/appsettings.json | Default config for ServiceOverridesApp. |
| src/Components/Testing/testassets/ServiceOverridesApp/appsettings.Development.json | Dev config for ServiceOverridesApp. |
| src/Components/Testing/testassets/ServiceOverridesApp.E2E.Tests/Tests/WeatherServiceOverrideTests.cs | E2E tests validating cross-process service override behavior. |
| src/Components/Testing/testassets/ServiceOverridesApp.E2E.Tests/Tests/HomePageTests.cs | Basic navigation + counter E2E coverage for ServiceOverridesApp. |
| src/Components/Testing/testassets/ServiceOverridesApp.E2E.Tests/ServiceOverridesApp.E2E.Tests.csproj | E2E test project wired to Components.Testing + E2EApp reference. |
| src/Components/Testing/testassets/ServiceOverridesApp.E2E.Tests/ServiceOverrides/TestOverrides.cs | Static-method DI override definition for generator/analyzer. |
| src/Components/Testing/testassets/ServiceOverridesApp.E2E.Tests/ServiceOverrides/FakeWeatherService.cs | Deterministic fake service used by override tests. |
| src/Components/Testing/testassets/ServiceOverridesApp.E2E.Tests/Fixtures/E2ETestAssembly.cs | Marker type for locating manifest/test assembly. |
| src/Components/Testing/testassets/ServiceOverridesApp.E2E.Tests/Fixtures/E2ECollection.cs | xUnit collection fixture definition for server lifecycle. |
| src/Components/Testing/testassets/RenderModesApp/wwwroot/app.css | Styling for RenderModesApp test asset. |
| src/Components/Testing/testassets/RenderModesApp/RenderModesApp.csproj | RenderModesApp server project definition. |
| src/Components/Testing/testassets/RenderModesApp/Program.cs | Server app configured for server+WASM render modes. |
| src/Components/Testing/testassets/RenderModesApp/Components/Routes.razor | Router including client assemblies for mixed-mode routing. |
| src/Components/Testing/testassets/RenderModesApp/Components/Pages/Weather.razor | Weather page used to demonstrate stream rendering. |
| src/Components/Testing/testassets/RenderModesApp/Components/Pages/StaticInfo.razor | Static SSR page for non-interactive baseline. |
| src/Components/Testing/testassets/RenderModesApp/Components/Pages/ServerCounter.razor | InteractiveServer counter page. |
| src/Components/Testing/testassets/RenderModesApp/Components/Pages/Home.razor | Home page for RenderModesApp. |
| src/Components/Testing/testassets/RenderModesApp/Components/Layout/NavMenu.razor | Navigation menu spanning multiple render-mode pages. |
| src/Components/Testing/testassets/RenderModesApp/Components/Layout/MainLayout.razor | Layout for RenderModesApp. |
| src/Components/Testing/testassets/RenderModesApp/Components/App.razor | App host HTML including import map and styles. |
| src/Components/Testing/testassets/RenderModesApp/Components/_Imports.razor | Razor imports for RenderModesApp. |
| src/Components/Testing/testassets/RenderModesApp/appsettings.json | Default config for RenderModesApp. |
| src/Components/Testing/testassets/RenderModesApp/appsettings.Development.json | Dev config for RenderModesApp. |
| src/Components/Testing/testassets/RenderModesApp.E2E.Tests/Tests/RenderModeTests.cs | E2E coverage across Static SSR / Server / WASM / Auto. |
| src/Components/Testing/testassets/RenderModesApp.E2E.Tests/RenderModesApp.E2E.Tests.csproj | RenderModesApp E2E test project configuration. |
| src/Components/Testing/testassets/RenderModesApp.E2E.Tests/Fixtures/E2ETestAssembly.cs | Marker type for RenderModesApp test assembly. |
| src/Components/Testing/testassets/RenderModesApp.E2E.Tests/Fixtures/E2ECollection.cs | Collection fixture for RenderModesApp tests. |
| src/Components/Testing/testassets/RenderModesApp.Client/RenderModesApp.Client.csproj | WASM client project for InteractiveWebAssembly/Auto. |
| src/Components/Testing/testassets/RenderModesApp.Client/Program.cs | WASM client host bootstrapping. |
| src/Components/Testing/testassets/RenderModesApp.Client/Pages/WasmCounter.razor | InteractiveWebAssembly counter page. |
| src/Components/Testing/testassets/RenderModesApp.Client/Pages/Counter.razor | InteractiveAuto counter page (client). |
| src/Components/Testing/testassets/RenderModesApp.Client/_Imports.razor | Razor imports for client project. |
| src/Components/Testing/testassets/PublishedApp/wwwroot/app.css | Styling for PublishedApp test asset. |
| src/Components/Testing/testassets/PublishedApp/PublishedApp.csproj | PublishedApp project definition for publish-mode testing. |
| src/Components/Testing/testassets/PublishedApp/Program.cs | PublishedApp server bootstrapping. |
| src/Components/Testing/testassets/PublishedApp/Components/Routes.razor | Router for PublishedApp. |
| src/Components/Testing/testassets/PublishedApp/Components/Pages/Home.razor | Home page for PublishedApp. |
| src/Components/Testing/testassets/PublishedApp/Components/Pages/Counter.razor | Counter page for PublishedApp. |
| src/Components/Testing/testassets/PublishedApp/Components/Layout/MainLayout.razor | Layout for PublishedApp. |
| src/Components/Testing/testassets/PublishedApp/Components/App.razor | App host HTML for PublishedApp. |
| src/Components/Testing/testassets/PublishedApp/Components/_Imports.razor | Razor imports for PublishedApp. |
| src/Components/Testing/testassets/PublishedApp/appsettings.json | Default config for PublishedApp. |
| src/Components/Testing/testassets/PublishedApp/appsettings.Development.json | Dev config for PublishedApp. |
| src/Components/Testing/testassets/PublishedApp.E2E.Tests/Tests/HomePageTests.cs | E2E tests targeting published output execution path. |
| src/Components/Testing/testassets/PublishedApp.E2E.Tests/PublishedApp.E2E.Tests.csproj | E2E project enabling UsePublishedApp=true. |
| src/Components/Testing/testassets/PublishedApp.E2E.Tests/Fixtures/E2ETestAssembly.cs | Marker type for PublishedApp tests. |
| src/Components/Testing/testassets/PublishedApp.E2E.Tests/Fixtures/E2ECollection.cs | Collection fixture for PublishedApp tests. |
| src/Components/Testing/testassets/ObservabilityApp/wwwroot/app.css | Styling for ObservabilityApp. |
| src/Components/Testing/testassets/ObservabilityApp/Properties/launchSettings.json | Launch profile for ObservabilityApp. |
| src/Components/Testing/testassets/ObservabilityApp/Program.cs | ObservabilityApp bootstrapping. |
| src/Components/Testing/testassets/ObservabilityApp/ObservabilityApp.csproj | ObservabilityApp project definition. |
| src/Components/Testing/testassets/ObservabilityApp/Components/Routes.razor | Router for ObservabilityApp. |
| src/Components/Testing/testassets/ObservabilityApp/Components/Pages/Home.razor | Home page for ObservabilityApp. |
| src/Components/Testing/testassets/ObservabilityApp/Components/Pages/Counter.razor | Counter page for tracing/interactivity tests. |
| src/Components/Testing/testassets/ObservabilityApp/Components/Layout/MainLayout.razor | Layout for ObservabilityApp. |
| src/Components/Testing/testassets/ObservabilityApp/Components/App.razor | App host HTML including ResourcePreloader/ImportMap. |
| src/Components/Testing/testassets/ObservabilityApp/Components/_Imports.razor | Razor imports for ObservabilityApp. |
| src/Components/Testing/testassets/ObservabilityApp/appsettings.json | Default config for ObservabilityApp. |
| src/Components/Testing/testassets/ObservabilityApp/appsettings.Development.json | Dev config for ObservabilityApp. |
| src/Components/Testing/testassets/ObservabilityApp.E2E.Tests/Tests/TracingTests.cs | E2E tests validating tracing + artifact behavior. |
| src/Components/Testing/testassets/ObservabilityApp.E2E.Tests/ObservabilityApp.E2E.Tests.csproj | ObservabilityApp E2E test project. |
| src/Components/Testing/testassets/ObservabilityApp.E2E.Tests/Fixtures/E2ETestAssembly.cs | Marker type for ObservabilityApp tests. |
| src/Components/Testing/testassets/ObservabilityApp.E2E.Tests/Fixtures/E2ECollection.cs | Collection fixture for ObservabilityApp tests. |
| src/Components/Testing/testassets/MinimalApp/wwwroot/app.css | Styling for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp/Properties/launchSettings.json | Launch settings for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp/Program.cs | MinimalApp bootstrapping. |
| src/Components/Testing/testassets/MinimalApp/MinimalApp.csproj | MinimalApp project definition. |
| src/Components/Testing/testassets/MinimalApp/Components/Routes.razor | Router for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp/Components/Pages/Home.razor | Home page for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp/Components/Pages/Counter.razor | Counter page for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp/Components/Layout/MainLayout.razor | Layout for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp/Components/App.razor | App host HTML for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp/Components/_Imports.razor | Razor imports for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp/appsettings.json | Default config for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp/appsettings.Development.json | Dev config for MinimalApp. |
| src/Components/Testing/testassets/MinimalApp.E2E.Tests/Tests/HomePageTests.cs | MinimalApp E2E smoke coverage for navigation and interactivity. |
| src/Components/Testing/testassets/MinimalApp.E2E.Tests/MinimalApp.E2E.Tests.csproj | MinimalApp E2E test project. |
| src/Components/Testing/testassets/MinimalApp.E2E.Tests/Fixtures/E2ETestAssembly.cs | Marker type for MinimalApp tests. |
| src/Components/Testing/testassets/MinimalApp.E2E.Tests/Fixtures/E2ECollection.cs | Collection fixture for MinimalApp tests. |
| src/Components/Testing/testassets/Directory.Build.props | Shared MSBuild props for testassets (xUnit v3 + refs). |
| src/Components/Testing/testassets/AsyncStateApp/wwwroot/app.css | Styling for AsyncStateApp. |
| src/Components/Testing/testassets/AsyncStateApp/Services/WeatherForecast.cs | Weather model used by AsyncStateApp. |
| src/Components/Testing/testassets/AsyncStateApp/Services/IWeatherService.cs | Weather service abstraction for async-state gating. |
| src/Components/Testing/testassets/AsyncStateApp/Services/DefaultWeatherService.cs | Default service with async delay for streaming demo. |
| src/Components/Testing/testassets/AsyncStateApp/Program.cs | AsyncStateApp bootstrapping registering weather service. |
| src/Components/Testing/testassets/AsyncStateApp/Components/Routes.razor | Router for AsyncStateApp. |
| src/Components/Testing/testassets/AsyncStateApp/Components/Pages/Weather.razor | Weather page consuming the gated service. |
| src/Components/Testing/testassets/AsyncStateApp/Components/Pages/Home.razor | Home page for AsyncStateApp. |
| src/Components/Testing/testassets/AsyncStateApp/Components/Pages/Counter.razor | Counter page for AsyncStateApp. |
| src/Components/Testing/testassets/AsyncStateApp/Components/Layout/NavMenu.razor | Nav menu for AsyncStateApp. |
| src/Components/Testing/testassets/AsyncStateApp/Components/Layout/MainLayout.razor | Layout for AsyncStateApp. |
| src/Components/Testing/testassets/AsyncStateApp/Components/App.razor | App host HTML for AsyncStateApp. |
| src/Components/Testing/testassets/AsyncStateApp/Components/_Imports.razor | Razor imports for AsyncStateApp. |
| src/Components/Testing/testassets/AsyncStateApp/AsyncStateApp.csproj | AsyncStateApp project definition. |
| src/Components/Testing/testassets/AsyncStateApp.E2E.Tests/Tests/PrerenderingTests.cs | E2E tests using ResourceLock to validate prerender/loading. |
| src/Components/Testing/testassets/AsyncStateApp.E2E.Tests/Tests/EnhancedNavTests.cs | E2E tests for enhanced navigation detection helper. |
| src/Components/Testing/testassets/AsyncStateApp.E2E.Tests/Tests/AsyncStateTests.cs | E2E tests using TestLockClient to gate async data. |
| src/Components/Testing/testassets/AsyncStateApp.E2E.Tests/ServiceOverrides/TestOverrides.cs | Override wiring for lockable weather service. |
| src/Components/Testing/testassets/AsyncStateApp.E2E.Tests/ServiceOverrides/LockableWeatherService.cs | Lock-aware deterministic IWeatherService implementation. |
| src/Components/Testing/testassets/AsyncStateApp.E2E.Tests/Fixtures/E2ETestAssembly.cs | Marker type for AsyncStateApp tests. |
| src/Components/Testing/testassets/AsyncStateApp.E2E.Tests/Fixtures/E2ECollection.cs | Collection fixture for AsyncStateApp tests. |
| src/Components/Testing/testassets/AsyncStateApp.E2E.Tests/AsyncStateApp.E2E.Tests.csproj | AsyncStateApp E2E test project. |
| src/Components/Testing/test/TestLockProviderTests.cs | Unit coverage for TestLockProvider semantics. |
| src/Components/Testing/test/ServerStartOptionsTests.cs | Unit coverage for ServerStartOptions behavior. |
| src/Components/Testing/test/ServerInstanceTests.cs | Unit coverage for instance key computation. |
| src/Components/Testing/test/SanitizeFileNameTests.cs | Unit coverage for artifact directory name sanitization. |
| src/Components/Testing/test/PlaywrightExtensionsTests.cs | Unit coverage for context option helpers (server routing/artifacts). |
| src/Components/Testing/test/Microsoft.AspNetCore.Components.Testing.Tests.csproj | Test project for Components.Testing library + generator. |
| src/Components/Testing/test/GlobalUsings.cs | Global using for xUnit in unit test project. |
| src/Components/Testing/test/E2EManifestTests.cs | Unit coverage for E2EManifest JSON load/deserialize. |
| src/Components/Testing/tasks/Microsoft.AspNetCore.Components.Testing.Tasks.csproj | MSBuild tasks project for manifest generation. |
| src/Components/Testing/tasks/GenerateE2EManifest.cs | Task that emits per-test-assembly E2E app manifest JSON. |
| src/Components/Testing/tasks/E2EManifestModel.cs | JSON model used by MSBuild task serialization. |
| src/Components/Testing/tasks/E2EManifestJsonContext.cs | Source-gen JSON context for task-side serialization. |
| src/Components/Testing/src/PublicAPI.Unshipped.txt | Public API declarations for new Components.Testing package. |
| src/Components/Testing/src/PublicAPI.Shipped.txt | Shipped API baseline (new package). |
| src/Components/Testing/src/Microsoft.AspNetCore.Components.Testing.csproj | Shipping package project including generator + tasks + targets/props. |
| src/Components/Testing/src/Infrastructure/TracingSession.cs | Trace/video lifecycle management tied to test outcome. |
| src/Components/Testing/src/Infrastructure/TracedContext.cs | Wrapper combining IBrowserContext + TracingSession lifetime. |
| src/Components/Testing/src/Infrastructure/TestSessionContext.cs | Scoped service populated from test-session cookie. |
| src/Components/Testing/src/Infrastructure/TestServiceOverrideObserver.cs | DiagnosticListener observer applying service overrides after app services. |
| src/Components/Testing/src/Infrastructure/TestReadinessHostingStartup.cs | HostingStartup registering infra + service override hookup. |
| src/Components/Testing/src/Infrastructure/TestLockProvider.cs | Server-side async gating primitive. |
| src/Components/Testing/src/Infrastructure/TestLockClient.cs | Client helper for session cookies + lock handles. |
| src/Components/Testing/src/Infrastructure/TestInfrastructureStartupFilter.cs | Middleware for session cookie ingestion + lock release endpoint. |
| src/Components/Testing/src/Infrastructure/ServerStartOptions.cs | User-facing options for starting app instances. |
| src/Components/Testing/src/Infrastructure/ServerInstance.cs | External process launcher + readiness handshake + dedupe keying. |
| src/Components/Testing/src/Infrastructure/ServerFixture.cs | xUnit v3 fixture hosting YARP proxy and managing app instances. |
| src/Components/Testing/src/Infrastructure/ResourceLock.cs | Playwright route interceptor used to hold resources (e.g., blazor.web.js). |
| src/Components/Testing/src/Infrastructure/ReadinessNotificationService.cs | App-side callback when ApplicationStarted fires. |
| src/Components/Testing/src/Infrastructure/PlaywrightExtensions.cs | Core Playwright helper extensions (routing, artifacts, waits, tracing). |
| src/Components/Testing/src/Infrastructure/ParentProcessWatcher.cs | App-side background service to stop when test host dies. |
| src/Components/Testing/src/Infrastructure/IE2EServiceOverrideResolver.cs | Interface for generated resolver to avoid reflection on overrides. |
| src/Components/Testing/src/Infrastructure/E2EPublishedApp.cs | Manifest model for published execution details. |
| src/Components/Testing/src/Infrastructure/E2EManifestJsonContext.cs | Source-gen JSON context for runtime manifest deserialization. |
| src/Components/Testing/src/Infrastructure/E2EManifest.cs | Runtime manifest loading from test output folder. |
| src/Components/Testing/src/Infrastructure/E2EAppEntry.cs | Runtime manifest app entry model. |
| src/Components/Testing/src/Infrastructure/AsyncLock.cs | Disposable lock handle that POSTs release to app endpoint. |
| src/Components/Testing/gen/StartupHookGenerator.cs | Source generator emitting startup hook + resolver mapping. |
| src/Components/Testing/gen/ServiceOverrideCallsite.cs | Generator model for discovered ConfigureServices callsites. |
| src/Components/Testing/gen/ServiceOverrideAnalyzer.cs | Analyzer enforcing override signature/constant method-name rules. |
| src/Components/Testing/gen/Microsoft.AspNetCore.Components.Testing.Generators.csproj | Generator/analyzer project definition. |
| src/Components/Testing/gen/DiagnosticDescriptors.cs | Diagnostic descriptors for E2E00x analyzer errors/warnings. |
| src/Components/Testing/eng/targets/Microsoft.AspNetCore.Components.Testing.targets | Transitive targets to publish apps + generate manifest on build. |
| src/Components/Testing/eng/targets/Microsoft.AspNetCore.Components.Testing.props | Default MSBuild properties for E2E test projects. |
| src/Components/Testing/Directory.Build.props | Local Directory.Build.props import for Components/Testing subtree. |
| src/Components/Components.slnf | Add Components.Testing projects to Components solution filter. |
| NuGet.config | Add nuget.org package source (repo-wide restore behavior change). |
| eng/Versions.props | Add versions for xUnit v3, Playwright xUnit v3, YARP, NSubstitute, etc. |
| eng/Dependencies.props | Register new package references for Components.Testing dependencies. |
| AspNetCore.slnx | Add Components.Testing projects into the main solution graph. |
All done in f48e0b6 and 2dae107. All 6 test apps (MinimalApp, ObservabilityApp, PublishedApp, RenderModesApp, ServiceOverridesApp, AsyncStateApp) + 6 E2E test projects have been combined into:
All CSS/styles removed. Poll-click patterns replaced with |
4b5698e to
a1b70d7
Compare
|
@copilot fix the version conflicts |
Fixed in 3371e0c. |
Migrate blazor-e2e testing infrastructure into aspnetcore under src/Components/Testing. This provides a reusable framework for Blazor end-to-end testing using Playwright and xUnit v3. - Core library (src): ServerFixture, ServerInstance, E2EManifest, BrowserContextExtensions for YARP-proxied test orchestration - Source generator (gen): auto-generates hosting startup assemblies - MSBuild tasks (tasks): GenerateE2EManifest for build integration - MSBuild props/targets (eng): build-time E2E app discovery and optional publish support - Unit tests (test): 76 tests covering all infrastructure components - 6 E2E test apps covering minimal, render modes, service overrides, published apps, observability, and async state scenarios (29 E2E tests total, all passing)
Replace MinimalApp, ObservabilityApp, PublishedApp, RenderModesApp, ServiceOverridesApp, and AsyncStateApp (plus their E2E test projects) with a single combined TestApp + TestApp.Client + TestApp.E2E.Tests. The combined app covers all render modes (Static SSR, InteractiveServer, InteractiveWebAssembly, InteractiveAuto), service overrides, async state control via TestLockClient, enhanced navigation, prerendering, and tracing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
…combine testassets, remove NSubstitute, nuget.org Agent-Logs-Url: https://github.com/dotnet/aspnetcore/sessions/220550bd-51df-4f48-8c73-ab14b0277ffd Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
…m Dependencies.props Agent-Logs-Url: https://github.com/dotnet/aspnetcore/sessions/79753880-6337-4f37-9b2f-82b58e1a35f5 Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
… Arcade - Components.slnf: replace 16 stale testasset entries with 3 combined TestApp projects (CodeCheck was failing on missing slnf references) - Testing.Tests.csproj: add custom RunTests target for xUnit v3 (UsingToolXUnit=false prevented Arcade's RunTests from being defined) - testassets/Directory.Build.props: set IsTestProject=false at the end so Arcade skips E2E projects during regular CI, while keeping the conditional blocks above that set up references and the generator Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
99e8818 to
ba69342
Compare
…mblies.props - package-lock.json: reset to main and regenerate to fix encoding/iconv-lite mismatch from stale rebase resolution - ProjectReferences.props/ShippingAssemblies.props: add Microsoft.AspNetCore.Components.Testing (CodeCheck validation) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Testing.Tests.csproj and TestApp.E2E.Tests.csproj: change ProjectReference to Reference for Microsoft.AspNetCore.Components.Testing (ResolveReferences.targets enforces Reference for shipping assemblies) - package-lock.json: use main's lockfile (PR has no npm changes; the previous regeneration dropped optional 'encoding' package that npm ci requires) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix WaitForEnhancedNavigationAsync to properly dispose IJSHandle - WithServerRouting: merge into existing ExtraHTTPHeaders instead of replacing - ResourceLock: only hold first match, ContinueAsync subsequent matches - RemoteLock: URL-encode lock key with Uri.EscapeDataString - GenerateE2EManifest: null-guard Path.GetDirectoryName result - Remove unused id parameter from CreateMockServerInstance test helper - TracingSession: clarify conservative save docs when TestState is null - Unify E2EAppEntry model: replace ProjectPath+Published with Executable/Arguments/WorkingDirectory - Remove E2EPublishedApp (no longer needed with unified model) - Update tests for new model and header preservation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t workingDirectory - Dev mode: use 'dotnet run --no-launch-profile' with workingDirectory set to project directory (no --project flag that breaks content root) - Published mode: workingDirectory now includes 'e2e-apps/<name>' prefix from manifest - ServerInstance: simply uses Path.Combine(AppContext.BaseDirectory, entry.WorkingDirectory) - no hardcoded e2e-apps - Updated tests for new manifest format Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Follow the FunctionalTestWithAssets.targets pattern so that e2e-apps and the manifest flow into the Helix payload: - Hook AfterTargets='Build;Publish' instead of just Build - Use PublishDir when publishing, fall back to OutputPath for build - Updated header docs to describe Helix mode Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace UsePublishedApp with E2EAppMode that supports three modes: - build (default): copies project source to e2e-apps/<name>/ for dotnet run - publish: publishes app to e2e-apps/<name>/ for native exe - all: both — source in e2e-apps/<name>/, published in e2e-apps/publish/<name>/ During Publish (Helix), source is copied and paths are relative. During Build (local dev), manifest uses absolute paths (no copies). Inner target _CopyE2EAppSource handles per-project source copy with bin/obj exclusion. In 'all' mode, manifest emits two entries per app: <name> (source) and <name>.Published (published exe). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reframe all comments to describe Build vs Publish behavior rather than mentioning Helix by name. The package has no Helix-specific logic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The published app entry in the manifest now uses 'publish/<name>' as the key, matching the directory structure (e2e-apps/publish/<name>/). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace _CopyE2EAppSource inner target with inline ItemGroup + Copy task. The E2EAppName metadata on the collected files handles per-project destination routing without needing MSBuild batching via a separate target. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add E2EAppsRelativeDir MSBuild property (default: 'e2e-apps') in props - Pass it to GenerateE2EManifest task alongside E2EAppsOutputDir - Task uses E2EAppsRelativeDir for manifest paths instead of hardcoding - Collapse publishRelativeDir/publishAbsoluteDir into single subPath Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cover all 3 modes (build/publish/all) in both Build and Publish scenarios. Also test custom E2EAppsRelativeDir, multiple apps, and PublicUrl metadata flow-through. 10 new tests, 88 total. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds
Microsoft.AspNetCore.Components.Testing— a Playwright + xUnit v3 + YARP-based E2E testing library for Blazor that handles process management, readiness detection, proxy routing, interactivity awareness, tracing, and cross-process service overrides.Description
Core library (
src/Components/Testing/src/):ServerFixture<T>— xUnit v3 collection fixture; manages a YARP proxy and a pool of app processesServerInstance— launches the app as a real external process (dotnet runor published executable), unified viaBuildProcessStartInfo(); environment variables collected with explicit precedence (infrastructure → manifest → user options)PlaywrightExtensions—WaitForInteractiveAsync,WaitForBlazorAsync,WaitForEnhancedNavigationAsync,NewTracedContextAsync; artifact root overridable viaE2E_ARTIFACTS_DIRRemoteLock/TestLockClient— deterministic async-state control; gates server-side data behind HTTP-released locksResourceLock— intercepts Playwright network requests (e.g. holdblazor.web.js) to assert prerender content before Blazor startsReadinessNotificationService— app signals readiness via HTTP POST with exponential-backoff retry (5 attempts)Source generator + analyzer (
src/Components/Testing/gen/):StartupHook+[assembly: HostingStartup]into test assemblies for zero-app-change service injectionE2E001/E2E002/E2E003for invalidConfigureServicescallsites at compile timeIsAnalyzersProject=true,Nullable=enableMSBuild tasks + props/targets (
src/Components/Testing/tasks/,eng/):GenerateE2EManifestMSBuild task produces a JSON manifest of E2E app projects at build time.targetshandles only NuGet package layout; dev paths set intestassets/Directory.Build.propsUsePublishedApp=truetriggers publish + manifest with executable detailsUnit tests (
src/Components/Testing/test/): 76 tests covering manifest generation, server instance key computation, generator output, analyzer diagnostics, and Playwright extension helpers.Single combined test app (
testassets/TestApp+TestApp.Client+TestApp.E2E.Tests):WaitForInteractiveAsyncinstead of poll-click loopsVersion/dependency hygiene:
nuget.orgfromNuGet.config; packages need to be mirrored via internal feedsNSubstitute(no longer used),xunit.runner.visualstudio, andMicrosoft.NET.Test.SdkfromDependencies.props(not needed by xUnit v3 projects;NSubstituteVersionwas already removed fromVersions.propsleaving an empty version)XunitV3Version,MicrosoftPlaywrightXunitV3Version,YarpReverseProxyVersionadded toVersions.props