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

Commit f72aa0ba authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Improve wait for PIP window condition on app helper

PIP window displays a dismiss button (X) upon start. To ensure the animation is complete wait until the dismiss button disappear to continue the test. This mitigates flakiness (e.g., test finishes before focus change)

Bug: 196213706
Test: atest WMShellFlickerTests:com.android.wm.shell.flicker.pip
Change-Id: Ib0d3d4fee46d44fa0480f7e91f8c584c2d7613c9
parent 9964ad83
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -88,6 +88,10 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(

        // Wait on WMHelper or simply wait for 3 seconds
        wmHelper?.waitFor("hasPipWindow") { it.wmState.hasPipWindow() } ?: SystemClock.sleep(3_000)
        // when entering pip, the dismiss button is visible at the start. to ensure the pip
        // animation is complete, wait until the pip dismiss button is no longer visible. 
        // b/176822698: dismiss-only state will be removed in the future
        uiDevice.wait(Until.gone(By.res(SYSTEMUI_PACKAGE, "dismiss")), FIND_TIMEOUT)
    }

    fun clickStartMediaSessionButton() {