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

Commit e931bef9 authored by Vania Desmonda's avatar Vania Desmonda
Browse files

Create our own Desktop Mode common assertions.

This is done by adding new common assertions in DesktopModeBaseTest,
removing inheritance from ICommonAssertions, and adding a way to exclude
common assertions by adding excludedTests set.

Fixes: 419252045
Test: atest OpenAppFromAllAppsFlickerTest
Flag: EXEMPT test infra work
Change-Id: I3ae6e55b21b575cdc360ba6232cb6ed9e97141e1
parent d3ec03ee
Loading
Loading
Loading
Loading
+40 −1
Original line number Diff line number Diff line
@@ -21,17 +21,56 @@ import android.tools.flicker.rules.ChangeDisplayOrientationRule

import org.junit.Assume
import org.junit.Before
import org.junit.Test
import org.junit.Rule
import org.junit.rules.TestName
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.statusBarLayerIsVisibleAtStartAndEnd
import com.android.server.wm.flicker.statusBarLayerPositionAtStartAndEnd
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.taskBarLayerIsVisibleAtStartAndEnd
import com.android.server.wm.flicker.taskBarWindowIsAlwaysVisible

/**
 * The base class that all Desktop Mode Flicker tests should inherit from.
 *
 * This will ensure that all the appropriate methods are called before running the tests.
 */
abstract class DesktopModeBaseTest(flicker: LegacyFlickerTest) : BaseTest(flicker) {
abstract class DesktopModeBaseTest(flicker: LegacyFlickerTest) : BaseBenchmarkTest(flicker) {
    @get:Rule
    val testName = TestName()

    // Override this set with the test method names that you want to exclude from the test
    open val excludedTests: Set<String> = emptySet()

    @Before
    fun setUp() {
        tapl.setExpectedRotation(flicker.scenario.startRotation.value)
        ChangeDisplayOrientationRule.setRotation(flicker.scenario.startRotation)
        Assume.assumeTrue(tapl.isTablet)

        val currentTestMethodName = testName.methodName
        Assume.assumeFalse(
            "Skipping test: $currentTestMethodName as it is in the exclusion list.",
            excludedTests.any { currentTestMethodName.startsWith(it) }
        )
    }

    @Test
    fun entireScreenCovered() = flicker.entireScreenCovered()

    @Test
    fun taskBarLayerIsVisibleAtStartAndEnd() = flicker.taskBarLayerIsVisibleAtStartAndEnd()

    @Test
    fun taskBarWindowIsAlwaysVisible() = flicker.taskBarWindowIsAlwaysVisible()

    @Test
    fun statusBarLayerIsVisibleAtStartAndEnd() = flicker.statusBarLayerIsVisibleAtStartAndEnd()

    @Test
    fun statusBarLayerPositionAtStartAndEnd() = flicker.statusBarLayerPositionAtStartAndEnd()

    @Test
    fun statusBarWindowIsAlwaysVisible() = flicker.statusBarWindowIsAlwaysVisible()
}
 No newline at end of file