Skip to content

test(logistics): extend qr scanner camera permission boundary tests#349

Open
BigManly4 wants to merge 1 commit into
SwiftChainn:mainfrom
BigManly4:test/qr-scanner-permissions
Open

test(logistics): extend qr scanner camera permission boundary tests#349
BigManly4 wants to merge 1 commit into
SwiftChainn:mainfrom
BigManly4:test/qr-scanner-permissions

Conversation

@BigManly4

Copy link
Copy Markdown

Closes #329

Summary

The exact target file from this issue, tests/components/logistics/QrScanner.test.tsx,
already existed on main with coverage for the getUserMedia NotAllowedError
denial path (asserting the "Camera Permission Denied" text and alert role)
and the successful camera-init path. This PR extends that same file with
the remaining camera-permission boundary cases the hook (useQrScanner)
already handles but weren't yet under test:

  • NotFoundError -> the distinct "No camera device found." fallback, and
    that it is NOT confused with the permission-denied fallback.
  • Any other unexpected getUserMedia rejection -> the generic
    "Failed to access camera." fallback.
  • Clicking Retry after a permission denial successfully re-requests the
    camera, recovers, and clears the fallback alert.

No inline mock objects are introduced; the API success path continues to
be mocked through qrScannerService using the existing fixture in
tests/mocks/qrScannerMockData.ts, and getUserMedia is mocked via
navigator.mediaDevices per test case.

Test plan

  • npx jest tests/components/logistics/QrScanner.test.tsx -- 5/5 passing

Extend QrScanner camera-permission coverage beyond the existing
NotAllowedError case: assert the distinct "No camera device found"
fallback for NotFoundError, a generic "Failed to access camera"
fallback for other getUserMedia rejections, and that clicking Retry
after a permission denial successfully recovers the camera and clears
the fallback alert.
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@BigManly4 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test: QR Scanner Permissions Boundary

1 participant