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

Commit 1b642937 authored by Daniel Akinola's avatar Daniel Akinola
Browse files

Fix MediaProjection Flicker tests

Flicker tests which use StartMediaProjectionAppHelper were failing due
to not being able to find the Calculator app from the app drawer - the
issue semed to be that sometimes it was scrolling past it in the
scenario. Addeed a check to see if the app is on thes screen before
scrolling.

Bug: 423974470
Test: StartAppMediaProjectionWithMaxDesktopWindows
Test: StartAppMediaProjectionResizeAndDrag
Flag: TEST_ONLY
Change-Id: Ife29fdd38804d3024d24c750409576fa300db2d2
parent ebd1caeb
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -112,6 +112,13 @@ constructor(
    }

    private fun selectTargetApp(targetAppName: String) {
        val targetApp = uiDevice.wait(Until.findObject(By.text(targetAppName)), TIMEOUT)
        if (targetApp != null) {
            targetApp.click()
            return
        }
        Log.d(TAG, "Unable to find target app immediately so will attempt to scroll")

        // Scroll to to find target app to launch then click app icon it to start capture
        val scrollable = UiScrollable(UiSelector().scrollable(true))
        try {
@@ -121,7 +128,7 @@ constructor(
                return
            }
        } catch (e: UiObjectNotFoundException) {
            Log.d(TAG, "There was no scrolling (UI may not be scrollable")
            Log.d(TAG, "There was no scrolling (UI may not be scrollable)", e)
        }

        findObject(By.text(targetAppName)).also { it.click() }