assistant

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

Documentation

Overview

Package assistant supports interaction with Assistant service.

Index

Constants

This section is empty.

Variables

View Source
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 Disable

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

Disable stops the Google Assistant service and returns any errors.

func Enable

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

Enable brings up Google Assistant service and returns any errors.

func EnableAndWaitForReady

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

EnableAndWaitForReady brings up Google Assistant service, waits for NEW_READY signal and returns any errors.

func SetBetterOnboardingEnabled

func SetBetterOnboardingEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) error

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

func SetContextEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) error

SetContextEnabled enables/disables the access to the screen context for Assistant. This pref corresponds to the "Related Info" setting of Assistant.

func SetHotwordEnabled

func SetHotwordEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) error

SetHotwordEnabled turns on/off "OK Google" hotword detection for Assistant.

func SetVoiceInteractionConsentValue

func SetVoiceInteractionConsentValue(ctx context.Context, tconn *chrome.TestConn, value int) error

SetVoiceInteractionConsentValue enables/disables the consent value for Assistant voice interaction.

func ToggleUIWithHotkey

func ToggleUIWithHotkey(ctx context.Context, tconn *chrome.TestConn, accel Accelerator) error

ToggleUIWithHotkey mimics the Assistant key press to open/close the Assistant UI.

func VerboseLogging

func VerboseLogging() chrome.Option

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 Accelerator

type Accelerator ash.Accelerator

Accelerator used by Assistant

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

func SendTextQuery(ctx context.Context, tconn *chrome.TestConn, query string) (QueryStatus, error)

SendTextQuery sends text query to Assistant and returns the query status.

Jump to

Keyboard shortcuts

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