quicksettings

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package quicksettings is for controlling the Quick Settings directly from the UI.

Index

Constants

This section is empty.

Variables

View Source
var BatteryView = nodewith.Role(role.LabelText).ClassName("BatteryLabelView")

BatteryView is the finder for the Quick Settings date/time display.

View Source
var BluetoothDetailedViewPairNewDeviceButton = nodewith.ClassName("IconButton").NameContaining("Pair new device").Ancestor(bluetoothDetailedView)

BluetoothDetailedViewPairNewDeviceButton is the "Pair new device" button child within the detailed Bluetooth view.

View Source
var BluetoothDetailedViewSettingsButton = nodewith.ClassName("IconButton").NameContaining("Bluetooth settings").Ancestor(bluetoothDetailedView)

BluetoothDetailedViewSettingsButton is the Settings button child within the detailed Bluetooth view.

View Source
var BluetoothDetailedViewToggleButton = nodewith.ClassName("ToggleButton").NameContaining("Bluetooth").Ancestor(bluetoothDetailedView)

BluetoothDetailedViewToggleButton is the Bluetooth toggle child within the detailed Bluetooth view.

View Source
var BrightnessSlider = nodewith.Name("Brightness").ClassName("Slider").Role(role.Slider)

BrightnessSlider is the finder for the Quick Settings brightness slider.

View Source
var CollapseButton = nodewith.Role(role.Button).ClassName("CollapseButton").Name("Collapse menu")

CollapseButton is the finder for the collapse button, which collapses Quick Settings.

View Source
var DateView = nodewith.Role(role.Button).ClassName("DateView")

DateView is the finder for the Quick Settings date/time display.

View Source
var ExpandButton = nodewith.Role(role.Button).ClassName("CollapseButton").Name("Expand menu")

ExpandButton is the finder for the expand button, which expands Quick Settings.

View Source
var LockButton = nodewith.Name("Lock").ClassName("IconButton")

LockButton is the finder for Quick Settings' lock button.

View Source
var ManagedInfoView = nodewith.Role(role.Button).ClassName("EnterpriseManagedView")

ManagedInfoView is the finder for the Quick Settings management information display.

View Source
var MicGainSlider = nodewith.Name("Volume").ClassName("Slider").Role(role.Slider)

MicGainSlider is the finder for the Quick Settings mic gain slider. The Finder is identical to the volume slider, but it's located on a different page of Quick Settings.

View Source
var MicToggle = nodewith.Role(role.ToggleButton).Attribute("name", regexp.MustCompile("Toggle Mic"))

MicToggle is the finder for the button that toggles the microphone's mute status.

View Source
var SettingsButton = nodewith.Name("Settings").ClassName("IconButton")

SettingsButton is the finder for the Quick Settings' setting button.

View Source
var ShutdownButton = nodewith.Name("Shut down").ClassName("IconButton")

ShutdownButton is the finder for the shutdown button in Quick Settings.

View Source
var SignoutButton = nodewith.Role(role.Button).Name("Sign out").ClassName("PillButton")

SignoutButton is the finder for the 'Sign out' Quick Settings button.

SliderParamMap maps slider names (SliderType) to the to find the sliders in the UI.

View Source
var VolumeSlider = nodewith.Name("Volume").ClassName("Slider").Role(role.Slider)

VolumeSlider is the finder for the Quick Settings volume slider.

View Source
var VolumeToggle = nodewith.Role(role.ToggleButton).NameStartingWith("Toggle Volume")

VolumeToggle is the finder for the button that toggles the volume's mute status.

Functions

func ClickStatusArea

func ClickStatusArea(ctx context.Context, tconn *chrome.TestConn) error

ClickStatusArea clicks the status area, which is the area on the shelf where info such as time and battery level are shown.

func Collapse

func Collapse(ctx context.Context, tconn *chrome.TestConn) error

Collapse will result in the Quick Settings being opened and in a collapsed state. This is safe to call even when Quick Settings is already open.

func CommonElements

func CommonElements(ctx context.Context, tconn *chrome.TestConn, hasBattery, isLockedScreen bool) (map[string]*nodewith.Finder, error)

CommonElements returns a map that contains ui.FindParams for Quick Settings UI elements that are present in all sign-in states (signed in, signed out, screen locked). The keys of the map are descriptive names for the UI elements.

func DecreaseSlider

func DecreaseSlider(ctx context.Context, tconn *chrome.TestConn, kb *input.KeyboardEventWriter, slider SliderType) (int, error)

DecreaseSlider increments the slider positively using the keyboard and returns the new level.

func Expand

func Expand(ctx context.Context, tconn *chrome.TestConn) error

Expand will result in the Quick Settings being opened and in an expanded state. This is safe to call even when Quick Settings is already open.

func Hide

func Hide(ctx context.Context, tconn *chrome.TestConn) error

Hide will click the status area to hide Quick Settings if it's currently shown. It will then wait for it to be hidden for the duration specified by timeout.

func IncreaseSlider

func IncreaseSlider(ctx context.Context, tconn *chrome.TestConn, kb *input.KeyboardEventWriter, slider SliderType) (int, error)

IncreaseSlider increments the slider positively using the keyboard and returns the new level.

func LockScreen

func LockScreen(ctx context.Context, tconn *chrome.TestConn) error

LockScreen locks the screen.

func MicEnabled

func MicEnabled(ctx context.Context, tconn *chrome.TestConn) (bool, error)

MicEnabled checks if the microphone is enabled (unmuted).

func NavigateToBluetoothDetailedView(ctx context.Context, tconn *chrome.TestConn) error

