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

Commit 2397c213 authored by Hanna Nizhnikava's avatar Hanna Nizhnikava Committed by Android (Google) Code Review
Browse files

Merge "Add tests for a desktop app opening using KB shortcut" into main

parents 0aac7834 d0def2f9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -96,6 +96,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.keyboardshortcuts.AltTabSwitchInDesktopModeFlickerTest"],
}

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-keyboardshortcuts-OpenBrowserWithKeyboardShortcutFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.flicker.keyboardshortcuts.OpenBrowserWithKeyboardShortcutFlickerTest"],
}

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-fundamentals-CloseAllAppsViaAppHeaderExitTest",
    base: "WMShellFlickerTestsDesktopMode",
+3 −0
Original line number Diff line number Diff line
@@ -57,6 +57,9 @@
    {
      "name": "WMShellFlickerTestsDesktopMode-keyboardshortcuts-MinimizeAppsWithKeyboardFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-keyboardshortcuts-OpenBrowserWithKeyboardShortcutFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-maximize-ExitDesktopToFullScreenWithDragToTopDragZoneFlickerTest"
    },
+91 −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.keyboardshortcuts

import android.tools.NavBar
import android.tools.flicker.assertions.FlickerChecker
import android.tools.flicker.FlickerBuilder
import android.tools.flicker.FlickerTest
import android.tools.flicker.FlickerTestFactory
import android.tools.flicker.junit.FlickerParametersRunnerFactory
import androidx.test.filters.RequiresDevice
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.flicker.utils.appWindowInsideDisplayBoundsAtEnd
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.layerBecomesVisible
import com.android.wm.shell.flicker.utils.cascadingEffectAppliedAtEnd
import com.android.wm.shell.scenarios.OpenBrowserWithKeyboardShortcut
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Tests desktop app opening using the 'Action + B' keyboard shortcut.
 *
 * To run this test: atest OpenBrowserWithKeyboardShortcutFlickerTest
 */
@RequiresDevice
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class OpenBrowserWithKeyboardShortcutFlickerTest(flicker: FlickerTest) : DesktopModeBaseTest(flicker) {
    inner class OpenBrowserWithKeyboardShortcutScenario : OpenBrowserWithKeyboardShortcut(rotation = flicker.scenario.startRotation)

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = OpenBrowserWithKeyboardShortcutScenario()

    private val browserAppHelper = scenario.browserAppHelper

    override val transition: FlickerBuilder.() -> Unit
        get() = {
            setup {
                scenario.setup()
            }
            transitions {
                scenario.openBrowserWithKeyboardShortcut()
            }
            teardown {
                scenario.teardown()
            }
        }

    @Test
    fun appWindowInsideDisplayBoundsAtEnd() =
        flicker.appWindowInsideDisplayBoundsAtEnd(browserAppHelper)

    @Test
    fun appWindowOnTopAtEnd() = flicker.appWindowOnTopAtEnd(browserAppHelper)

    @Test
    fun layerBecomesVisible() = flicker.layerBecomesVisible(browserAppHelper)

    @Test
    fun cascadingEffectAppliedAtEnd() = flicker.cascadingEffectAppliedAtEnd(browserAppHelper)

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerChecker> {
            return FlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ test_module_config {
        "com.android.wm.shell.functional.fundamentals.focus.OpenAndFocusTest",
        "com.android.wm.shell.functional.keyboardshortcuts.EnterDesktopFromKeyboardShortcutTest",
        "com.android.wm.shell.functional.keyboardshortcuts.ExitDesktopFromKeyboardShortcutTest",
        "com.android.wm.shell.functional.keyboardshortcuts.OpenBrowserWithKeyboardShortcutTest",
        "com.android.wm.shell.functional.maximize.ExitDesktopWithDragToTopDragZoneTest",
        "com.android.wm.shell.functional.maximize.MaximizeAppWindowTest",
        "com.android.wm.shell.functional.maximize.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstTest",
+3 −0
Original line number Diff line number Diff line
@@ -144,6 +144,9 @@
    {
      "name": "FunctionalTestsDesktopMode-keyboardshortcuts-ExitDesktopFromKeyboardShortcutTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-keyboardshortcuts-OpenBrowserWithKeyboardShortcutTest"
    },
    {
      "name": "FunctionalTestsDesktopMode-maximize-ExitDesktopWithDragToTopDragZoneTest"
    },
Loading