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

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

Verify dismiss all collapsed bubble apps

Test: atest DismissAllCollapsedBubblesTest
Bug: 396020056
Flag: TEST_ONLY
Change-Id: I7e474d5eb8c0cee5353e1064194b5c2638df491e
parent b1e56f29
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.DismissAllCollapsedBubbleAppsTest",
        "com.android.wm.shell.flicker.bubbles.DismissExpandedBubbleViaBubbleBarTest",
        "com.android.wm.shell.flicker.bubbles.DismissExpandedBubbleViaBubbleBarHandleTest",
        "com.android.wm.shell.flicker.bubbles.DismissExpandedBubbleViaBubbleViewTest",
@@ -94,6 +95,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.bubbles.CollapseBubbleAppViaBackTest"],
}

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

test_module_config {
    name: "WMShellExplicitFlickerTestsBubbles-DismissExpandedBubbleViaBubbleBarTest",
    base: "WMShellExplicitFlickerTestsBubbles",
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@
    {
      "name": "WMShellExplicitFlickerTestsBubbles-CollapseBubbleAppViaTouchOutsideTest"
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-DismissAllCollapsedBubbleAppsTest"
    },
    {
      "name": "WMShellExplicitFlickerTestsBubbles-DismissExpandedBubbleViaBubbleBarTest"
    },
+101 −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 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.BubbleDismissesTestCases
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.dismissAllBubbles
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.FixMethodOrder
import org.junit.Rule
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized

/**
 * Test dismissing a collapsed stack of bubbles.
 *
 * To run this test: `atest WMShellExplicitFlickerTestsBubbles:DismissAllCollapsedBubbleAppsTest`
 *
 * Pre-steps:
 * ```
 *     1. Launch [testApp] and [messagingApp] into bubbles.
 *     2. Collapse the bubbles into a stack.
 * ```
 *
 * Actions:
 * ```
 *     Drag the collapsed bubble stack to the dismiss target.
 * ```
 *
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [BubbleDismissesTestCases]
 */
@FlakyTest(bugId = 430273288)
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE)
@RequiresDevice
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Presubmit
@RunWith(Parameterized::class)
class DismissAllCollapsedBubbleAppsTest(navBar: NavBar) : BubbleFlickerTestBase(),
    BubbleDismissesTestCases {

    companion object : FlickerPropertyInitializer() {
        private val previousApp = MessagingAppHelper(instrumentation)

        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
            setUpBeforeTransition = {
                launchBubbleViaBubbleMenu(previousApp, tapl, wmHelper)
                collapseBubbleAppViaTouchOutside(previousApp, wmHelper)
                launchBubbleViaBubbleMenu(testApp, tapl, wmHelper)
                collapseBubbleAppViaTouchOutside(testApp, wmHelper)
            },
            transition = {
                dismissAllBubbles(tapl, wmHelper)
            },
            tearDownAfterTransition = {
                previousApp.exit()
                testApp.exit()
            }
        )

        @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
}
+77 −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.testcase

import android.tools.traces.component.ComponentNameMatcher.Companion.BUBBLE
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerSubjects
import org.junit.Test

/**
 * Verifies bubble and its app are dismissed.
 */
interface BubbleDismissesTestCases : BubbleFlickerSubjects {

    /**
     * Verifies [BUBBLE] window is gone at the end of the transition.
     */
    @Test
    fun bubbleWindowIsGoneAtEnd() {
        wmStateSubjectAtEnd.notContains(BUBBLE)
    }

    /**
     * Verifies [BUBBLE] layer is gone at the end of the transition.
     */
    @Test
    fun bubbleLayerIsGoneAtEnd() {
        layerTraceEntrySubjectAtEnd.notContains(BUBBLE)
    }

    /**
     * Verifies [BUBBLE] window was visible then disappears.
     */
    @Test
    fun bubbleWindowWasVisibleThenDisappear() {
        wmTraceSubject
            .isAboveAppWindowVisible(BUBBLE)
            .then()
            // Use #isNonAppWindowInvisible here because the BUBBLE window may have been removed
            // from WM hierarchy.
            .isNonAppWindowInvisible(BUBBLE)
            .forAllEntries()
    }

    /**
     * Verifies [BUBBLE] layer was visible then disappears.
     */
    @Test
    fun bubbleLayerWasVisibleThenDisappear() {
        layersTraceSubject
            .isVisible(BUBBLE)
            .then()
            .isInvisible(BUBBLE)
            .forAllEntries()
    }

    /**
     * Verifies bubble app window is gone at the end of the transition.
     */
    @Test
    fun appWindowIsGoneAtEnd() {
        wmStateSubjectAtEnd.notContains(testApp)
    }
}
+2 −62
Original line number Diff line number Diff line
@@ -16,73 +16,13 @@

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

import android.tools.traces.component.ComponentNameMatcher.Companion.BUBBLE
import org.junit.Test

/**
 * Verifies a single bubble app [testApp] is dismissed, and bubble window
 * (represented as expanded bubble or bubble bar) is also dismissed.
 *
 * - [BubbleAppBecomesNotExpandedTestCases]
 * - [LauncherAlwaysVisibleTestCases]
 * - [BUBBLE] is visible and then disappear
 * - [BubbleDismissesTestCases]
 */
interface DismissSingleExpandedBubbleTestCases : BubbleAppBecomesNotExpandedTestCases,
    LauncherAlwaysVisibleTestCases {

// region Bubble related tests

    /**
     * Verifies [BUBBLE] window is gone at the end of the transition.
     */
    @Test
    fun bubbleWindowIsGoneAtEnd() {
        wmStateSubjectAtEnd.notContains(BUBBLE)
    }

    /**
     * Verifies [BUBBLE] layer is gone at the end of the transition.
     */
    @Test
    fun bubbleLayerIsGoneAtEnd() {
        layerTraceEntrySubjectAtEnd.notContains(BUBBLE)
    }

    /**
     * Verifies [BUBBLE] window was visible then disappear.
     */
    @Test
    fun bubbleWindowWasVisibleThenDisappear() {
        wmTraceSubject
            .isAboveAppWindowVisible(BUBBLE)
            .then()
            // Use #isNonAppWindowInvisible here because the BUBBLE window may have been removed
            // from WM hierarchy.
            .isNonAppWindowInvisible(BUBBLE)
            .forAllEntries()
    }

    /**
     * Verifies [BUBBLE] layer was visible then disappear.
     */
    @Test
    fun bubbleLayerWasVisibleThenDisappear() {
        layersTraceSubject
            .isVisible(BUBBLE)
            .then()
            .isInvisible(BUBBLE)
            .forAllEntries()
    }

// endregion

// region bubble app related tests

    /**
     * Verifies bubble app window is gone at the end of the transition.
     */
    @Test
    fun appWindowIsGoneAtEnd() {
        wmStateSubjectAtEnd.notContains(testApp)
    }
}
 No newline at end of file
   LauncherAlwaysVisibleTestCases, BubbleDismissesTestCases
Loading