secant-android-wallet/docs/testing/manual_testing/QR Scan.md

48 lines
3.4 KiB
Markdown
Raw Normal View History

[#313] scan qr screen functional * [#312] [#309] Scaffold Scan QR Screen - Screen scaffolding. - Model classes. - Screen states handling. - Needed dependencies added. - Camera permission handling. Redirect to Settings. - Added SettingsUtilTest class. - Added view classes tests. - Renamed tag class in update package. - Fix the scan frame size while changing the screen orientation. - Use local variable for cameraProvider. - Use UUID for source of randomness. - Eliminate blocking call for camera. - Fix preview name. - Remove Google Guava dependency. - Suppress Lint warning. - Improved calculation of the camera frame size. Moved it into Constraint layout. - Added custom image analyser class. - Implemented logic for the QR scan screen while QR code is found. - Manual tests added. - New module with integration tests for QR Scan screen. Added 3 integration and 4 view tests. - Simplify QR Scan screen view basic tests. - Switched from pure compose permission handling to Accompanist way of handling CAMERA permission. - Added validation of Zcash wallet address from QR scanning result. - Fix the integration tests for the CI WTF emulator runs. - Add comment on RTL test result. - Improve waitForDeviceIdle() method. Use it on the other test too. - Change the integration test module main manifest package name. - Debounce scans. - Improve thread safety of scan collection. - Added instructions on how to set up an emulator in manual tests. - Replace compose collectAsState() with coroutine launch(). - Add sample() to get rid of several callback events at the same time. - Stop updating the scanState when it's already in Scanning state. - Fix condition on navigation. - Remove validateJob check. - Speed up the integration test - Wrap ImageAnalysis.qrCodeFlow to remember. - Auto-close the camera image when we're done with it in all cases. - Update minimal SDK version to 24 for WTF emulators. - Update Architecture documentation. - Removed extra blank space in ui-design module definition. - Add ui-integration-test-lib. - Update Mermaid diagram with newly added module. - Move UI modules into one wrap in the diagram. - Move sdk-ext-lib and sdk-ext-ui under the same modules section. - Update camera dependencies. Co-authored-by: Carter Jernigan <git@carterjernigan.com>
2022-06-02 04:35:51 -07:00
Note: To be able to fully test the QR Scan screen and its logic, we recommend you to test it on real Android devices, which have hardware camera accessories. Although there is a way on how to test the scanning functionalities on an Android emulator too. See the next section on how to set up a QR code for the emulated camera scene.
# Test Prerequisites
- Check you have a wallet configured in the Zcash wallet app
- Open Zcash wallet app in the system Settings app. Visit the permissions screen, then select Camera and make sure that you have the Camera permission denied.
- Prepare at least two Zcash wallet addresses - one valid and one invalid. A valid address for Testnet can be `tmEjY6KfCryQhJ1hKSGiA7p8EeVggpvN78r`. The invalid one can be its modification.
# Android emulator setup (optional)
This section is optional and is required only if you'd like to test on an Android emulator device.
1. Follow these [steps](https://developer.android.com/studio/install) to download and install Android studio
2. And these [steps](https://developer.android.com/studio/run/managing-avds#createavd) help you set up an Android emulator
3. Then you'll need to create a valid Zcash address QR code image. It can be done, for example, with the [QR Code Generator](https://www.qr-code-generator.com/) tool.
4. Download the image
5. Start the emulator
6. Click on More in the emulator panel to open the Extended controls window
7. Click on Camera
8. Click Add Image in the Wall section
9. Select your QR code image and close the window
10. Once you're in the QR Scan screen with the virtual camera opened, see these [instructions](https://developers.google.com/ar/develop/java/emulator#control_the_virtual_scene) on how to move in virtual scene.
11. The last step is to let the scanner read your QR code to be able to move to the smaller room (behind the dog), which will have the code displayed on the room wall.
# Check Camera permission allow functionality
1. Open QR Scan screen by QR code icon from the Home screen
2. Camera permission dialog should be prompt
3. Grant camera permission with Allow button (or its modifications)
4. Camera view and its square frame should appear
# Check Camera permission deny functionality
1. Open QR Scan screen by QR code icon from the Home screen
2. Camera permission dialog should be prompt
3. Deny camera permission with Deny button (or its modifications)
4. Camera view and its square frame shouldn't be visible. The screen should be black. Also, Open system Settings app button on the bottom side of the screen should be visible now.
5. Hit the button.
6. System Settings app should open on the Zcash wallet app screen.
# Scan valid QR code
1. Grant the Camera permission with one of the previous procedures
2. Create QR code from the valid Zcash wallet address. You can use, for example, the [QR Code Generator](https://www.qr-code-generator.com/) tool.
3. Scan the created QR code
4. The code should be scanned and validated
5. App should then close the QR Scan screen and navigate to another screen to proceed with the scanned result
# Scan invalid QR code
1. Grant the Camera permission with one of the previous procedures
2. Create QR code from the valid Zcash wallet address. You can use, for example, the [QR Code Generator](https://www.qr-code-generator.com/) tool.
3. Scan the created QR code
4. The code should be scanned but not validated
5. The app UI should not be changed and the Camera view should be still available for scanning another codes