Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8261988 authored by Nataniel Borges's avatar Nataniel Borges Committed by Android (Google) Code Review
Browse files

Merge "Test must wait until IME is shown"

parents 61e1730e 34d3e9ed
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ class CommonTransitions {
                .runBefore(device::pressHome)
                .runBefore(() -> setRotation(device, beginRotation))
                .runBefore(testApp::open)
                .run(() -> testApp.clickEditTextWidget(device))
                .run(() -> testApp.openIME(device))
                .runAfterAll(testApp::exit)
                .repeat(ITERATIONS);
    }
@@ -244,7 +244,8 @@ class CommonTransitions {
                            By.res(device.getLauncherPackageName(), "snapshot"));
                    snapshot.click();
                })
                .runBefore(() -> testAppBottom.clickEditTextWidget(device))
                .runBefore(() -> testAppBottom.openIME(device))
                .runBefore(device::pressBack)
                .runBefore(() -> AutomationUtils.resizeSplitScreen(device, startRatio))
                .run(() -> AutomationUtils.resizeSplitScreen(device, stopRatio))
                .runAfter(() -> exitSplitScreen(device))
@@ -264,7 +265,7 @@ class CommonTransitions {
                .runBefore(device::pressHome)
                .runBefore(() -> setRotation(device, beginRotation))
                .runBefore(testApp::open)
                .runBefore(() -> testApp.clickEditTextWidget(device))
                .runBefore(() -> testApp.openIME(device))
                .run(device::pressHome)
                .run(device::waitForIdle)
                .runAfterAll(testApp::exit)
@@ -281,7 +282,7 @@ class CommonTransitions {
                .runBefore(device::pressHome)
                .runBefore(() -> setRotation(device, beginRotation))
                .runBefore(testApp::open)
                .runBefore(() -> testApp.clickEditTextWidget(device))
                .runBefore(() -> testApp.openIME(device))
                .run(device::pressBack)
                .run(device::waitForIdle)
                .runAfterAll(testApp::exit)
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ public class ImeAppAutoFocusHelper extends ImeAppHelper {
        super(instr, "ImeAppAutoFocus");
    }

    public void clickEditTextWidget(UiDevice device) {
    public void openIME(UiDevice device) {
        // do nothing (the app is focused automatically)
    }
}
+10 −5
Original line number Diff line number Diff line
@@ -16,14 +16,14 @@

package com.android.server.wm.flicker.helpers;

import static android.os.SystemClock.sleep;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

import android.app.Instrumentation;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;

public class ImeAppHelper extends FlickerAppHelper {

@@ -35,11 +35,16 @@ public class ImeAppHelper extends FlickerAppHelper {
        this(instr, "ImeApp");
    }

    public void clickEditTextWidget(UiDevice device) {
        UiObject2 editText = device.findObject(By.res(getPackage(), "plain_text_input"));
    public void openIME(UiDevice device) {
        UiObject2 editText = device.wait(
                Until.findObject(By.res(getPackage(), "plain_text_input")),
                AutomationUtils.FIND_TIMEOUT);
        assertNotNull("Text field not found, this usually happens when the device was left "
                + "in an unknown state (e.g. in split screen)", editText);
        editText.click();
        sleep(500);

        if (!AutomationUtils.waitForIME(device)) {
            fail("IME did not appear");
        }
    }
}