docs(web): add Testing guide [SDC-31986] - #407
Merged
Merged
Conversation
Adds a Web Testing page (docs/sdks/web/testing.md), linked in the Web sidebar next to Agent Skills. Companion to the iOS (#378) and Android (#377) guides. Covers isolating the SDK behind your own abstraction, testing with the SDK's own types directly (no mocking framework needed on Web, unlike iOS/Android, since the public types are plain TS classes/interfaces), and integration testing the real pipeline two ways: the built-in ImageFrameSource (bypasses the camera entirely) and @eatsjobs/media-mock (mocks getUserMedia when the code under test drives the camera itself). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ce mapping Adds the verified page.route gate (Playwright's addInitScript does not block the page's own script), the reusable mockCameraStream fixture, and the mediaMockDevice per-project mapping for testing across browser engines and form factors (media-mock ships iPhone 12, Samsung Galaxy M53, and Mac Desktop). All match the real, passing implementation in BarcodeCaptureSimpleSample (data-capture-sdk!37490). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Reflects what BarcodeCaptureSimpleSample's e2e/ actually ships now: mocking wrapped in a MediaMockFacade class instead of a bare fixture function, and the test.describe/beforeEach/afterEach structure. Drops the page.route/scanditTestMediaMockReady gate now that @eatsjobs/media-mock@2.0.2 fixes the underlying setSource race internally.
The e2e/ Playwright setup isn't part of what gets published to the public sample mirror, so don't claim a browsable GitHub path for it.
…wright hardening Broaden the isolation example to mirror Android/iOS's pattern, restore the missing ID Capture unit-test example, and align setupScanner with the real BarcodeCaptureSimpleSample sequence. Add guidance for enabling WebGL and multithreading under Playwright, and note Chromium's built-in fake-video-file option ahead of introducing media-mock. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.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.
Adds a Web Testing page (
docs/sdks/web/testing.md), linked in the Web sidebar next to Agent Skills. Companion to the iOS guide (#378, merged) and Android guide (#377, open) for SDC-31976/SDC-31985/SDC-31986.What's covered
BarcodeBatch), ID Capture, SparkScan, plusFrameData.final/native-backed, so no mocking framework (OCMockito, MockK, Mockito) is needed — a plain object literal stands in for anything the SDK would otherwise hand your listener.ImageFrameSource— the SDK's own built-in frame source; bypasses the camera/getUserMediaentirely and feeds a static image straight into the pipeline. Lightest-weight when you only need to verify real decoding.@eatsjobs/media-mock— mocksgetUserMediaat the browser API level, for when the code under test specifically drives the camera (e.g. permission handling) and you want the realCameraframe source to run unmodified.Validation
npm run build(Docusaurus) succeeds with no errors; verified the rendered page and its sidebar entry.web-datacapture-{barcode,core,id}), reusing verification already done for the in-repo Sphinx guide in data-capture-sdk!37490.kotlin/java), matching the iOS PR's approach rather than Android's.🤖 Generated with Claude Code