Refine SwitchImeWindowsFromGestureNavTest
As CL[1] introduced SwitchImeWindowsFromGestureNavTest to verify IME visibility when switching tasks by gestural navigation. However, several tests are now has been flaky a while for some reasons: 1) 2 buttons navigation has no longer supported in the new product. 2) 3 buttons navigation is not used for gestural navigation. 3) IME will hide when default setting IME fullscreen mode in landscape and focused back to the task that previously IME is shown. 4) Tests might flaky if we are not waiting for splash screen finish. 5) NavBar / Status bar might not visible temporarily during switching tasks. 6) IME visiblity will visible / invisiblie when switching between tasks with IME visible / invisible. To fix the above test scenarios, improves the test logic with: For 1), 2), removed 2 / 3 buttoms navigation from the test parameters. For 3), since IMF side by default doesn't want to cover the app's content with fullscreen IME editor disruptively, in case affecting IME visiblity verfication in landscape, add "flagNoExtractUI" imeOptions for ImeTestActivity to disable IME fullscreen mode. For 4), add waitForAppTransitionIdle to ensure the test will going to next step when finished the splash screen animation. For 5), 6), uses the tags (start, end, imeVisible / imeInvisible) to tag the places in the layer traces where we would like to verify the given layer visiblity (i.e. navBar, statusBar, IME), and make sure we verified those system window layer visiblity in the right place. [1]: I677d08543c75746f1405b50eab9061befeb75fc3 Bug: 190139720 Test: atest SwitchImeWindowsFromGestureNavTest Change-Id: Ifa3b68c710b7fb7f65af5a051a571c76a27371b1
This commit is contained in:
@@ -19,7 +19,6 @@ package com.android.server.wm.flicker.ime
|
||||
import android.app.Instrumentation
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.view.WindowManagerPolicyConstants
|
||||
import androidx.test.filters.FlakyTest
|
||||
import androidx.test.filters.RequiresDevice
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
|
||||
@@ -29,15 +28,15 @@ import com.android.server.wm.flicker.FlickerParametersRunnerFactory
|
||||
import com.android.server.wm.flicker.FlickerTestParameter
|
||||
import com.android.server.wm.flicker.FlickerTestParameterFactory
|
||||
import com.android.server.wm.flicker.annotation.Group2
|
||||
import com.android.server.wm.flicker.helpers.ImeAppHelper
|
||||
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
|
||||
import com.android.server.wm.flicker.helpers.SimpleAppHelper
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.navBarWindowIsVisible
|
||||
import com.android.server.wm.flicker.navBarLayerIsVisible
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.statusBarWindowIsVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerIsVisible
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.NAV_BAR_LAYER_NAME
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.STATUS_BAR_LAYER_NAME
|
||||
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
@@ -54,10 +53,11 @@ import org.junit.runners.Parameterized
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@Group2
|
||||
@Presubmit
|
||||
class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParameter) {
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
private val testApp = SimpleAppHelper(instrumentation)
|
||||
private val imeTestApp = ImeAppHelper(instrumentation)
|
||||
private val imeTestApp = ImeAppAutoFocusHelper(instrumentation, testSpec.config.startRotation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
@@ -66,7 +66,13 @@ class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParame
|
||||
eachRun {
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
testApp.launchViaIntent(wmHelper)
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
|
||||
imeTestApp.launchViaIntent(wmHelper)
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
|
||||
imeTestApp.openIME(device, wmHelper)
|
||||
}
|
||||
}
|
||||
@@ -74,58 +80,86 @@ class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParame
|
||||
eachRun {
|
||||
device.pressHome()
|
||||
wmHelper.waitForHomeActivityVisible()
|
||||
}
|
||||
test {
|
||||
imeTestApp.exit(wmHelper)
|
||||
testApp.exit()
|
||||
imeTestApp.exit()
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
// [Step1]: Swipe right from imeTestApp to testApp task
|
||||
createTag(TAG_IME_VISIBLE)
|
||||
val displayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation)
|
||||
val displayCenterX = displayBounds.bounds.width() / 2
|
||||
device.swipe(displayCenterX, displayBounds.bounds.height(),
|
||||
displayBounds.bounds.width(), displayBounds.bounds.height(), 20)
|
||||
device.swipe(0, displayBounds.bounds.height(),
|
||||
displayBounds.bounds.width(), displayBounds.bounds.height(), 50)
|
||||
|
||||
wmHelper.waitForFullScreenApp(testApp.component)
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
createTag(Companion.TAG_IME_INVISIBLE)
|
||||
}
|
||||
transitions {
|
||||
// [Step2]: Swipe left to back to imeTestApp task
|
||||
val displayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation)
|
||||
val displayCenterX = displayBounds.bounds.width() / 2
|
||||
device.swipe(displayBounds.bounds.width(), displayBounds.bounds.height(),
|
||||
displayCenterX, displayBounds.bounds.height(), 20)
|
||||
0, displayBounds.bounds.height(), 50)
|
||||
wmHelper.waitForFullScreenApp(imeTestApp.component)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun imeAppWindowIsAlwaysVisible() = testSpec.imeAppWindowIsAlwaysVisible(imeTestApp)
|
||||
fun imeAppWindowAlwaysVisible() {
|
||||
testSpec.assertWm {
|
||||
this.showsAppWindowOnTop(testApp.getPackage())
|
||||
.then()
|
||||
.showsAppWindow(testApp.getPackage())
|
||||
}
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
|
||||
fun navBarLayerIsVisibleAroundSwitching() {
|
||||
testSpec.assertLayersStart {
|
||||
isVisible(NAV_BAR_LAYER_NAME)
|
||||
}
|
||||
testSpec.assertLayersEnd {
|
||||
isVisible(NAV_BAR_LAYER_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()
|
||||
fun statusBarLayerIsVisibleAroundSwitching() {
|
||||
testSpec.assertLayersStart {
|
||||
isVisible(STATUS_BAR_LAYER_NAME)
|
||||
}
|
||||
testSpec.assertLayersEnd {
|
||||
isVisible(STATUS_BAR_LAYER_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun imeLayerIsVisibleWhenSwitchingToImeApp() {
|
||||
testSpec.assertLayersStart {
|
||||
isVisible(IME_WINDOW_TITLE)
|
||||
}
|
||||
testSpec.assertLayersTag(TAG_IME_VISIBLE) {
|
||||
isVisible(IME_WINDOW_TITLE)
|
||||
}
|
||||
testSpec.assertLayersEnd {
|
||||
isVisible(IME_WINDOW_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun imeLayerIsInvisibleWhenSwitchingToTestApp() {
|
||||
testSpec.assertLayersTag(TAG_IME_INVISIBLE) {
|
||||
isInvisible(IME_WINDOW_TITLE)
|
||||
}
|
||||
}
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun navBarWindowIsVisible() = testSpec.navBarWindowIsVisible()
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun navBarLayerIsVisible() = testSpec.navBarLayerIsVisible()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun statusBarWindowIsVisible() = testSpec.statusBarWindowIsVisible()
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
fun statusBarLayerIsVisible() = testSpec.statusBarLayerIsVisible()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
@@ -134,10 +168,12 @@ class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParame
|
||||
.getConfigNonRotationTests(
|
||||
repetitions = 3,
|
||||
supportedNavigationModes = listOf(
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
|
||||
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private const val TAG_IME_VISIBLE = "imeVisible"
|
||||
private const val TAG_IME_INVISIBLE = "imeInVisible"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,5 +23,6 @@
|
||||
<EditText android:id="@+id/plain_text_input"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="text"/>
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user