Documentation ¶
Overview ¶
Package useractions contains the definition of UserContext and UserAction. It also provides helper functions to use in test cases.
Index ¶
- Constants
- type ActionTag
- type UserAction
- type UserActionCfg
- type UserContext
- func (uc *UserContext) AddTags(actionTags []ActionTag)
- func (uc *UserContext) Attributes() map[string]string
- func (uc *UserContext) Chrome() *chrome.Chrome
- func (uc *UserContext) InvalidUserAction(err error) *UserAction
- func (uc *UserContext) NewUserAction(name string, action action.Action, uac *UserActionCfg) *UserAction
- func (uc *UserContext) RemoveAttribute(name string)
- func (uc *UserContext) RemoveTags(actionTags []ActionTag)
- func (uc *UserContext) RunAction(ctx context.Context, name string, action action.Action, uac *UserActionCfg) error
- func (uc *UserContext) SetAttribute(name, value string)
- func (uc *UserContext) SetTestName(testName string)
- func (uc *UserContext) TestAPIConn() *chrome.TestConn
Constants ¶
const ( AttributeDeviceMode string = "DeviceMode" AttributeDeviceRegion string = "DeviceRegion" AttributeKeyboardType string = "KeyboardType" AttributeBoardName string = "BoardName" AttributeIncognitoMode string = "IncognitoMode" AttributeUserMode string = "UserMode" AttributeInputMethod string = "InputMethod" AttributeInputField string = "InputField" AttributeFloatVK string = "FloatVK" )
Attribute keys used to represent DUT environment.
const ( DeviceModeClamshell string = "Clamshell" DeviceModeTablet string = "Tablet" DeviceModeUnknown string = "Unknown" )
Available attribute values of device mode.
const ( KeyboardTypePhysicalKeyboard string = "Physical Keyboard" KeyboardTypeTabletVK string = "Tablet Virtual Keyboard" KeyboardTypeA11yVK string = "A11y Virtual Keyboard" KeyboardTypeUnknown string = "Unknown" )
Available attribute values of keyboard type.
const ( FeatureIMEManagement string = "IME Management" FeatureIMESpecific string = "IME Specific Feature" FeaturePKTyping string = "PK Typing Input" FeatureDeadKeys string = "Dead Keys" FeatureVKTyping string = "VK Typing Input" FeatureVKAutoShift string = "VK AutoShift" FeatureVoiceInput string = "Voice Input" FeatureHandWriting string = "Handwriting" FeatureFloatVK string = "Float VK" FeatureGlideTyping string = "Glide Typing" FeatureEmoji string = "Emoji" FeatureEmojiPicker string = "Emoji Picker" FeatureEmojiSuggestion string = "Emoji Suggestion" FeatureGrammarCheck string = "Grammar Check" FeatureMultiPaste string = "Multi-Paste" FeatureMultiwordSuggestion string = "Multiword Suggestion" FeatureAutoCorrection string = "Auto-Correction" FeatureAutoCapitalization string = "Auto-Capitalization" )
E14s feature definition.
const AttributeFeature string = "Feature"
AttributeFeature describes the feature that the user action is using.
const AttributeTestScenario string = "TestScenario"
AttributeTestScenario describes the test scenario that the user action is running in.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionTag ¶
type ActionTag string
ActionTag is a string type to represent tag type of UserAction.
type UserAction ¶
type UserAction struct {
// contains filtered or unexported fields
}
UserAction represents the user action.
func NewUserAction ¶
func NewUserAction(name string, action action.Action, uc *UserContext, uac *UserActionCfg) *UserAction
NewUserAction returns a new user action.
func (*UserAction) AddTags ¶
func (ua *UserAction) AddTags(actionTags []ActionTag)
AddTags adds tags to the user action.
func (*UserAction) Name ¶
func (ua *UserAction) Name() string
Name returns the name of the user action.
func (*UserAction) Run ¶
func (ua *UserAction) Run(ctx context.Context) (err error)
Run runs a user action and records detailed running information.
func (*UserAction) SetAttribute ¶
func (ua *UserAction) SetAttribute(key, value string)
SetAttribute set the value of an attribute of the user action.
func (*UserAction) UserContext ¶
func (ua *UserAction) UserContext() *UserContext
UserContext returns the user context instance of the user action.
type UserActionCfg ¶
type UserActionCfg struct { Attributes map[string]string Tags []ActionTag ValidateResult action.Action // validateResult should only check the outcome of the user action. Callback func(ctx context.Context, actionErr error) error // callback takes action error as input. }
UserActionCfg represents optional configurations of a user action.
type UserContext ¶
type UserContext struct {
// contains filtered or unexported fields
}
UserContext represents the user context in the test.
func NewUserContext ¶
func NewUserContext(testName string, cr *chrome.Chrome, tconn *chrome.TestConn, outputDir string, attributes map[string]string, tags []ActionTag) *UserContext
NewUserContext returns a new user context.
func (*UserContext) AddTags ¶
func (uc *UserContext) AddTags(actionTags []ActionTag)
AddTags adds tags to the user context.
func (*UserContext) Attributes ¶
func (uc *UserContext) Attributes() map[string]string
Attributes returns all attributes of the user context.
func (*UserContext) Chrome ¶
func (uc *UserContext) Chrome() *chrome.Chrome
Chrome returns the Chrome instance from the user context.
func (*UserContext) InvalidUserAction ¶
func (uc *UserContext) InvalidUserAction(err error) *UserAction
InvalidUserAction creates a user action to return error directly.
func (*UserContext) NewUserAction ¶
func (uc *UserContext) NewUserAction(name string, action action.Action, uac *UserActionCfg) *UserAction
NewUserAction returns a new user action.
func (*UserContext) RemoveAttribute ¶
func (uc *UserContext) RemoveAttribute(name string)
RemoveAttribute removes an attribute of the user context.
func (*UserContext) RemoveTags ¶
func (uc *UserContext) RemoveTags(actionTags []ActionTag)
RemoveTags removes tags from the user context.
func (*UserContext) RunAction ¶
func (uc *UserContext) RunAction(ctx context.Context, name string, action action.Action, uac *UserActionCfg) error
RunAction runs a action.Action as a user action and records detailed running information.
func (*UserContext) SetAttribute ¶
func (uc *UserContext) SetAttribute(name, value string)
SetAttribute set the value of an attribute of the user context.
func (*UserContext) SetTestName ¶
func (uc *UserContext) SetTestName(testName string)
SetTestName sets the test name of the user context.
func (*UserContext) TestAPIConn ¶
func (uc *UserContext) TestAPIConn() *chrome.TestConn
TestAPIConn returns the test connection from the user context.