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

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

Use calculator instead of Gmail in UnminimizeAppFromTaskbar

When launching GMail we expect to open the Activity
ConversationListActivityGmail, but gmail might enter another Activity
before that if for example the test device has no logged-in account.
Instead use the calculator that doesn't have log-in screen.

Bug: 399420941
Test: atest PlatformScenarioTests:UnminimizeAppFromTaskbarTest
Flag: EXEMPT - test fix
Change-Id: I7c24d552ad19ba662db950f1bd9596eb4f270760
parent 57e0889e
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package com.android.wm.shell.scenarios
import android.app.Instrumentation
import android.tools.NavBar
import android.tools.Rotation
import android.tools.device.apphelpers.GmailAppHelper
import android.tools.device.apphelpers.CalculatorAppHelper
import android.tools.flicker.rules.ChangeDisplayOrientationRule
import android.tools.traces.parsers.WindowManagerStateHelper
import androidx.test.platform.app.InstrumentationRegistry
@@ -44,8 +44,9 @@ abstract class UnminimizeAppFromTaskbar(val rotation: Rotation = Rotation.ROTATI
    private val wmHelper = WindowManagerStateHelper(instrumentation)
    private val device = UiDevice.getInstance(instrumentation)
    private val testApp = DesktopModeAppHelper(SimpleAppHelper(instrumentation))
    private val gmailHelper = GmailAppHelper(instrumentation)
    private val gmailApp = DesktopModeAppHelper(gmailHelper)
    private val calculatorHelper = CalculatorAppHelper(instrumentation)
    private val calculatorApp = DesktopModeAppHelper(calculatorHelper)


    @Rule
    @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, rotation)
@@ -59,20 +60,20 @@ abstract class UnminimizeAppFromTaskbar(val rotation: Rotation = Rotation.ROTATI
        ChangeDisplayOrientationRule.setRotation(rotation)
        testApp.enterDesktopMode(wmHelper, device)
        tapl.showTaskbarIfHidden()
        gmailApp.launchViaIntent(wmHelper)
        gmailApp.minimizeDesktopApp(wmHelper, device)
        calculatorApp.launchViaIntent(wmHelper)
        calculatorApp.minimizeDesktopApp(wmHelper, device)
    }

    @Test
    open fun unminimizeApp() {
        tapl.launchedAppState.taskbar
            .getAppIcon(gmailHelper.appName)
            .launch(gmailHelper.packageName)
            .getAppIcon(calculatorHelper.appName)
            .launch(calculatorApp.packageName)
    }

    @After
    fun teardown() {
        testApp.exit(wmHelper)
        gmailApp.exit(wmHelper)
        calculatorApp.exit(wmHelper)
    }
}