mardi 14 mai 2019

Is it possible to scan a QR Code in UI Automator tests for AWS Farm devices testing?

I'm creating UI tests on Android Studio for test my app on AWS Farm. Each time I launch the app I need to scan an authentication QR code. I search a solution to send a picture to the camera, so the app can scan the QR code.

I try it manually and it works but when I send the tests on multiple devices on AWS Farm it would not work anymore and I try to search solution to send a picture to the active camera with UI Automator.

Here is my test, before I launch the app and when it's open I click on "scan QR code". When I run this test it open the camera device.


    @Test
    public void clickQrCode() {
        mDevice.wait(Until.hasObject(By.textContains("SCAN QR")), LAUNCH_TIMEOUT);
        List<UiObject2> mObject = mDevice.findObjects(By.textContains("SCAN QR"));
        assertThat(mObject.size(), is(1));
        mObject.get(0).click();
        allowPermissionsIfNeeded();

        // The camera is set to ON and wait a QR code
    }


I'm not familiar with this framework and found anything to do what I want. If someone have solution to test the QR code scanning for UI tests, I would appreciate it.

Aucun commentaire:

Enregistrer un commentaire