[mobile] Camera to Barcode#294
Conversation
|
@lauty95 How can we add tests for this? Does Playwright offer a way to mock the camera? |
|
Playwright offers a way to mock the browser's I added tests for:
What I haven’t found a way to test with Playwright:
What I tried but didn't work:
|
|
@lauty Getting an error on when I try to navigate to a PO/PR. Update: this is a fixturing issue. The employee users that are fixtured don't have the "Purchase User" Role.
|
Draft Changelog EntryChangelog EntryCamera barcode scanning functionality has been added to the Move page. When a device with a camera is used, a button appears that allows the camera to be activated for scanning barcodes. The camera scanner automatically detects when a device does not have a camera available and hides the button accordingly. This feature is currently available on the Move page. This changelog entry was automatically generated by the Changelog Generator Action. |

Resolves
#293
Dependency
I chose to use the
html5-qrcodedependency based on its download count and documentation quality.I also reviewed
vue-barcode-readerand@zxing/browser. The first one has only ~5k downloads compared tohtml5-qrcode's~248k, and it does not seem to have the same level of support.@zxing/browsercould also be a good alternative, but I decided to proceed withhtml5-qrcode.How to test
To access the device camera, the app must be served over HTTPS. For this reason, I used ngrok (I believe we used it before): https://dashboard.ngrok.com/get-started/setup/windows
Once ngrok is installed, open a new terminal and run:
ngrok http 8000(in my case I used port 8004)Demo
For now, I only implemented the camera on the Move page.
On my computer, I do not have a camera installed, so the button to open the camera does not appear:
On my phone:
Live Demo
Screen_Recording_20251114_134313_Chrome.mp4