lockscreen

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

Documentation

Overview

Package lockscreen is used to get information about the lock screen directly through the UI.

Index

Constants

This section is empty.

Variables

View Source
var AuthErrorFinder = nodewith.Role(role.AlertDialog).NameStartingWith("Your PIN or password couldn't be verified. Try again.").ClassName("LoginErrorBubble")

AuthErrorFinder is the finder for the authentication error shown on the first failure.

View Source
var ConsecutiveAuthErrorFinder = nodewith.Role(role.AlertDialog).NameStartingWith("Your PIN or password still couldn't be verified. Note: If you recently changed your password, use your old password. Your new password will be applied once you sign out.").ClassName("LoginErrorBubble")

ConsecutiveAuthErrorFinder is the finder for the authentication error shown on the consecutive failures.

View Source
var HidePasswordButton = nodewith.Role(role.ToggleButton).ClassName("ToggleImageButton").Name("Hide password")

HidePasswordButton is the finder for the "Hide password" button on Lock/Start screen.

View Source
var ShowPasswordButton = nodewith.Role(role.Button).ClassName("ToggleImageButton").Name("Show password")

ShowPasswordButton is the finder for the "Show password" button on Lock/Start screen.

View Source
var SmartLockArrowButtonFinder = nodewith.NameContaining("Unlocked by your phone. Tap or click to enter.").ClassName("ArrowButtonView")

SmartLockArrowButtonFinder is the finder for the button that needs to be clicked to complete authentication with Smart Lock.

View Source
var SubmitButton = nodewith.Name("Submit").Role(role.Button)

SubmitButton is the finder for the "Submit" button on Lock/Start screen.

View Source
var SwitchToPasswordButton = nodewith.Role(role.Button).ClassName("LabelButton").Name("Switch to password")

SwitchToPasswordButton is the finder for the "Switch to password" button on Lock/Start screen.

Functions

func ClickSmartLockArrowButton

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

ClickSmartLockArrowButton clicks the arrow button to login with Smart Lock.

func EnterPIN

func EnterPIN(ctx context.Context, tconn *chrome.TestConn, PIN string) error

EnterPIN enters the specified PIN.

func EnterPassword

func EnterPassword(ctx context.Context, tconn *chrome.TestConn, username, password string, kb *input.KeyboardEventWriter) error

EnterPassword types password with carriage return at the end.

func HasPinPad

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

HasPinPad checks whether the PIN pad is present, i.e., whether PIN unlock is enabled.

func HidePassword

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

HidePassword clicks the "Hide password" button.

func Lock

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

Lock locks the screen.

func PINFieldFinder

func PINFieldFinder(username string) (*nodewith.Finder, error)

PINFieldFinder generates Finder for the "PIN or password" field.

func PasswordFieldFinder

func PasswordFieldFinder(username string) (*nodewith.Finder, error)

PasswordFieldFinder generates Finder for the password field. The password field node can be uniquely identified by its name attribute, which includes the username, such as "Password for username@gmail.com". The Finder will find the node whose name matches the regex /Password for <username>/, so the domain can be omitted, or the username argument can be an empty string to find the first password field in the hierarchy.

func ShowPassword

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

ShowPassword clicks the "Show password" button.

func SubmitPIN

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

SubmitPIN submits the entered PIN.

func SwitchToPassword

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

SwitchToPassword clicks the "Switch to password" button which appears only when PIN autosubmit is enabled.

func TypePassword

func TypePassword(ctx context.Context, tconn *chrome.TestConn, username, password string, kb *input.KeyboardEventWriter) error

TypePassword enters the given password (without submitting). Refer to PasswordFieldFinder for username options. It doesn't make any assumptions about the password being correct, so callers should verify the login/lock state afterwards.

func Unlock

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

Unlock unlocks the screen, assuming that PIN / Password has already been entered by the user.

func UserPassword

func UserPassword(ctx context.Context, tconn *chrome.TestConn, username string, pin bool) (*uiauto.NodeInfo, error)

UserPassword searches the PIN / Password field for a given user pod and returns the corresponding node.

func WaitForAuthError

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

WaitForAuthError waits for the login error bubble that password or pin was not correct.

func WaitForLoggedIn

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

WaitForLoggedIn is a wrapper around WaitState to wait for the user to be logged in.

func WaitForPasswordField

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

WaitForPasswordField waits for the password text field for a given user pod to appear in the UI.

func WaitForSmartLockReady

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

WaitForSmartLockReady waits for UI signal that the chromebook is ready to be unlocked by Smart Lock.

func WaitForSmartLockVisible

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

WaitForSmartLockVisible waits for UI signal that Smart Lock is an available auth factor.

Types

type State

type State struct {
	LoggedIn            bool   `json:"isLoggedIn"`
	Owner               bool   `json:"isOwner"`
	Locked              bool   `json:"isScreenLocked"`
	ReadyForPassword    bool   `json:"isReadyForPassword"` // Login screen may not be ready to receive a password, even if this is true (crbug/1109381)
	RegularUser         bool   `json:"isRegularUser"`
	Guest               bool   `json:"isGuest"`
	Kiosk               bool   `json:"isKiosk"`
	Email               string `json:"email"`
	DisplayEmail        string `json:"displayEmail"`
	UserImage           string `json:"userImage"`
	HasValidOauth2Token bool   `json:"hasValidOauth2Token"`
}

State contains the state returned by chrome.autotestPrivate.loginStatus, corresponding to 'LoginStatusDict' as defined in autotest_private.idl.

func GetState

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

GetState returns the login status information from chrome.autotestPrivate.loginStatus

func WaitState

func WaitState(ctx context.Context, tconn *chrome.TestConn, check func(st State) bool, timeout time.Duration) (State, error)

WaitState repeatedly calls GetState and passes the returned state to check until it returns true or timeout is reached. The last-seen state is returned.

Jump to

Keyboard shortcuts

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