ossettings

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: 16 Imported by: 0

Documentation

Overview

Package ossettings supports controlling the Settings App on Chrome OS. This differs from Chrome settings (chrome://settings vs chrome://os-settings)

Index

Constants

This section is empty.

Variables

View Source
var (
	// AddLanguagesButton is the finder for the add language button UI in the languages page.
	AddLanguagesButton = nodewith.Name("Add languages").Role(role.Button)

	// SearchLanguages is the finder for the search language searchbox UI in the languages page.
	SearchLanguages = nodewith.Name("Search languages").Role(role.SearchBox)
)

Elements in "Languages page"

View Source
var (
	VersionInfo       = nodewith.NameStartingWith("Version ").Role(role.StaticText)
	CheckUpdateBtn    = nodewith.Name("Check for updates").Role(role.Button)
	ReportIssue       = nodewith.Name("Report an issue").Role(role.Link)
	AdditionalDetails = nodewith.Name("Additional details").Role(role.Link)
	TermsOfService    = nodewith.Name("Terms of Service").Role(role.Link)

	// OpenSourceSoftwares matches two links, needs specify when using.
	OpenSourceSoftwares = nodewith.Name("open source software").Role(role.Link)

	ChangeChannelBtn = nodewith.Name("Change channel").Role(role.Button)
	BuildDetailsBtn  = nodewith.Name("Build details").Role(role.Button)
)

Elements in "AboutChromeOS"

View Source
var (
	// ConnectedStatus is the finder for the connected status text UI in the cellular detail page.
	ConnectedStatus = nodewith.Name("Connected").Role(role.StaticText)

	// DisconnectedStatus is the finder for the disconnected status text UI in the cellular detail page.
	DisconnectedStatus = nodewith.Name("Not Connected").Role(role.StaticText)

	// ConnectingStatus is the finder for the connecting status text UI in the cellular detail page.
	ConnectingStatus = nodewith.NameStartingWith("Connecting").Role(role.StaticText)

	// connectButton is the finder for the connect button UI in the cellular detail page.
	ConnectButton = nodewith.Name("Connect").Role(role.Button)

	// disconnectButton is the finder for the disconnect button UI in the cellular detail page.
	DisconnectButton = nodewith.Name("Disconnect").Role(role.Button)

	// RoamingToggle is the finder for the roaming toggle UI in the cellular detail page.
	RoamingToggle = nodewith.Name("Allow mobile data roaming").Role(role.ToggleButton)
)

Elements in "Cellular detail page"

View Source
var AboutChromeOS = nodewith.MultilingualName("About Chrome OS", map[string]string{"de": "Über Chrome OS"}).
	Role(role.Link)

AboutChromeOS is a subpage link.

View Source
var Accessibility = nodewith.Name("Accessibility").Role(role.Link).HasClass("item").Focusable()

Accessibility is a subpage link.

View Source
var Accounts = nodewith.Name("Accounts").Role(role.Link).HasClass("item").Focusable()

Accounts is a subpage link.

View Source
var AddCellularButton = nodewith.NameStartingWith("Add Cellular").Role(role.Button)

AddCellularButton is the finder for the Add Cellular button in cellular network list

View Source
var Advanced = nodewith.Role(role.Button).Ancestor(nodewith.Role(role.Heading).Name("Advanced"))

Advanced is a button to expand advanced options.

View Source
var Apps = nodewith.Name("Apps").Role(role.Link).HasClass("item").Focusable()

Apps is a subpage link.

View Source
var BackArrowBtn = nodewith.HasClass("icon-arrow-back").Role(role.Button)

BackArrowBtn is the button to return to last page.

View Source
var Bluetooth = nodewith.Name("Bluetooth").Role(role.Link).HasClass("item").Focusable()

Bluetooth is a subpage link.

View Source
var BluetoothPairNewDeviceButton = nodewith.NameContaining("Pair new device").Role(role.Button)

BluetoothPairNewDeviceButton is the "pair new device" button within the OS Settings and Bluetooth Settings.

View Source
var BluetoothPairNewDeviceModal = nodewith.NameContaining("Pair new device").Role(role.Heading)

BluetoothPairNewDeviceModal is the modal that is opened when the "pair new device" button within either the OS Settings or Bluetooth Settings is pressed.

View Source
var ConnectedDevices = nodewith.Name("Connected devices").Role(role.Link).HasClass("item").Focusable()

ConnectedDevices is a subpage link.

View Source
var DateAndTime = nodewith.Name("Date and time").Role(role.Link).HasClass("item").Focusable()

DateAndTime is a subpage link.

View Source
var Developers = nodewith.Name("Developers").Role(role.Link).HasClass("item").Focusable()

Developers is a subpage link.

View Source
var Device = nodewith.Name("Device").Role(role.Link).HasClass("item").Focusable()

Device is a subpage link.

View Source
var Files = nodewith.Name("Files").Role(role.Link).HasClass("item").Focusable()

Files is a subpage link.

View Source
var LanguagesAndInputs = nodewith.Name("Languages and inputs").Role(role.Link).HasClass("item").Focusable()

LanguagesAndInputs is a subpage link.

View Source
var MenuButton = nodewith.Name("Main menu").Role(role.Button).Focusable()

MenuButton is a button to show the menu on the left side, only exist when the menu does not exist.

View Source
var Network = nodewith.Name("Network").Role(role.Link).HasClass("item").Focusable()

Network is a subpage link.

View Source
var OsSettingsBluetoothToggleButton = nodewith.NameContaining("Bluetooth").Role(role.ToggleButton)

OsSettingsBluetoothToggleButton is the Bluetooth toggle on the OS Settings page.

View Source
var Personalization = nodewith.Name("Personalization").Role(role.Link).HasClass("item").Focusable()

Personalization is a subpage link.

View Source
var PrintAndScan = nodewith.Name("Print and scan").Role(role.Link).HasClass("item").Focusable()

PrintAndScan is a subpage link.

View Source
var ResetSettings = nodewith.Name("Reset settings").Role(role.Link).HasClass("item").Focusable()

ResetSettings is a subpage link.

View Source
var SearchAndAssistant = nodewith.Name("Search and Assistant").Role(role.Link).HasClass("item").Focusable()

SearchAndAssistant is a subpage link.

View Source
var SearchBoxFinder = nodewith.MultilingualName("Search settings", map[string]string{"de": "In Einstellungen suchen"}).
	Role(role.SearchBox).Ancestor(WindowFinder)

SearchBoxFinder is the finder for the search box in the settings app.

View Source
var SecurityAndPrivacy = nodewith.Name("Security and Privacy").Role(role.Link).HasClass("item").Focusable()

SecurityAndPrivacy is a subpage link.

View Source
var WindowFinder *nodewith.Finder = nodewith.MultilingualNameStartingWith("Settings", map[string]string{"de": "Einstellungen"}).
	Role(role.Window).First()

WindowFinder is the finder for the Settings window.

Functions

func CommonSections

func CommonSections(advanceExpanded bool) map[string]*nodewith.Finder

CommonSections returns a map that contains *nodewith.Finder for OS-Settings UI elements of common sections.

func UninstallApp

func UninstallApp(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome, appName, appID string) error

UninstallApp uninstalls an app from the Settings app. It first opens the Settings app on the apps page. If it fails to open the page, it thinks the app is not there so no need to uninstall and returns nil. Then it clicks the Uninstall button to uninstall.

Types

type AuthenticationToken

type AuthenticationToken struct {
	Token           string `json:"token"`
	LifetimeSeconds int    `json:"lifetimeSeconds"`
}

AuthenticationToken represents an authentication token.

type OSSettings

type OSSettings struct {
	// contains filtered or unexported fields
}

OSSettings represents an instance of the Settings app.

func Launch

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

Launch launches the Settings app. An error is returned if the app fails to launch.

func LaunchAtAppMgmtPage

func LaunchAtAppMgmtPage(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome, appID string, condition func(context.Context) error) (*OSSettings, error)

LaunchAtAppMgmtPage launches the Settings app at a particular app management page under app via changing URL in javascript. The URL includes an App ID. It calls LaunchAtPageURL.

func LaunchAtPage

func LaunchAtPage(ctx context.Context, tconn *chrome.TestConn, subpage *nodewith.Finder) (*OSSettings, error)

LaunchAtPage launches the Settings app at a particular page. An error is returned if the app fails to launch. TODO (b/189055966): Fix the failure to launch the right subpage.

func LaunchAtPageURL

func LaunchAtPageURL(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome, pageShortURL string, condition func(context.Context) error) (*OSSettings, error)

LaunchAtPageURL launches the Settings app at a particular page via changing URL in javascript. It uses a condition check to make sure the function completes correctly. It is high recommended to use UI validation in condition check.

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

NavigateToBluetoothSettingsPage will navigate to the Bluetooth sub-page within the OS Settings by clicking the sub-page button. This is safe to call when the OS Settings are already open.

func New

func New(tconn *chrome.TestConn) *OSSettings

New returns a new ossettings context. OSSettings can be launched from a page or app.

func OpenMobileDataSubpage

func OpenMobileDataSubpage(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome) (*OSSettings, error)

OpenMobileDataSubpage navigates Settings app to mobile data subpage.

func (*OSSettings) AuthToken

func (s *OSSettings) AuthToken(ctx context.Context, settingsConn *chrome.Conn, password string) (*AuthenticationToken, error)

AuthToken retrieves an authentication token that is needed to toggle some protected settings. It allows us to automatically change things that would require a user to type their password if done manually.

func (*OSSettings) ChromeConn

func (s *OSSettings) ChromeConn(ctx context.Context, cr *chrome.Chrome) (*chrome.Conn, error)

ChromeConn returns a Chrome connection to the Settings app.

func (*OSSettings) ClearSearch

func (s *OSSettings) ClearSearch() uiauto.Action

ClearSearch clears text in `SearchBox` and waits for the search results to be gone.

func (*OSSettings) Close

func (s *OSSettings) Close(ctx context.Context) error

Close closes the Settings app. This is automatically done when chrome resets and is not necessary to call.

func (*OSSettings) DoubleClick

func (s *OSSettings) DoubleClick(finder *nodewith.Finder) uiauto.Action

DoubleClick calls ui.DoubleClick scoping the finder to the Settings app.

func (*OSSettings) DropdownValue

func (s *OSSettings) DropdownValue(ctx context.Context, cr *chrome.Chrome, dropdownName string) (string, error)

DropdownValue returns the value of a dropdown setting.

func (*OSSettings) EnablePINUnlock

func (s *OSSettings) EnablePINUnlock(cr *chrome.Chrome, password, PIN string, autosubmit bool) uiauto.Action

EnablePINUnlock returns a function that enables unlocking the device with the specified PIN.

func (*OSSettings) EvalJSWithShadowPiercer

func (s *OSSettings) EvalJSWithShadowPiercer(ctx context.Context, cr *chrome.Chrome, expr string, out interface{}) error

EvalJSWithShadowPiercer executes javascript in Settings app web page.

func (*OSSettings) Exists

func (s *OSSettings) Exists(finder *nodewith.Finder) uiauto.Action

Exists calls ui.Exists scoping the finder to the Settings app.

func (*OSSettings) FocusAndWait

func (s *OSSettings) FocusAndWait(finder *nodewith.Finder) uiauto.Action

FocusAndWait calls ui.FocusAndWait scoping the finder to the Settings app.

func (*OSSettings) Gone

func (s *OSSettings) Gone(finder *nodewith.Finder) uiauto.Action

Gone calls ui.Gone scoping the finder to the Settings app.

func (*OSSettings) Info

func (s *OSSettings) Info(ctx context.Context, finder *nodewith.Finder) (*uiauto.NodeInfo, error)

Info calls ui.Info scoping the finder to the Settings app.

func (*OSSettings) IsNodeFound

func (s *OSSettings) IsNodeFound(ctx context.Context, finder *nodewith.Finder) (bool, error)

IsNodeFound returns calls ui.IsNodeFound scoping the finder to the Settings app.

func (*OSSettings) IsToggleOptionEnabled

func (s *OSSettings) IsToggleOptionEnabled(ctx context.Context, cr *chrome.Chrome, optionName string) (bool, error)

IsToggleOptionEnabled checks whether the toggle option is enabled or not.

func (*OSSettings) LaunchHelpApp

func (s *OSSettings) LaunchHelpApp() uiauto.Action

LaunchHelpApp returns a function that launches Help app by clicking "Get help with Chrome OS".

func (*OSSettings) LaunchWhatsNew

func (s *OSSettings) LaunchWhatsNew() uiauto.Action

LaunchWhatsNew returns a function that launches Help app by clicking "See what's new".

func (*OSSettings) LeftClick

func (s *OSSettings) LeftClick(finder *nodewith.Finder) uiauto.Action

LeftClick calls ui.LeftClick scoping the finder to the Settings app.

func (*OSSettings) LeftClickUntil

func (s *OSSettings) LeftClickUntil(finder *nodewith.Finder, condition func(context.Context) error) uiauto.Action

LeftClickUntil calls ui.LeftClickUntil scoping the finder to the Settings app.

func (*OSSettings) MakeVisible

func (s *OSSettings) MakeVisible(finder *nodewith.Finder) uiauto.Action

MakeVisible calls ui.MakeVisible scoping the finder to the Settings app.

func (*OSSettings) NavigateToPageURL

func (s *OSSettings) NavigateToPageURL(ctx context.Context, cr *chrome.Chrome, pageShortURL string, condition func(context.Context) error) error

NavigateToPageURL navigates the Settings app to a particular page.

func (*OSSettings) NodesInfo

func (s *OSSettings) NodesInfo(ctx context.Context, finder *nodewith.Finder) ([]uiauto.NodeInfo, error)

NodesInfo calls ui.NodesInfo scoping the finder to the Settings app.

func (*OSSettings) RightClick

func (s *OSSettings) RightClick(finder *nodewith.Finder) uiauto.Action

RightClick calls ui.RightClick scoping the finder to the Settings app.

func (*OSSettings) SearchWithKeyword

func (s *OSSettings) SearchWithKeyword(ctx context.Context, kb *input.KeyboardEventWriter,
	keyword string) (results []uiauto.NodeInfo, mismatched bool, err error)

SearchWithKeyword searches the demand keyword by input text in the `SearchBox`.

func (*OSSettings) SetDropDownOption

func (s *OSSettings) SetDropDownOption(cr *chrome.Chrome, optionName, expected string) uiauto.Action

SetDropDownOption sets dropdown option to a value.

func (*OSSettings) SetToggleOption

func (s *OSSettings) SetToggleOption(cr *chrome.Chrome, optionName string, expected bool) uiauto.Action

SetToggleOption clicks toggle option to enable or disable an option. It does nothing if the option is already expected.

func (*OSSettings) WaitForLocation

func (s *OSSettings) WaitForLocation(finder *nodewith.Finder) uiauto.Action

WaitForLocation calls ui.WaitForLocation scoping the finder to the Settings app.

func (*OSSettings) WaitForSearchBox

func (s *OSSettings) WaitForSearchBox() uiauto.Action

WaitForSearchBox returns a function that waits for the search box to appear. Useful for checking that some content has loaded and Settings is ready to use.

func (*OSSettings) WaitUntilExists

func (s *OSSettings) WaitUntilExists(finder *nodewith.Finder) uiauto.Action

WaitUntilExists calls ui.WaitUntilExists scoping the finder to the Settings app.

func (*OSSettings) WaitUntilGone

func (s *OSSettings) WaitUntilGone(finder *nodewith.Finder) uiauto.Action

WaitUntilGone calls ui.WaitUntilGone scoping the finder to the Settings app.

func (*OSSettings) WaitUntilToggleOption

func (s *OSSettings) WaitUntilToggleOption(cr *chrome.Chrome, optionName string, expected bool) uiauto.Action

WaitUntilToggleOption returns an action to wait until the toggle option enabled or disabled.

func (*OSSettings) WithInterval

func (s *OSSettings) WithInterval(interval time.Duration) *OSSettings

WithInterval returns a new OSSettings with the specified polling interval. This does not launch the Settings app again.

func (*OSSettings) WithPollOpts

func (s *OSSettings) WithPollOpts(pollOpts testing.PollOptions) *OSSettings

WithPollOpts returns a new OSSettings with the specified polling options. This does not launch the Settings app again.

func (*OSSettings) WithTimeout

func (s *OSSettings) WithTimeout(timeout time.Duration) *OSSettings

WithTimeout returns a new OSSettings with the specified timeout. This does not launch the Settings app again.

Jump to

Keyboard shortcuts

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