Documentation
¶
Overview ¶
Package testserver contains methods to create a local web server for input tests and functions to set / get values of input fields.
Index ¶
- type FieldInputEval
- type InputField
- type InputsTestServer
- func (its *InputsTestServer) Clear(inputField InputField) uiauto.Action
- func (its *InputsTestServer) ClearThenClickFieldAndWaitForActive(inputField InputField) uiauto.Action
- func (its *InputsTestServer) ClickField(inputField InputField) uiauto.Action
- func (its *InputsTestServer) ClickFieldAndWaitForActive(inputField InputField) uiauto.Action
- func (its *InputsTestServer) ClickFieldUntilVKShown(inputField InputField) uiauto.Action
- func (its *InputsTestServer) Close()
- func (its *InputsTestServer) InputEmojiWithEmojiPicker(uc *useractions.UserContext, inputField InputField, emojiChar string) uiauto.Action
- func (its *InputsTestServer) InputEmojiWithEmojiPickerSearch(uc *useractions.UserContext, inputField InputField, ...) uiauto.Action
- func (its *InputsTestServer) RightClickFieldAndWaitForActive(inputField InputField) uiauto.Action
- func (its *InputsTestServer) TriggerEmojiPickerFromContextMenu(inputField InputField) uiauto.Action
- func (its *InputsTestServer) ValidateInputFieldForMode(uc *useractions.UserContext, inputField InputField, ...) uiauto.Action
- func (its *InputsTestServer) ValidateInputOnField(inputField InputField, inputFunc uiauto.Action, expectedValue string) uiauto.Action
- func (its *InputsTestServer) ValidateResult(inputField InputField, expectedText string) uiauto.Action
- func (its *InputsTestServer) WaitForFieldToBeActive(inputField InputField) uiauto.Action
- func (its *InputsTestServer) WaitForHandwritingEngineReadyOnField(hwCtx *vkb.HandwritingContext, inputField InputField, dataPathStr string) uiauto.Action
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldInputEval ¶
type FieldInputEval struct { InputField InputField InputFunc uiauto.Action ExpectedText string }
FieldInputEval encapsulates a function to input text into an input field, and its expected output.
type InputField ¶
type InputField string
InputField is the type of input field.
const ( TextAreaInputField InputField = "textAreaInputField" TextInputField InputField = "textInputField" SearchInputField InputField = "searchInputField" PasswordInputField InputField = "passwordInputField" // PasswordTextField is not an editable input. // It is used for sync password value for visual testing. PasswordTextField InputField = "passwordTextField" NumberInputField InputField = "numberInputField" EmailInputField InputField = "emailInputField" URLInputField InputField = "urlInputField" TelInputField InputField = "telInputField" DateInputField InputField = "dateInputField" MonthInputField InputField = "monthInputField" WeekInputField InputField = "weekInputField" TimeInputField InputField = "timeInputField" DateTimeInputField InputField = "dateTimeInputField" TextInputNumericField InputField = "textInputNumericField" TextAreaNoCorrectionInputField InputField = "textArea disabled autocomplete, autocorrect, autocapitalize" // These fields are used to test auto-shift (aka autocapitalize). TextAreaAutoShiftInSentence InputField = "autocapitalize in sentence mode" TextAreaAutoShiftInWord InputField = "autocapitalize in words mode" TextAreaAutoShiftInChar InputField = "autocapitalize in characters mode" TextAreaAutoShiftOff InputField = "autocapitalize off" )
Different type of input fields.
func (InputField) Finder ¶
func (inputField InputField) Finder() *nodewith.Finder
Finder returns the finder of the field by Name attribute.
type InputsTestServer ¶
type InputsTestServer struct {
// contains filtered or unexported fields
}
InputsTestServer is an unified server instance being used to manage web server and connection.
func Launch ¶
func Launch(ctx context.Context, cr *chrome.Chrome, tconn *chrome.TestConn) (*InputsTestServer, error)
Launch launches a local web server to serve inputs testing on different type of input fields. It then opens a Chrome browser window in normal mode to visit the test page.
func LaunchInMode ¶
func LaunchInMode(ctx context.Context, cr *chrome.Chrome, tconn *chrome.TestConn, incognitoMode bool) (its *InputsTestServer, err error)
LaunchInMode launches a local web server to serve inputs testing on different type of input fields. It can be either normal user mode or incognito mode.
func (*InputsTestServer) Clear ¶
func (its *InputsTestServer) Clear(inputField InputField) uiauto.Action
Clear returns an action clearing given input field by setting value to empty string via javascript.
func (*InputsTestServer) ClearThenClickFieldAndWaitForActive ¶
func (its *InputsTestServer) ClearThenClickFieldAndWaitForActive(inputField InputField) uiauto.Action
ClearThenClickFieldAndWaitForActive returns an action clearing the input field, clicking it and waiting for it to be active.
func (*InputsTestServer) ClickField ¶
func (its *InputsTestServer) ClickField(inputField InputField) uiauto.Action
ClickField returns an action clicking the input field.
func (*InputsTestServer) ClickFieldAndWaitForActive ¶
func (its *InputsTestServer) ClickFieldAndWaitForActive(inputField InputField) uiauto.Action
ClickFieldAndWaitForActive returns an action clicking the input field and waiting for it to be active.
func (*InputsTestServer) ClickFieldUntilVKShown ¶
func (its *InputsTestServer) ClickFieldUntilVKShown(inputField InputField) uiauto.Action
ClickFieldUntilVKShown returns an action clicking the input field and waits for the virtual keyboard to show up.
func (*InputsTestServer) Close ¶
func (its *InputsTestServer) Close()
Close release the connection and stop the local web server.
func (*InputsTestServer) InputEmojiWithEmojiPicker ¶
func (its *InputsTestServer) InputEmojiWithEmojiPicker(uc *useractions.UserContext, inputField InputField, emojiChar string) uiauto.Action
InputEmojiWithEmojiPicker returns a user action to input Emoji with PK emoji picker on E14s test server.
func (*InputsTestServer) InputEmojiWithEmojiPickerSearch ¶
func (its *InputsTestServer) InputEmojiWithEmojiPickerSearch(uc *useractions.UserContext, inputField InputField, keyboard *input.KeyboardEventWriter, searchString, emojiChar string) uiauto.Action
InputEmojiWithEmojiPickerSearch returns a user action to input Emoji with PK emoji picker on E14s test server using search.
func (*InputsTestServer) RightClickFieldAndWaitForActive ¶
func (its *InputsTestServer) RightClickFieldAndWaitForActive(inputField InputField) uiauto.Action
RightClickFieldAndWaitForActive returns an action right clicking the input field.
func (*InputsTestServer) TriggerEmojiPickerFromContextMenu ¶
func (its *InputsTestServer) TriggerEmojiPickerFromContextMenu(inputField InputField) uiauto.Action
TriggerEmojiPickerFromContextMenu launches emoji picker from context menu.
func (*InputsTestServer) ValidateInputFieldForMode ¶
func (its *InputsTestServer) ValidateInputFieldForMode(uc *useractions.UserContext, inputField InputField, inputModality util.InputModality, inputData data.InputData, dataPath func(string) string) uiauto.Action
ValidateInputFieldForMode tests input in the given field. After input action, it checks whether the outcome equals to expected value.
func (*InputsTestServer) ValidateInputOnField ¶
func (its *InputsTestServer) ValidateInputOnField(inputField InputField, inputFunc uiauto.Action, expectedValue string) uiauto.Action
ValidateInputOnField returns an action to test an input action on given input field. It clears field first and click to activate input. After input action, it checks whether the outcome equals to expected value.
func (*InputsTestServer) ValidateResult ¶
func (its *InputsTestServer) ValidateResult(inputField InputField, expectedText string) uiauto.Action
ValidateResult returns an action to validate input field text on test server. It deals with Password field especially to validate both displayed placebolder and actual text.
func (*InputsTestServer) WaitForFieldToBeActive ¶
func (its *InputsTestServer) WaitForFieldToBeActive(inputField InputField) uiauto.Action
WaitForFieldToBeActive returns an action waiting for certain input field to be the active element.
func (*InputsTestServer) WaitForHandwritingEngineReadyOnField ¶
func (its *InputsTestServer) WaitForHandwritingEngineReadyOnField(hwCtx *vkb.HandwritingContext, inputField InputField, dataPathStr string) uiauto.Action
WaitForHandwritingEngineReadyOnField tries handwriting until the field is not empty.