Merge "Use tapl when possible"

This commit is contained in:
TreeHugger Robot
2022-07-29 07:08:13 +00:00
committed by Android (Google) Code Review
12 changed files with 44 additions and 26 deletions

View File

@@ -40,6 +40,7 @@ abstract class BaseTest @JvmOverloads constructor(
testSpec.setIsTablet(
WindowManagerStateHelper(instrumentation).currentState.wmState.isTablet
)
tapl.setExpectedRotationCheckEnabled(true)
}
/**

View File

@@ -49,6 +49,9 @@ class OpenActivityEmbeddingPlaceholderSplit(
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
}
eachRun {
testApp.launchViaIntent(wmHelper)
}
@@ -58,7 +61,7 @@ class OpenActivityEmbeddingPlaceholderSplit(
}
teardown {
test {
device.pressHome()
tapl.goHome()
testApp.exit(wmHelper)
}
}

View File

@@ -70,12 +70,17 @@ class CloseAppHomeButtonTest(testSpec: FlickerTestParameter) : CloseAppTransitio
override val transition: FlickerBuilder.() -> Unit
get() = {
super.transition(this)
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
}
}
transitions {
// Can't use TAPL at the moment because of rotation test issues
// When pressing home, TAPL expects the orientation to remain constant
// However, when closing a landscape app back to a portrait-only launcher
// this causes an error in verifyActiveContainer();
device.pressHome()
tapl.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()

View File

@@ -57,6 +57,9 @@ class CloseImeAutoOpenWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTes
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
}
eachRun {
testApp.launchViaIntent(wmHelper)
}
@@ -67,7 +70,7 @@ class CloseImeAutoOpenWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTes
}
}
transitions {
device.pressHome()
tapl.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.withImeGone()

View File

@@ -46,6 +46,9 @@ class CloseImeEditorPopupDialogTest(testSpec: FlickerTestParameter) : BaseTest(t
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
}
eachRun {
imeTestApp.launchViaIntent(wmHelper)
imeTestApp.openIME(wmHelper)
@@ -59,7 +62,7 @@ class CloseImeEditorPopupDialogTest(testSpec: FlickerTestParameter) : BaseTest(t
}
teardown {
eachRun {
device.pressHome()
tapl.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()

View File

@@ -49,13 +49,16 @@ class CloseImeWindowToHomeTest(testSpec: FlickerTestParameter) : BaseTest(testSp
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
}
eachRun {
testApp.launchViaIntent(wmHelper)
testApp.openIME(wmHelper)
}
}
transitions {
device.pressHome()
tapl.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.withImeGone()

View File

@@ -54,13 +54,16 @@ class OpenImeWindowFromFixedOrientationAppTest(
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
}
test {
// Launch the activity with expecting IME will be shown.
imeTestApp.launchViaIntent(wmHelper)
}
eachRun {
// Swiping out the IME activity to home.
device.pressHome()
tapl.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()

View File

@@ -30,7 +30,6 @@ import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
import com.android.server.wm.flicker.helpers.reopenAppFromOverview
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.traces.common.ComponentMatcher
import com.android.server.wm.traces.common.ComponentMatcher.Companion.LAUNCHER
import org.junit.Assume
import org.junit.FixMethodOrder
import org.junit.Test
@@ -68,6 +67,7 @@ open class ReOpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSp
transitions {
device.reopenAppFromOverview(wmHelper)
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp)
.withImeShown()
.waitForAndVerify()
}
@@ -111,9 +111,9 @@ open class ReOpenImeWindowTest(testSpec: FlickerTestParameter) : BaseTest(testSp
@Test
fun launcherWindowBecomesInvisible() {
testSpec.assertWm {
this.isAppWindowVisible(LAUNCHER)
this.isAppWindowVisible(ComponentMatcher.LAUNCHER)
.then()
.isAppWindowInvisible(LAUNCHER)
.isAppWindowInvisible(ComponentMatcher.LAUNCHER)
}
}

View File

@@ -29,7 +29,6 @@ import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder
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.isShellTransitionsEnabled
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.traces.common.ComponentMatcher
@@ -65,6 +64,9 @@ open class SwitchImeWindowsFromGestureNavTest(
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
}
eachRun {
this.setRotation(testSpec.startRotation)
testApp.launchViaIntent(wmHelper)
@@ -82,7 +84,7 @@ open class SwitchImeWindowsFromGestureNavTest(
}
teardown {
eachRun {
device.pressHome()
tapl.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()
@@ -93,12 +95,7 @@ open class SwitchImeWindowsFromGestureNavTest(
transitions {
// [Step1]: Swipe right from imeTestApp to testApp task
createTag(TAG_IME_VISIBLE)
val displayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)
device.swipe(
0, displayBounds.bounds.height,
displayBounds.bounds.width, displayBounds.bounds.height, 50
)
tapl.launchedAppState.quickSwitchToPreviousApp()
wmHelper.StateSyncBuilder()
.withFullScreenApp(testApp)
.waitForAndVerify()
@@ -106,11 +103,7 @@ open class SwitchImeWindowsFromGestureNavTest(
}
transitions {
// [Step2]: Swipe left to back to imeTestApp task
val displayBounds = WindowUtils.getDisplayBounds(testSpec.startRotation)
device.swipe(
displayBounds.bounds.width, displayBounds.bounds.height,
0, displayBounds.bounds.height, 50
)
tapl.launchedAppState.quickSwitchToPreviousAppSwipeLeft()
wmHelper.StateSyncBuilder()
.withFullScreenApp(imeTestApp)
.waitForAndVerify()

View File

@@ -70,11 +70,11 @@ open class OpenAppFromOverviewTest(
super.transition(this)
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
testApp.launchViaIntent(wmHelper)
}
eachRun {
// Can't use tapl.goHome() because of b/235841947
device.pressHome()
tapl.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()

View File

@@ -66,10 +66,11 @@ open class OpenAppWarmTest(testSpec: FlickerTestParameter) :
super.transition(this)
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
testApp.launchViaIntent(wmHelper)
}
eachRun {
device.pressHome()
tapl.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.waitForAndVerify()

View File

@@ -59,13 +59,16 @@ class QuickSwitchFromLauncherTest(testSpec: FlickerTestParameter) : BaseTest(tes
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
test {
tapl.setExpectedRotationCheckEnabled(false)
}
test {
tapl.setExpectedRotation(testSpec.startRotation)
}
eachRun {
testApp.launchViaIntent(wmHelper)
device.pressHome()
tapl.goHome()
wmHelper.StateSyncBuilder()
.withHomeActivityVisible()
.withWindowSurfaceDisappeared(testApp)