Documentation ¶
Overview ¶
Package assistant supports interaction with Assistant service.
Index ¶
- Variables
- func Cleanup(ctx context.Context, hasError func() bool, cr *chrome.Chrome, ...) error
- func Disable(ctx context.Context, tconn *chrome.TestConn) error
- func Enable(ctx context.Context, tconn *chrome.TestConn) error
- func EnableAndWaitForReady(ctx context.Context, tconn *chrome.TestConn) error
- func SetBetterOnboardingEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) error
- func SetContextEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) error
- func SetHotwordEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) error
- func SetVoiceInteractionConsentValue(ctx context.Context, tconn *chrome.TestConn, value int) error
- func ToggleUIWithHotkey(ctx context.Context, tconn *chrome.TestConn, accel Accelerator) error
- func VerboseLogging() chrome.Option
- func VerboseLoggingEnabled() testing.Precondition
- type Accelerator
- type QueryResponse
- type QueryStatus
Constants ¶
This section is empty.
Variables ¶
var ( AccelAssistantKey = Accelerator{KeyCode: "assistant"} AccelSearchPlusA = Accelerator{KeyCode: "a", Search: true} )
Accelerators to toggle Assistant UI
Functions ¶
func Cleanup ¶
func Cleanup(ctx context.Context, hasError func() bool, cr *chrome.Chrome, tconn *chrome.TestConn) error
Cleanup stops the Google Assistant service so other tests are not impacted. If a failure happened, we make a screenshot beforehand so the Assistant UI is visible in the screenshot.
func EnableAndWaitForReady ¶
EnableAndWaitForReady brings up Google Assistant service, waits for NEW_READY signal and returns any errors.
func SetBetterOnboardingEnabled ¶
SetBetterOnboardingEnabled enables/disables the Assistant onboarding feature by controlling the number of sessions where onboarding screen has shown. Note that true pref value will *not* be restored later, so tests that need this feature must explicitly enable it during setup. Also note that once better onboarding has been activated for a session, it will remain enabled for the duration of that session until an Assistant interaction happens.
It is recommended to disable Better Onboarding for Assistant performance
tests that are not explicitly testing the Better Onboarding feature.
func SetContextEnabled ¶
SetContextEnabled enables/disables the access to the screen context for Assistant. This pref corresponds to the "Related Info" setting of Assistant.
func SetHotwordEnabled ¶
SetHotwordEnabled turns on/off "OK Google" hotword detection for Assistant.
func SetVoiceInteractionConsentValue ¶
SetVoiceInteractionConsentValue enables/disables the consent value for Assistant voice interaction.
func ToggleUIWithHotkey ¶
ToggleUIWithHotkey mimics the Assistant key press to open/close the Assistant UI.
func VerboseLogging ¶
VerboseLogging is a helper function passed into chrome.New which will:
- Enable VLOG traces in the assistant code.
- Enable PII in VLOG traces in the assistant code. This will log the actual queries sent, and the replies received.
func VerboseLoggingEnabled ¶
func VerboseLoggingEnabled() testing.Precondition
VerboseLoggingEnabled creates a new precondition which can be shared by tests that require an already-started Chromeobject with verbose logging enabled.
Types ¶
type QueryResponse ¶
type QueryResponse struct { // Contains the HTML string of the response. HTML string `json:"htmlResponse"` }
QueryResponse contains a subset of the results returned from the Assistant server when it received a query. This struct contains the only fields which are used in the tests.
type QueryStatus ¶
type QueryStatus struct {
QueryResponse `json:"queryResponse"`
}
QueryStatus contains a subset of the status of an interaction with Assistant started by sending a query, e.g. query text, mic status, and query response. This struct contains the only fields which are used in the tests.
TODO(meilinw): Add a reference for the struct after the API change landed (crrev.com/c/1552293).
func SendTextQuery ¶
SendTextQuery sends text query to Assistant and returns the query status.