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

Commit 9d140fd3 authored by Charles Chen's avatar Charles Chen
Browse files

Verify collapse bubble via touch outside

Test: atest CollapseBubbleAppViaTouchOutsideTest
Bug: 396020056
Flag: TEST_ONLY
Change-Id: I7e46d52e14d64cd9429ae7284eb8de35e1177037
parent 7a9b93d4
Loading
Loading
Loading
Loading
+4 −17
Original line number Diff line number Diff line
@@ -22,8 +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.BubbleAlwaysVisibleTestCases
import com.android.wm.shell.flicker.bubbles.testcase.BubbleAppBecomesNotExpandedTestCases
import com.android.wm.shell.flicker.bubbles.testcase.CollapseBubbleAppTestCases
import com.android.wm.shell.flicker.bubbles.utils.ApplyPerParameterRule
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.collapseBubbleAppViaBackKey
import com.android.wm.shell.flicker.bubbles.utils.BubbleFlickerTestHelper.launchBubbleViaBubbleMenu
@@ -31,7 +30,6 @@ 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.Test
import org.junit.runners.MethodSorters

/**
@@ -51,17 +49,14 @@ import org.junit.runners.MethodSorters
 *
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [BubbleAlwaysVisibleTestCases]
 * - [BubbleAppBecomesNotExpandedTestCases]
 * - [CollapseBubbleAppTestCases]
 */
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE)
@RequiresDevice
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Presubmit
class CollapseBubbleAppViaBackTest(navBar: NavBar) :
    BubbleFlickerTestBase(),
    BubbleAlwaysVisibleTestCases,
    BubbleAppBecomesNotExpandedTestCases
class CollapseBubbleAppViaBackTest(navBar: NavBar) : BubbleFlickerTestBase(),
    CollapseBubbleAppTestCases
{
    companion object : FlickerPropertyInitializer() {
        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
@@ -79,12 +74,4 @@ class CollapseBubbleAppViaBackTest(navBar: NavBar) :

    override val traceDataReader
        get() = recordTraceWithTransitionRule.reader

    /**
     * Verifies bubble app window is invisible at the end of the transition.
     */
    @Test
    override fun appWindowIsInvisibleAtEnd() {
        wmStateSubjectAtEnd.isAppWindowInvisible(testApp, mustExist = true)
    }
}
 No newline at end of file
+78 −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 androidx.test.filters.RequiresDevice
import com.android.wm.shell.Flags
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.bubbles.testcase.CollapseBubbleAppTestCases
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.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.runners.MethodSorters

/**
 * Test collapse bubble app via touching outside the bubble window.
 *
 * To run this test: `atest WMShellExplicitFlickerTestsBubbles:CollapseBubbleAppViaTouchOutsideTest`
 *
 * Pre-steps:
 * ```
 *     Launch [testApp] into bubble
 * ```
 *
 * Actions:
 * ```
 *     Collapse bubbled [testApp] via touching outside the bubble window
 * ```
 *
 * Verified tests:
 * - [BubbleFlickerTestBase]
 * - [CollapseBubbleAppTestCases]
 */
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE)
@RequiresDevice
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Presubmit
class CollapseBubbleAppViaTouchOutsideTest(navBar: NavBar) :
    BubbleFlickerTestBase(),
    CollapseBubbleAppTestCases
{
    companion object : FlickerPropertyInitializer() {
        private val recordTraceWithTransitionRule = RecordTraceWithTransitionRule(
            setUpBeforeTransition = { launchBubbleViaBubbleMenu(testApp, tapl, wmHelper) },
            transition = { collapseBubbleAppViaTouchOutside(testApp, wmHelper) },
            tearDownAfterTransition = { testApp.exit(wmHelper) }
        )
    }

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

    override val traceDataReader
        get() = recordTraceWithTransitionRule.reader
}
+37 −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 org.junit.Test

/**
 * Verifies collapsing a bubble, which verifies:
 * - [BubbleAlwaysVisibleTestCases]
 * - [BubbleAppBecomesNotExpandedTestCases]
 */
interface CollapseBubbleAppTestCases : BubbleAlwaysVisibleTestCases,
    BubbleAppBecomesNotExpandedTestCases
{

    /**
     * Verifies bubble app window is invisible at the end of the transition.
     */
    @Test
    override fun appWindowIsInvisibleAtEnd() {
        wmStateSubjectAtEnd.isAppWindowInvisible(testApp, mustExist = true)
    }
}
 No newline at end of file