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

Commit b1e56f29 authored by Charles Chen's avatar Charles Chen
Browse files

Verify dismiss bubble via bubble bar item

Test: atest DismissExpandedBubbleViaBubbleBarTest
Bug: 396020056
Flag: TEST_ONLY
Change-Id: I5346efb9f040feadf5beb7ba393d00309814fd84
parent 5cf8203c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ test_module_config {
        "com.android.wm.shell.flicker.bubbles.BubbleBarVisibilityTest",
        "com.android.wm.shell.flicker.bubbles.CollapseBubbleAppViaBackTest",
        "com.android.wm.shell.flicker.bubbles.CollapseBubbleAppViaTouchOutsideTest",
        "com.android.wm.shell.flicker.bubbles.DismissExpandedBubbleViaBubbleBarTest",
        "com.android.wm.shell.flicker.bubbles.DismissExpandedBubbleViaBubbleBarHandleTest",
        "com.android.wm.shell.flicker.bubbles.DismissExpandedBubbleViaBubbleViewTest",
        "com.android.wm.shell.flicker.bubbles.EnterBubbleViaBubbleMenuTest",
@@ -93,6 +94,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.bubbles.CollapseBubbleAppViaBackTest"],
}

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-DismissExpandedBubbleViaBubbleBarTest",
    base: "WMShellExplicitFlickerTestsBubbles",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.flicker.bubbles.DismissExpandedBubbleViaBubbleBarTest"],
}

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-DismissExpandedBubbleViaBubbleViewTest",
    base: "WMShellExplicitFlickerTestsBubbles",
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@
    {
      "name": "WMShellExplicitFlickerTestsBubbles-CollapseBubbleAppViaTouchOutsideTest"
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-DismissExpandedBubbleViaBubbleBarTest"
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-DismissExpandedBubbleViaBubbleBarHandleTest"
    },
