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

Commit 0f7f4af4 authored by Vania Desmonda's avatar Vania Desmonda
Browse files

Remove all desks before starting test.

The testSetupRule runs a command that clears all recent tasks but
doesn't remove them from the repository. Run removeAllDesks to ensure
the test starts from a clean state.

Fixes: 424961460
Test: atest
Flag: EXEMPT test fix
Change-Id: Iae89c477e0566b39ba1e20b27c993e594c3f6b86
parent 03499bba
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -16,11 +16,25 @@

package com.android.wm.shell.scenarios

import android.app.Instrumentation
import android.platform.test.rule.ScreenRecordRule
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule

@Ignore("Base Test Class")
abstract class TestScenarioBase {
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val device = UiDevice.getInstance(instrumentation)

    @get:Rule val screenRecordRule = ScreenRecordRule(/* keepTestLevelRecordingOnSuccess= */ false)

    @Before
    fun removeAllDesks() {
        device.executeShellCommand(
            "dumpsys activity service SystemUIService WMShell desktopmode removeAllDesks"
        )
    }
}