Documentation
¶
Overview ¶
Package quicksettings is for controlling the Quick Settings directly from the UI.
Index ¶
- Variables
- func ClickStatusArea(ctx context.Context, tconn *chrome.TestConn) error
- func Collapse(ctx context.Context, tconn *chrome.TestConn) error
- func CommonElements(ctx context.Context, tconn *chrome.TestConn, hasBattery, isLockedScreen bool) (map[string]*nodewith.Finder, error)
- func DecreaseSlider(ctx context.Context, tconn *chrome.TestConn, kb *input.KeyboardEventWriter, ...) (int, error)
- func Expand(ctx context.Context, tconn *chrome.TestConn) error
- func Hide(ctx context.Context, tconn *chrome.TestConn) error
- func IncreaseSlider(ctx context.Context, tconn *chrome.TestConn, kb *input.KeyboardEventWriter, ...) (int, error)
- func LockScreen(ctx context.Context, tconn *chrome.TestConn) error
- func MicEnabled(ctx context.Context, tconn *chrome.TestConn) (bool, error)
- func NavigateToBluetoothDetailedView(ctx context.Context, tconn *chrome.TestConn) error
- func NotificationsHidden(ctx context.Context, tconn *chrome.TestConn) (bool, error)
- func OpenAudioSettings(ctx context.Context, tconn *chrome.TestConn) error
- func OpenSettingsApp(ctx context.Context, tconn *chrome.TestConn) error
- func PodIconButton(setting SettingPod) *nodewith.Finder
- func PodLabelButton(setting SettingPod) *nodewith.Finder
- func PodRestricted(ctx context.Context, tconn *chrome.TestConn, setting SettingPod) (bool, error)
- func Rect(ctx context.Context, tconn *chrome.TestConn) (coords.Rect, error)
- func SelectAudioOption(ctx context.Context, tconn *chrome.TestConn, device string) error
- func SettingEnabled(ctx context.Context, tconn *chrome.TestConn, setting SettingPod) (bool, error)
- func Show(ctx context.Context, tconn *chrome.TestConn) error
- func ShowWithRetry(ctx context.Context, tconn *chrome.TestConn, timeout time.Duration) error
- func Shown(ctx context.Context, tconn *chrome.TestConn) (bool, error)
- func SignOut(ctx context.Context, tconn *chrome.TestConn) error
- func SliderValue(ctx context.Context, tconn *chrome.TestConn, slider SliderType) (int, error)
- func ToggleMic(ctx context.Context, tconn *chrome.TestConn, enable bool) error
- func ToggleSetting(ctx context.Context, tconn *chrome.TestConn, setting SettingPod, enable bool) error
- type SettingPod
- type SliderType
Constants ¶
This section is empty.
Variables ¶
var BatteryView = nodewith.Role(role.LabelText).ClassName("BatteryLabelView")
BatteryView is the finder for the Quick Settings date/time display.
var BluetoothDetailedViewPairNewDeviceButton = nodewith.ClassName("IconButton").NameContaining("Pair new device").Ancestor(bluetoothDetailedView)
BluetoothDetailedViewPairNewDeviceButton is the "Pair new device" button child within the detailed Bluetooth view.
var BluetoothDetailedViewSettingsButton = nodewith.ClassName("IconButton").NameContaining("Bluetooth settings").Ancestor(bluetoothDetailedView)
BluetoothDetailedViewSettingsButton is the Settings button child within the detailed Bluetooth view.
var BluetoothDetailedViewToggleButton = nodewith.ClassName("ToggleButton").NameContaining("Bluetooth").Ancestor(bluetoothDetailedView)
BluetoothDetailedViewToggleButton is the Bluetooth toggle child within the detailed Bluetooth view.
var BrightnessSlider = nodewith.Name("Brightness").ClassName("Slider").Role(role.Slider)
BrightnessSlider is the finder for the Quick Settings brightness slider.
var CollapseButton = nodewith.Role(role.Button).ClassName("CollapseButton").Name("Collapse menu")
CollapseButton is the finder for the collapse button, which collapses Quick Settings.
var DateView = nodewith.Role(role.Button).ClassName("DateView")
DateView is the finder for the Quick Settings date/time display.
var ExpandButton = nodewith.Role(role.Button).ClassName("CollapseButton").Name("Expand menu")
ExpandButton is the finder for the expand button, which expands Quick Settings.
var LockButton = nodewith.Name("Lock").ClassName("IconButton")
LockButton is the finder for Quick Settings' lock button.
var ManagedInfoView = nodewith.Role(role.Button).ClassName("EnterpriseManagedView")
ManagedInfoView is the finder for the Quick Settings management information display.
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.
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.
var SettingsButton = nodewith.Name("Settings").ClassName("IconButton")
SettingsButton is the finder for the Quick Settings' setting button.
var ShutdownButton = nodewith.Name("Shut down").ClassName("IconButton")
ShutdownButton is the finder for the shutdown button in Quick Settings.
var SignoutButton = nodewith.Role(role.Button).Name("Sign out").ClassName("PillButton")
SignoutButton is the finder for the 'Sign out' Quick Settings button.
var SliderParamMap = map[SliderType]*nodewith.Finder{ SliderTypeVolume: VolumeSlider, SliderTypeBrightness: BrightnessSlider, SliderTypeMicGain: MicGainSlider, }
SliderParamMap maps slider names (SliderType) to the to find the sliders in the UI.
var VolumeSlider = nodewith.Name("Volume").ClassName("Slider").Role(role.Slider)
VolumeSlider is the finder for the Quick Settings volume slider.
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 ¶
ClickStatusArea clicks the status area, which is the area on the shelf where info such as time and battery level are shown.
func Collapse ¶
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 ¶
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 ¶
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 ¶
LockScreen locks the screen.
func MicEnabled ¶
MicEnabled checks if the microphone is enabled (unmuted).
func NavigateToBluetoothDetailedView ¶
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 ¶
NotificationsHidden checks that the 'Notifications are hidden' label appears and that no notifications are visible.
func OpenAudioSettings ¶
OpenAudioSettings opens Quick Settings' audio settings page. It does nothing if the page is already open.
func OpenSettingsApp ¶
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 ¶
PodRestricted checks if a pod icon is restricted and unable to be used on the lock screen.
func Rect ¶
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 ¶
SelectAudioOption selects the audio input or output device with the given name from the audio settings page.
func SettingEnabled ¶
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 ¶
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 ¶
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 SliderValue ¶
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 ¶
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" 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.