util

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 util contains some common utilities or constants that are used by multiple input tests.

Index

Constants

This section is empty.

Variables

View Source
var PKCandidatesFinder = nodewith.Role(role.ImeCandidate).Onscreen()

PKCandidatesFinder is the finder for candidates in the IME candidates window.

Functions

func ExtractExternalFilesFromMap

func ExtractExternalFilesFromMap(messages map[InputModality]data.Message, inputMethods []ime.InputMethod) []string

ExtractExternalFilesFromMap returns the file names contained in messages for selected input methods.

func GetNthCandidateText

func GetNthCandidateText(ctx context.Context, tconn *chrome.TestConn, n int) (string, error)

GetNthCandidateText returns the candidate text in the specified position in the candidates window.

func GetNthCandidateTextAndThen

func GetNthCandidateTextAndThen(tconn *chrome.TestConn, n int, fn func(text string) uiauto.Action) uiauto.Action

GetNthCandidateTextAndThen returns an action that performs two steps in sequence: 1) Get the specified candidate. 2) Pass the specified candidate into provided function and runs the returned action. This is used when an action depends on the text of a candidate.

func RunSubTest

func RunSubTest(ctx context.Context, s *testing.State, cr *chrome.Chrome, testName string, action uiauto.Action)

RunSubTest is designed to run an action as a subtest. It reserves 5s for general cleanup, dumping ui tree and screenshot on error.

func RunSubtestsPerInputMethodAndMessage

func RunSubtestsPerInputMethodAndMessage(ctx context.Context, uc *useractions.UserContext, s *testing.State,
	inputMethods []ime.InputMethod, messages []data.Message, subtest func(testName string, inputData data.InputData) func(ctx context.Context, s *testing.State))

RunSubtestsPerInputMethodAndMessage runs subtest that uses testName and inputdata on every combination of given input methods and messages.

func RunSubtestsPerInputMethodAndModalidy

func RunSubtestsPerInputMethodAndModalidy(ctx context.Context, tconn *chrome.TestConn, s *testing.State,
	inputMethods []ime.InputMethod, messages map[InputModality]data.Message, subtest func(testName string, modality InputModality, inputData data.InputData) func(ctx context.Context, s *testing.State))

RunSubtestsPerInputMethodAndModalidy runs subtest that uses testName and inputdata on every combination of given input methods and messages.

func WaitForFieldNotEmpty

func WaitForFieldNotEmpty(tconn *chrome.TestConn, finder *nodewith.Finder) uiauto.Action

WaitForFieldNotEmpty returns an action checking whether the input field value is not empty.

func WaitForFieldTextToBe

func WaitForFieldTextToBe(tconn *chrome.TestConn, finder *nodewith.Finder, expectedText string) uiauto.Action

WaitForFieldTextToBe returns an action checking whether the input field value equals given text. The text is case sensitive.

func WaitForFieldTextToBeIgnoringCase

func WaitForFieldTextToBeIgnoringCase(tconn *chrome.TestConn, finder *nodewith.Finder, expectedText string) uiauto.Action

WaitForFieldTextToBeIgnoringCase returns an action checking whether the input field value equals given text. The text is case insensitive.

func WaitForFieldTextToSatisfy

func WaitForFieldTextToSatisfy(tconn *chrome.TestConn, finder *nodewith.Finder, description string, predicate func(string) bool) uiauto.Action

WaitForFieldTextToSatisfy returns an action checking whether the input field value satisfies a predicate.

Types

type InputEval

type InputEval struct {
	TestName     string
	InputFunc    uiauto.Action
	ExpectedText string
}

InputEval is a data structure to define common input function and expected out.

type InputModality

type InputModality string

InputModality describes the available input modalities.

const (
	InputWithVK          InputModality = "Virtual Keyboard"
	InputWithVoice       InputModality = "Voice"
	InputWithHandWriting InputModality = "Handwriting"
	InputWithPK          InputModality = "Physical Keyboard"
)

Valid values for InputModality.

Jump to

Keyboard shortcuts

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