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

Commit 326b1d15 authored by Charles Chen's avatar Charles Chen
Browse files

FIx Bubble flicker tests with IME

When IME shows, the bubble bar will be occluded. Skip the verification
related to bubble bar UI components

Test: atest EnterBubbleWithImeViaBubbleMenuTest
Test: atest ExpandBubbleWithImeViaBubbleBarTest
Bug: 396020056
Flag: TEST_ONLY

Change-Id: Ib6c3884aac38f2b64db1549643ddd28a7814efcc
parent de566aa6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -108,10 +108,10 @@ class EnterBubbleWithImeViaBubbleMenuTest(navBar: NavBar) : BubbleFlickerTestBas
    override val testApp
        get() = EnterBubbleWithImeViaBubbleMenuTest.testApp

    override val bitmapAtEnd: Bitmap
    override val bitmapAtEnd
        get() = EnterBubbleWithImeViaBubbleMenuTest.bitmapAtEnd

    override val expectedImeInset: Int
    override val expectedImeInset
        get() = imeInset

    @FlakyTest(bugId = 421000153)
+2 −4
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import com.android.wm.shell.flicker.bubbles.utils.RecordTraceWithTransitionRule
import com.android.wm.shell.flicker.bubbles.utils.collapseBubbleAppViaBackKey
import com.android.wm.shell.flicker.bubbles.utils.expandBubbleAppViaBubbleBar
import com.android.wm.shell.flicker.bubbles.utils.launchBubbleViaBubbleMenu
import com.android.wm.shell.flicker.bubbles.utils.setUpBeforeTransition
import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.FixMethodOrder
@@ -81,7 +80,6 @@ class ExpandBubbleWithImeViaBubbleBarTest(navBar: NavBar) : BubbleFlickerTestBas

        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
            setUpBeforeTransition = {
                setUpBeforeTransition(instrumentation, wmHelper)
                // Launch and collapse the bubble.
                launchBubbleViaBubbleMenu(testApp, tapl, wmHelper)
                // Press back to dismiss IME window.
@@ -119,10 +117,10 @@ class ExpandBubbleWithImeViaBubbleBarTest(navBar: NavBar) : BubbleFlickerTestBas
    override val testApp
        get() = ExpandBubbleWithImeViaBubbleBarTest.testApp

    override val bitmapAtEnd: Bitmap
    override val bitmapAtEnd
        get() = ExpandBubbleWithImeViaBubbleBarTest.bitmapAtEnd

    override val expectedImeInset: Int
    override val expectedImeInset
        get() = imeInset

    @Before
+11 −4
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiObject2
import androidx.test.uiautomator.Until
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.helpers.ImeAppHelper
import com.android.wm.shell.Flags
import com.google.common.truth.Truth.assertWithMessage

@@ -172,8 +173,8 @@ fun expandBubbleAppViaTapOnBubbleStack(
 * Expands the bubble app [testApp], which is previously collapsed via tapping on bubble bar.
 * Note that this method only works on device with bubble bar.
 *
 * @param testApp the bubble app to expand
 * @param uiDevice the UI automator to get the bubble bar [UiObject2]
 * @param testApp the bubble app to expand
 * @param wmHelper the [WindowManagerStateHelper]
 */
fun expandBubbleAppViaBubbleBar(
@@ -297,9 +298,12 @@ private fun launchAndWaitForBubbleAppExpanded(

    waitAndAssertBubbleAppInExpandedState(testApp, wmHelper)

    // Don't check bubble icons if the testApp is IME because IME occludes the overflow.
    if (testApp !is ImeAppHelper) {
        assertWithMessage("The education must not show for Application bubble")
            .that(Root.get().bubble.isEducationVisible).isFalse()
    }
}

private fun waitAndAssertBubbleAppInExpandedState(
    testApp: StandardAppHelper,
@@ -313,8 +317,11 @@ private fun waitAndAssertBubbleAppInExpandedState(
        .withBubbleShown()
        .waitForAndVerify()

    // Don't check the overflow if the testApp is IME because IME occludes the overflow.
    if (testApp !is ImeAppHelper) {
        Root.get().expandedBubbleStack.verifyBubbleOverflowIsVisible()
    }
}

private fun waitAndAssertBubbleAppInCollapseState(wmHelper: WindowManagerStateHelper) {
    wmHelper
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ class RecordTraceWithTransitionRule(
            try {
                transition()
            } catch (e: Throwable) {
                Log.e(TAG, "Transition is aborted due to the exception:\n $e")
                Log.e(TAG, "Transition is aborted due to the exception:\n $e", e)
            }
        }
    }