NavigateToBluetoothDetailedView will navigate to the detailed Bluetooth view within the Quick Settings. This is safe to call even when the Quick Settings are already open.

func NotificationsHidden

func NotificationsHidden(ctx context.Context, tconn *chrome.TestConn) (bool, error)

NotificationsHidden checks that the 'Notifications are hidden' label appears and that no notifications are visible.

func OpenAudioSettings

func OpenAudioSettings(ctx context.Context, tconn *chrome.TestConn) error

OpenAudioSettings opens Quick Settings' audio settings page. It does nothing if the page is already open.

func OpenSettingsApp

func OpenSettingsApp(ctx context.Context, tconn *chrome.TestConn) error

OpenSettingsApp will launch the Settings app by clicking on the Settings icon and wait for its icon to appear in the shelf. Quick Settings will be opened if not already shown.

func PodIconButton

func PodIconButton(setting SettingPod) *nodewith.Finder

PodIconButton generates nodewith.Finder for the specified quick setting feature pod icon button.

func PodLabelButton

func PodLabelButton(setting SettingPod) *nodewith.Finder

PodLabelButton generates nodewith.Finder to enter the panel of the specified quick setting pod.

func PodRestricted

func PodRestricted(ctx context.Context, tconn *chrome.TestConn, setting SettingPod) (bool, error)

PodRestricted checks if a pod icon is restricted and unable to be used on the lock screen.

func Rect

func Rect(ctx context.Context, tconn *chrome.TestConn) (coords.Rect, error)

Rect returns a coords.Rect struct for the Quick Settings area, which contains coordinate information about the rectangular region it occupies on the screen. As clients of this function generally expect the bounds of the window, not the "UnifiedSystemTrayView" view itself, this finds a not that has UnifiedSystemTrayView as a child.

func SelectAudioOption

func SelectAudioOption(ctx context.Context, tconn *chrome.TestConn, device string) error

SelectAudioOption selects the audio input or output device with the given name from the audio settings page.

func SettingEnabled

func SettingEnabled(ctx context.Context, tconn *chrome.TestConn, setting SettingPod) (bool, error)

SettingEnabled checks if the specified quick setting is on or off. In order to check the setting, Quick Settings will be shown if it's not already, but the original state will be restored once the check is complete.

func Show

func Show(ctx context.Context, tconn *chrome.TestConn) error

Show will click the status area to show Quick Settings and wait for it to appear. If Quick Settings is already open, it does nothing. Quick Settings will remain open between tests if it's not closed explicitly, so this should be accompanied by a deferred call to Hide to clean up the UI before starting other tests.

func ShowWithRetry

func ShowWithRetry(ctx context.Context, tconn *chrome.TestConn, timeout time.Duration) error

ShowWithRetry will continuously click the status area until Quick Settings is shown, for the duration specified by timeout. Quick Settings sometimes does not open if the status area is clicked very early in the test, so this function can be used to ensure it will be opened. Callers should also defer a call to Hide to ensure Quick Settings is closed between tests. TODO(crbug/1099502): remove this once there's a better indicator for when the status area is ready to receive clicks.

func Shown

func Shown(ctx context.Context, tconn *chrome.TestConn) (bool, error)

Shown checks if Quick Settings exists in the UI.

func SignOut

func SignOut(ctx context.Context, tconn *chrome.TestConn) error

SignOut signouts by clicking signout button in Uber tray.

func SliderValue

func SliderValue(ctx context.Context, tconn *chrome.TestConn, slider SliderType) (int, error)

SliderValue returns the slider value as an integer. The slider node's value taken directly is a string expressing a percentage, like "50%".

func ToggleMic

func ToggleMic(ctx context.Context, tconn *chrome.TestConn, enable bool) error

ToggleMic toggles the microphone's enabled state by clicking the microphone icon adjacent to the slider. If the microphone is already in the desired state, this will do nothing.

func ToggleSetting

func ToggleSetting(ctx context.Context, tconn *chrome.TestConn, setting SettingPod, enable bool) error

ToggleSetting toggles a quick setting by clicking the corresponding pod icon. If Quick Settings is not already shown, it will be opened and then closed once the setting is toggled.

Types

type SettingPod

type SettingPod string

SettingPod represents the name of a setting pod in Quick Settings. These names are contained in the Name attribute of the automation node for the corresponding pod icon button, so they can be used to find the buttons in the UI.

const (
	SettingPodAccessibility SettingPod = "accessibility"
	SettingPodBluetooth     SettingPod = "Bluetooth"
	SettingPodDoNotDisturb  SettingPod = "Do not disturb"
	SettingPodNetwork       SettingPod = "network"
	SettingPodNightLight    SettingPod = "Night Light"
	SettingPodNearbyShare   SettingPod = "Nearby Share"
	SettingPodKeyboard      SettingPod = "keyboard"
	SettingPodScreenCapture SettingPod = "Screen capture"
)

List of quick setting names, derived from the corresponding pod icon button node names. Character case in the names should exactly match the pod icon button node Name attribute.

func RestrictedSettingsPods

func RestrictedSettingsPods(ctx context.Context) ([]SettingPod, error)

RestrictedSettingsPods returns the setting pods that are restricted when Quick Settings is opened while a user is not signed in.

type SliderType

type SliderType string

SliderType represents the Quick Settings slider elements.

const (
	SliderTypeVolume     SliderType = "Volume"
	SliderTypeBrightness SliderType = "Brightness"
	SliderTypeMicGain    SliderType = "Mic gain"
)

List of descriptive slider names. These don't correspond to any UI node attributes, but will be used as keys to map descriptive names to the finders defined below.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL