Camera injection
Set your app's camera to a chosen still image from your Appium script — so QR, barcode and document-scan branches run in your suites without a real camera.
An app that opens the camera to scan a code or a document would block an automated run — there is nothing to point it at. TestKase lets your script set the image the camera sees, so the scan runs unattended.
Prepare the app
Camera injection is a per-build setting you turn on once, the same way as for a Live session:
- Upload your app (or pick one from My apps) — see Uploading your app.
- Open App settings (the ⚙ next to the build) and switch Camera injection on.
- Wait for the build to show Ready — a copy is prepared for camera injection (about a minute the first time). Your uploaded file is untouched.
Works on real Android phones and tablets, Android emulators, and real iPhones and iPads. It is not available on the iOS Simulator. Still images today — video injection is on the roadmap.
Set the image with testkase_action
Send one testkase_action naming the image you want the camera to show. image is a URL the runner can reach; TestKase fetches it and feeds it to the app's camera — the same delivery used in a Live session. The one action works on both Android and iPhone.
await driver.executeScript(
'testkase_action: {"action":"setCameraImage","arguments":{"image":"https://example.com/qr-invoice.png"}}',
);- Send it before, or while, the app is on its camera screen — the camera shows the image at once.
- Call it again with a different
imageto swap what the camera sees, with no restart, so one test can walk through several codes or documents. - The real camera is off and your app's own code reads the image, so its scanner, barcode reader or OCR runs for real — the success, retry and failure branches all execute.
Notes
- This mirrors the Live Camera injection control, so a flow you verified by hand reproduces in a script.
- Supply any still image the runner can fetch — a QR, a barcode, a photo of an ID or a document, a cheque.
- It replaces the frames the app reads; it does not exercise the physical camera sensor or autofocus.
- On iPhone and iPad it covers apps that read the camera's frames to decode. If an iOS app relies only on the system's built-in barcode detector and nothing is read, tell us the app — that path is still being extended.
