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

Commit 699cb21d authored by Orhan Uysal's avatar Orhan Uysal
Browse files

Migrate tests to use the handle menu to enter desk

Drag to desktop entrance has been flaky and is making all the tests
fail. To reduce the flakiness to the tests that actually need to use
drag to desktop, move rest of the tests to move with the handle menu.

Bug: 392576701
Test: atest CloseAllAppWithAppHeaderExitLandscape
Flag: EXEMPT Fixing tests
Change-Id: I3713cf2f8bc337f475fdccafdcea0cf90e300bbb
parent ea66f9f4
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -50,7 +50,7 @@ constructor(
    @Test
    @Test
    open fun enterDesktopWithDrag() {
    open fun enterDesktopWithDrag() {
        // By default this method uses drag to desktop
        // By default this method uses drag to desktop
        testApp.enterDesktopMode(wmHelper, device)
        testApp.enterDesktopMode(wmHelper, device, shouldUseDragToDesktop = true)
    }
    }


    @After
    @After
+1 −1
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ constructor(
    @Test
    @Test
    open fun reenterDesktopWithDrag() {
    open fun reenterDesktopWithDrag() {
        // By default this method uses drag to desktop
        // By default this method uses drag to desktop
        testApp.enterDesktopMode(wmHelper, device)
        testApp.enterDesktopMode(wmHelper, device, shouldUseDragToDesktop = true)
    }
    }


    @After
    @After
+5 −1
Original line number Original line Diff line number Diff line
@@ -87,14 +87,18 @@ open class DesktopModeAppHelper(private val innerHelper: IStandardAppHelper) :
        wmHelper: WindowManagerStateHelper,
        wmHelper: WindowManagerStateHelper,
        device: UiDevice,
        device: UiDevice,
        motionEventHelper: MotionEventHelper = MotionEventHelper(getInstrumentation(), TOUCH),
        motionEventHelper: MotionEventHelper = MotionEventHelper(getInstrumentation(), TOUCH),
        shouldUseDragToDesktop: Boolean = false,
    ) {
    ) {
        innerHelper.launchViaIntent(wmHelper)
        innerHelper.launchViaIntent(wmHelper)
        if (!isInDesktopWindowingMode(wmHelper)) {
        if (isInDesktopWindowingMode(wmHelper)) return
        if (shouldUseDragToDesktop) {
            enterDesktopModeWithDrag(
            enterDesktopModeWithDrag(
                wmHelper = wmHelper,
                wmHelper = wmHelper,
                device = device,
                device = device,
                motionEventHelper = motionEventHelper
                motionEventHelper = motionEventHelper
            )
            )
        } else {
            enterDesktopModeFromAppHandleMenu(wmHelper, device)
        }
        }
    }
    }