Repository navigation
Run generated browser samples with Playwright - #5312
Conversation
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 5312PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 5312"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-5312/packages --name skiasharp-pr-5312More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-5312 |
📊 SkiaSharp benchmarks — PR #5312⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS
Highlights⏱️ Time — 🔴 81 slower · 🟢 5 faster
Full per-OS benchmark deltasLinux⏱️ Time (vs 🌙 nightly
Windows⏱️ Time (vs 🌙 nightly
macOS⏱️ Time (vs 🌙 nightly
|
2dcdea3 to
9b143ba
Compare
Add named Web, BrowserWASM, and Blazor CPU/GPU runtime facts, strict stable-image references, and retained browser diagnostics. Supply the actual BrowserWASM sample's native project dependency and recognize its app-host address without moving product packages into the runner. Keep browser installation an explicit local/CI prerequisite. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Reuse Basic and Docker runtime wrappers and the shared sample image comparer. Replace custom image extraction and duplicate browser tests with full-page Chromium screenshots and console-error checks. Add user-approved local-first Mac page references from the exact 1628893 package cohort. Use a GPU-only normalized mean RGBA error bound of 6%, measured against 24 actual animated frames and white/black/dark controls. Preserve the foundation's 0.075% differing-pixel rule elsewhere and document the uniform-dark smoke-test limitation. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Restore the existing HTTP health and PNG response checks against the container's reviewed image golden. Remove the Chromium image-viewer screenshot and its host-qualified reference; retain Playwright only for actual Web, BrowserWASM and Blazor UIs. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Restore WebSampleReturnsImage with its HTTP status, content type and 512x512 PNG golden checks. Keep WebSamplePageRenders as an independent Playwright console-error and full-page screenshot fact, sharing the existing sample build/run helper. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Retain short golden captures while allowing sample callbacks to navigate, wait, capture multiple screenshots and use Playwright Page for interactions. Keep owned lifecycle, error checks and shared comparison, and trim the maintainer guide to setup and usage rather than investigation history. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Introduce RunBrowserSample around the existing owned server/browser lifecycle, remove Capture, and return screenshot paths for explicit SampleImage.ValidateFile calls. Preserve golden policies and browser errors. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Log browser events directly, retain all console/page errors across operations, and assert after navigation, waits, screenshots and callback completion. Remove Record and duplicate browser.log; add multi-error and page-error regressions and short readability comments. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Expose HostApp on BrowserRunningApp, use host-owned diagnostics and instance RequestUri with cached address resolution, and preserve origin/query validation. Update instance regressions and host-wrapper checks. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Move version-matched browser installation into a CI-only pre-test target, removing duplicated pipeline setup. Keep local installation explicit and trim the maintainer guide to essential setup and diagnostics. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Add explicit framework and test-owned MSBuild property overloads while preserving default build/run behavior and ordinary referenced library targets. Keep framework diagnostics distinct and reject overrides of helper-owned properties. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Expected references can share the actual capture basename or already be attached by an earlier capture. Prefix their attachment names so mismatches report their real differing pixels instead of an xUnit duplicate-name exception. Preserve the pixel thresholds and attachment size limit. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 22da25a5-a573-4363-bc2a-7b56234b665e
Select Uno's declared browser target, verify actual CPU rendering and navigation, draw repeatable colored strokes and clear both drawing pages. Add reviewed Mac captures for the new scenarios and actual Linux/Windows CI captures for the existing browser pages, keeping strict and animated-GPU comparison policies unchanged. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Use actual producing build 1632425 captures from source 80980e. Map frames through named test results, retain settled cleared-button state, and verify exact pixel parity across four attempts per platform. No scene, threshold or skip changes. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Use one options-based signature for file validation, saved-image validation and golden comparison. Keep strict default pixel thresholds, the explicit animated GPU allowance, dimensions and diagnostic attachments unchanged. Cover option forwarding, immutable reuse, invalid limits and existing comparison boundaries. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Align the shared options contract with the Gallery layer without changing lower-layer pixel budgets. Options own the default differing-pixel limit and explicit limits are range checked. Cover exact budget boundaries and unchanged defaults. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Explain expected dimensions, differing-pixel fractions and the alternative normalized mean RGBA metric beside the options properties. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Validate files or save supplied bytes then validate the file. Decode once for dimensions and golden comparison; assert PNG response format in the HTTP scenarios. Preserve diagnostic snapshots with distinct attachment names for repeated comparisons. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Keep repeated attachment snapshots uniquely named in the shared attachment helper instead of SampleImage. Preserve existing attachment limits, expected-image prefixes and image comparison behavior. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Centralize the signature assertion instead of repeating it in HTTP scenarios, retaining the supplied bytes on disk before validation fails. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Review actual build 1632678 captures against local Mac baselines. All four captures per page match exactly; differences are text rendering rather than scene geometry or layout. BrowserWASM image interior is unchanged. Retain strict pixel thresholds and actual sample scenes. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Preserve merged grouped CI and caller-configured templates. Classify browser page and error-regression tests as Host, retain build/infrastructure classification, and pass the selected group to the CI browser prerequisite so only Host or unfiltered runs install Chromium. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
d096c95 to
ed31872
Compare
Replace growing Build, Run and BuildSample overloads with one shared DotNetOptions record. Retain Release and command-specific timeout defaults, private caches, framework selection, diagnostics and callback cleanup. Forward additional properties consistently and allow explicit working-directory and wait-timeout selection. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Keep generated-build, Console, and HTTP cases in BasicSampleTests. Move browser sample execution and error regression cases to BrowserSampleTests, sharing the existing basic sample preparation helper without changing run groups or image validation. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Keep SampleTestBase and BasicSampleTestBase in the sample test project root and its matching namespace. Leave execution helpers and fixtures in Utils. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Combine Basic and Gallery compilation in SampleBuildTests while retaining separate runtime classes. Use one root-level SampleTestBase with folder-parameterized execution, and keep image options in their own file without changing comparison policy. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Keep RunBrowserSample on SampleTestBase with explicit relative folders and normalize separators in RunSample. Separate Uno browser facts and framework-specific startup/readiness from ordinary web tests; share the existing pixel-count assertion through SampleImage without changing image policy. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Separate Docker image-build coverage from container execution while sharing one collection fixture, preserving cached images and serial resource ownership. Use explicit Run names for host/browser classes and retain typed execution groups. Add a fixture-sharing regression check and document the class organization. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Rename the .NET-specific base to DotNetSampleTestBase. Add DockerSampleTestBase for flat context staging and build/run orchestration; keep the shared Docker fixture responsible for daemon checks, image caching, container execution, and resource cleanup. Reuse existing tree-copy helpers rather than imposing a shared inheritance contract on different workspace lifetimes. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Use a focused Docker wrapper for captured CLI execution and checked commands. Keep daemon policy, cached image ownership, container callbacks, and cleanup in DockerSampleFixture; route sample context builds and running-app operations through the wrapper. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Expose Docker.Ps, Build, Run, Info and container/image operations instead of raw argument execution. Keep command syntax and timeout defaults private to the CLI wrapper; fixtures, sample bases, and running applications call operation methods. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
Remove assembly-wide parallelization suppression. Serialize browser classes together and retain Docker's collection-owned image cache, allowing independent collections to run concurrently. Keep ordinary xUnit class/theory-row serialization and add a regression check for the scoped policy. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 69d588ee-ed83-4294-b04b-53579cb8ed43
A visible canvas can still be empty while the raster interop module loads. Wait for the sample's first opaque pixel before capturing the existing golden image, and exercise delayed module initialization as a regression. The delayed case fails with the old condition and passes with pixel readiness. Normal initialization, infrastructure/discovery tests, and the unfiltered Console solution pass locally. Related to mono#5312; observed while validating mono#5352. The earliest introduction of the readiness gap is not established by the current refactored-file blame.
A visible canvas can still be empty while the raster interop module loads. Wait for the sample's first opaque pixel before capturing the existing golden image, and exercise delayed module initialization as a regression. The delayed case fails with the old condition and passes with pixel readiness. Normal initialization, infrastructure/discovery tests, and the unfiltered Console solution pass locally. Related to #5312; observed while validating #5352. The earliest introduction of the readiness gap is not established by the current refactored-file blame.
Description
Exercise generated Basic Web, BrowserWASM, Blazor CPU/GPU/Drawing and Uno CPU/Drawing samples using Playwright. Samples consume one exact producing package cohort; the runner remains source-backed. Published head
54e7bc8ca451cc5f3393582ff7b87b4c2ba55c22is based on canonical main085a3a619c1af059a022a41f0718c195bdac753d.BrowserSampleTestsowns the browser facts and console/page-error regressions.BasicSampleTestsretains generated-build, Console and HTTP cases, with a minimal shared preparation base. BrowserRunningApp owns the browser lifetime above HostApp; navigation, waits, screenshots and callback completion surface browser errors. Drawing facts exercise real pointer strokes, color/brush selection, clear and CPU return.Image validation has two Validate overloads and documented options; diagnostic bytes are saved and PNG-validated before comparison. Shared attachments have unique names. DotNet uses one optional DotNetOptions record for configuration, framework, properties, timeout and working directory. Build, sample Run and BuildSample each have one method; raw CLI execution is Execute. Release, private caches, diagnostics, standard --framework and callback cleanup are preserved. Run timeout controls address/exit waits, not callback duration.
Canonical caller-configured templates and eight typed Samples jobs remain unchanged. Browser/error-regression tests are Host; builds and pure infrastructure are Build. Chromium installation is CI-only for Host or unfiltered runs; local installation remains explicit. No legacy deletion, Gallery/Fiddle UI, Appium/device/native, root-only restore, SDK/workload or scene-clock changes.
Related issues
Related to #5308 and #5291; includes merged #5341 and #5339 through main. Extraction source #5291
f7640ff545bf366881a61f276920e6409fd543e0.Required skia PR
None.
Areas affected
binding/)externals/skia/src/c,include/c)Changes
None to public product API/ABI or sample rendering.
Seven named browser facts use actual samples with 1280×900, scale 1, light captures. Nine reviewed references per host retain strict 0.075% differing pixels, zero channel tolerance. Only animated Blazor GPU uses the 6% mean RGBA smoke allowance, replacing the pixel criterion; uniform dark output may pass. No masks, frozen clocks, tolerance weakening or expanded skips. Playwright 1.55.0 is explicit prerequisite setup, not fixture/discovery download.
Core/legacy goldens, Integration/MSBuild suites and website workflow are untouched. Before/after product screenshots do not apply. Updated references are reviewed actual platform captures with four-attempt parity, not copied cross-platform baselines.
Testing
Full exact-head CI passed. Build 1633132,
4.156.0-pr.5312.26513.7, completed succeeded at 2026-10-13 09:30:20 UTC. Producing merged3499e87432647caaffcf150dff237902429042ahas parents canonical main085a3a619c1af059a022a41f0718c195bdac753dand published source54e7bc8ca451cc5f3393582ff7b87b4c2ba55c22. All 121 GitHub checks succeeded; four website checks were policy-skipped. Managed/native/core/interop/packages/MSBuild and all eight Samples jobs passed.Each Samples job ran
dotnet cake --target=samples --verbosity=normal --configuration=Release --runGroup=<group> --sampleRunId=<host>_<group-lowercase>through the canonical template. Completed runner logs report:Every scheduled group had zero failures and zero skips. Host includes the actual browser sample facts and browser-error regressions. No timeout, skip or tolerance workaround was added.
Local class-split checks, current head:
Passed: source/required-analyzer build (two existing warnings), 78 selected tests/zero failures/zero skips, and discovery of 30 Basic/browser rows including 12 browser rows without inherited duplicate tests. Discovery is diagnostic, not a runtime gate.
Options validation before the class-only split, source
a38c2f2a8a8717cdca4bfe07730034c920c8784b:dotnet test tests/SkiaSharp.Tests.Samples/SkiaSharp.Tests.Samples.csproj -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 -- --filter-trait Category=Infrastructure --report-trx --results-directory output/logs/testlogs/samples/dotnet-options119 passed/zero failures/zero skips on Mac ARM64. Covers options defaults, copying, argument/property ownership, working directory, address/exit timeout and cleanup, referenced-library TFM isolation, diagnostics, attachments and image policies. The current-head full grouped CI supersedes this narrower proof.
Local cohort 1628893 source
a4a9680d7623cf83a6b45aa10dfadfb8b52d2571: SkiaSharp 4.156.0-pr.5291.26508.18/HarfBuzzSharp 14.4.0.100-pr.5291.26508.18/matching natives. Runner SDK 10.0.401; consumer inherited PATH SDK 11.0.100-rc.1.26425.128. No reset/reacquisition.dotnet test tests/SkiaSharp.Tests.Samples.slnx -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 -- --report-trxwas not run locally at current head; the complete canonical grouped CI passed instead. PR remains draft; no merge/readiness/stack changes.Checklist
Changesabove lists all public API and behavioral changes (or "None.")///documentation and regenerated bindings when applicablemono/skiaPR linked above and bindings regeneratedConditional public-API/native items do not apply.