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

Commit d0796e29 authored by Gustav Sennton's avatar Gustav Sennton
Browse files

Add base class for desktop e2e test scenarios

- Add a base test class for Desktop test scenarios
    - Add ScreenRecordRule to that base test class.
    - Make all desktop test scenarios extend that base class
    - only keep screenrecordings on test failure
- Change the test config for WMShellFlickerTestsDesktopMode tests to
  pull screenrecord files (created from the test-rule above) to the host
  after each test.

Flag: EXEMPT test update
Bug: 405886707
Test: atest WMShellFlickerTestsDesktopMode

Change-Id: Iec3df9252e82b6e02ba76401b96d6634f801fc22
parent 3a6a5c9d
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -65,7 +65,9 @@
    </target_preparer>

    <!-- Needed for pushing the trace config file -->
    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
        <option name="force-root" value="true" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
        <option name="push-file"
                key="trace_config.textproto"
@@ -90,9 +92,8 @@
        <option name="instrumentation-arg" key="per_run" value="true"/>
        <option name="instrumentation-arg" key="perfetto_persist_pid_track" value="true"/>
    </test>
    <!-- Needed for pulling the collected trace config on to the host -->
    <!-- Needed for pulling the collected trace config and screenrecord to the host -->
    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
        <option name="pull-pattern-keys" value="perfetto_file_path"/>
        <option name="directory-keys"
                value="/data/user/0/com.android.wm.shell.flicker/files"/>
        <option name="collect-on-run-ended-only" value="true"/>
+4 −2
Original line number Diff line number Diff line
@@ -38,7 +38,9 @@ import org.junit.Rule
import org.junit.Test

@Ignore("Test Base Class")
abstract class AltTabSwitchInDesktopMode(val rotation: Rotation = Rotation.ROTATION_0) {
abstract class AltTabSwitchInDesktopMode(
    val rotation: Rotation = Rotation.ROTATION_0
) : TestScenarioBase() {

    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val tapl = LauncherInstrumentation()
+3 −4
Original line number Diff line number Diff line
@@ -37,8 +37,9 @@ import org.junit.Rule
import org.junit.Test

@Ignore("Base Test Class")
abstract class CloseAllAppsWithAppHeaderExit
constructor(val rotation: Rotation = Rotation.ROTATION_0) {
abstract class CloseAllAppsWithAppHeaderExit (
    val rotation: Rotation = Rotation.ROTATION_0
) : TestScenarioBase() {

    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val tapl = LauncherInstrumentation()
@@ -48,8 +49,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {
    private val mailApp = DesktopModeAppHelper(MailAppHelper(instrumentation))
    private val nonResizeableApp = DesktopModeAppHelper(NonResizeableAppHelper(instrumentation))



    @Rule @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, rotation)

    @Before
+3 −1
Original line number Diff line number Diff line
@@ -37,7 +37,9 @@ import org.junit.Rule
import org.junit.Test

@Ignore("Base Test Class")
abstract class CloseAllAppsWithBackNavigation(val rotation: Rotation = Rotation.ROTATION_0) {
abstract class CloseAllAppsWithBackNavigation(
    val rotation: Rotation = Rotation.ROTATION_0
) : TestScenarioBase() {
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val tapl = LauncherInstrumentation()
    private val wmHelper = WindowManagerStateHelper(instrumentation)
+2 −2
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ import org.junit.Ignore
abstract class DesktopScenarioCustomAppTestBase(
    isResizeable: Boolean = true,
    isLandscapeApp: Boolean = true
) {
) : TestScenarioBase() {
    val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    val tapl = LauncherInstrumentation()
    val wmHelper = WindowManagerStateHelper(instrumentation)
Loading