+3 −3
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import android.tools.NavBar
import androidx.test.filters.RequiresDevice
import com.android.wm.shell.Flags
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.bubbles.testcase.DismissExpandedBubbleTestCases
import com.android.wm.shell.flicker.bubbles.testcase.DismissSingleExpandedBubbleTestCases
import com.android.wm.shell.flicker.bubbles.utils.ApplyPerParameterRule
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.dismissBubbleAppViaBubbleBarHandle
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.launchBubbleViaBubbleMenu
@@ -54,7 +54,7 @@ import org.junit.runners.Parameterized
 * ```
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [DismissExpandedBubbleTestCases]
 * - [DismissSingleExpandedBubbleTestCases]
 */
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE)
@RequiresDevice
@@ -62,7 +62,7 @@ import org.junit.runners.Parameterized
@Presubmit
@RunWith(Parameterized::class)
class DismissExpandedBubbleViaBubbleBarHandleTest(navBar: NavBar) : BubbleFlickerTestBase(),
    DismissExpandedBubbleTestCases {
    DismissSingleExpandedBubbleTestCases {
    companion object : FlickerPropertyInitializer() {
        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
            setUpBeforeTransition = { launchBubbleViaBubbleMenu(testApp, tapl, wmHelper) },
+139 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.wm.shell.flicker.bubbles

import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.RequiresFlagsEnabled
import android.tools.NavBar
import android.tools.device.apphelpers.MessagingAppHelper
import android.tools.traces.component.ComponentNameMatcher.Companion.LAUNCHER
import android.tools.traces.component.IComponentNameMatcher
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.wm.shell.Flags
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.bubbles.testcase.BubbleAlwaysVisibleTestCases
import com.android.wm.shell.flicker.bubbles.testcase.BubbleAppBecomesNotExpandedTestCases
import com.android.wm.shell.flicker.bubbles.utils.ApplyPerParameterRule
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.collapseBubbleAppViaTouchOutside
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.dismissBubbleAppViaBubbleBarItem
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.launchBubbleViaBubbleMenu
import com.android.wm.shell.flicker.bubbles.utils.FlickerPropertyInitializer
import com.android.wm.shell.flicker.bubbles.utils.RecordTraceWithTransitionRule
import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized

/**
 * Test dismissing one of bubble apps by dragging a bubble item from bubble bar to dismiss view.
 *
 * To run this test:
 *     `atest WMShellExplicitFlickerTestsBubbles:DismissExpandedBubbleViaBubbleBarTest`
 *
 * Pre-steps:
 * ```
 *     1. Launch [previousApp] into bubble and collapse.
 *     2. Launch [testApp] into bubble.
 * ```
 *
 * Actions:
 * ```
 *     Drag the [testApp] bubble bar item from the bubble bar to the dismiss view.
 *     [previousApp] will be expanded.
 * ```
 *
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [BubbleAlwaysVisibleTestCases]
 * - [BubbleAppBecomesNotExpandedTestCases]
 */
@FlakyTest(bugId = 430273288)
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE, Flags.FLAG_ENABLE_BUBBLE_BAR)
@RequiresDevice
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Presubmit
@RunWith(Parameterized::class)
class DismissExpandedBubbleViaBubbleBarTest(navBar: NavBar) :
    BubbleFlickerTestBase(),
    BubbleAlwaysVisibleTestCases,
    BubbleAppBecomesNotExpandedTestCases {

    companion object : FlickerPropertyInitializer() {
        private val previousApp = MessagingAppHelper(instrumentation)
        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
            setUpBeforeTransition = {
                launchBubbleViaBubbleMenu(previousApp, tapl, wmHelper)
                collapseBubbleAppViaTouchOutside(previousApp, wmHelper)
                launchBubbleViaBubbleMenu(testApp, tapl, wmHelper)
            },
            transition = { dismissBubbleAppViaBubbleBarItem(testApp, wmHelper, previousApp) },
            tearDownAfterTransition = {
                testApp.exit(wmHelper)
                previousApp.exit(wmHelper)
            }
        )

        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun data(): List<NavBar> = listOf(NavBar.MODE_GESTURAL, NavBar.MODE_3BUTTON)
    }

    @get:Rule
    val setUpRule = ApplyPerParameterRule(
        Utils.testSetupRule(navBar).around(recordTraceWithTransitionRule),
        params = arrayOf(navBar)
    )

    override val traceDataReader
        get() = recordTraceWithTransitionRule.reader

    override val previousApp: IComponentNameMatcher
        get() = DismissExpandedBubbleViaBubbleBarTest.previousApp

    @Before
    override fun setUp() {
        assumeTrue(tapl.isTablet)
        super.setUp()
    }

    @Test
    override fun previousAppWindowReplacesTestAppAsTopWindow() {
        wmTraceSubject
            .isAppWindowOnTop(testApp)
            .then()
            // Launcher becomes the top when touching task bar
            .isAppWindowOnTop(LAUNCHER, isOptional = true)
            .then()
            .isAppWindowOnTop(previousApp)
            .forAllEntries()
    }

    @Test
    override fun focusChanges() {
        eventLogSubject.focusChanges(
            testApp.toWindowName(),
            // Launcher get focus when tapping bubble bar
            LAUNCHER.toWindowName(),
            previousApp.toWindowName()
        )
    }
}
+4 −5
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import com.android.wm.shell.Flags
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.bubbles.testcase.DismissExpandedBubbleTestCases
import com.android.wm.shell.flicker.bubbles.testcase.DismissSingleExpandedBubbleTestCases
import com.android.wm.shell.flicker.bubbles.utils.ApplyPerParameterRule
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.dismissBubbleAppViaBubbleView
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.launchBubbleViaBubbleMenu
@@ -55,7 +55,7 @@ import org.junit.runners.Parameterized
 * ```
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [DismissExpandedBubbleTestCases]
 * - [DismissSingleExpandedBubbleTestCases]
 */
@FlakyTest(bugId = 427850786)
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE)
@@ -64,11 +64,11 @@ import org.junit.runners.Parameterized
@Presubmit
@RunWith(Parameterized::class)
class DismissExpandedBubbleViaBubbleViewTest(navBar: NavBar) : BubbleFlickerTestBase(),
    DismissExpandedBubbleTestCases {
    DismissSingleExpandedBubbleTestCases {
    companion object : FlickerPropertyInitializer() {
        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
            setUpBeforeTransition = { launchBubbleViaBubbleMenu(testApp, tapl, wmHelper) },
            transition = { dismissBubbleAppViaBubbleView(wmHelper) },
            transition = { dismissBubbleAppViaBubbleView(testApp, wmHelper) },
            tearDownAfterTransition = { testApp.exit() }
        )

@@ -86,7 +86,6 @@ class DismissExpandedBubbleViaBubbleViewTest(navBar: NavBar) : BubbleFlickerTest
    override val traceDataReader
        get() = recordTraceWithTransitionRule.reader

    // TODO(b/396020056): Verify expand bubble with bubble bar.
    @Before
    override fun setUp() {
        assumeFalse(tapl.isTablet)
Loading