Documentation
¶
Overview ¶
Package qa is the QA hook of a gowt app. A build with -tags gowtqa and GOWT_QA_SOCKET in the environment makes gowt.Run listen on that socket; package qa/qatest drives the app from go test. Without the tag the app has no server and no network code: Handle does nothing.
Index ¶
Constants ¶
const ( EnvSocket = "GOWT_QA_SOCKET" // unix socket path; a QA build listens only when it is set EnvData = "GOWT_QA_DATA" // a private data directory for the app to use instead of the user's )
Environment of a QA run, set by qatest.
const ( EnvArtifacts = "GOWT_QA_ARTIFACTS" // directory for the shots, dump and logs of failed tests EnvKeep = "GOWT_QA_KEEP" // set: keep the app's socket, data and log directory after the run )
Environment of the test process, read by qatest.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Args ¶
type Args struct {
// contains filtered or unexported fields
}
Args are the key-value arguments a test passes to a handler.
func NewArgs ¶
func NewArgs(raw json.RawMessage) (Args, error)
NewArgs wraps the raw JSON object a request carried; an empty or null raw is no arguments.
type Dialog ¶
type Dialog struct {
Kind string `json:"kind"`
Reply any `json:"reply,omitempty"`
Cancel bool `json:"cancel,omitempty"`
Title string `json:"title,omitempty"`
Message string `json:"message,omitempty"`
Buttons []string `json:"buttons,omitempty"` // message: the buttons it offers
Dir string `json:"dir,omitempty"` // file, dir: where it opens
Name string `json:"name,omitempty"` // file: the proposed file name
Save bool `json:"save,omitempty"`
Multi bool `json:"multi,omitempty"`
Filters []string `json:"filters,omitempty"` // file: "Name|pattern"
Unanswered bool `json:"unanswered,omitempty"`
}
Dialog is a scripted answer for qatest's Answer, or a dialog the app asked for as Dialogs reports it. Kind is "message" (Window.MessageBox), "confirm" (Window.Confirm), "file" (FileDialog), "dir" (DirDialog), "color" (ColorDialog) or "font" (FontDialog).
Reply by kind: a button name ("OK", "Cancel", "Yes", "No", "Retry", "Abort", "Ignore") for message; a bool for confirm; a path, or a list of paths for a Multi dialog, for file; a path for dir; "#rrggbb" for color; a Font object ({"Name": "Menlo", "Size": 12, "Bold": true}) for font. Cancel answers as the user who dismissed the dialog and needs no Reply.
In what Dialogs returns, Reply and Cancel are what the app received, and Unanswered marks a dialog with no scripted answer, which got Cancel.
type Job ¶
type Job struct {
Name string `json:"name"`
Background bool `json:"background,omitempty"`
Track bool `json:"track,omitempty"`
ElapsedMS int64 `json:"elapsed_ms"`
Done int `json:"done,omitempty"`
Total int `json:"total,omitempty"`
Text string `json:"text,omitempty"`
}
Job is one running Job or Track of the app, as the "jobs" command reports it; it mirrors gowt.JobInfo.
type Node ¶
type Node struct {
ID string `json:"id,omitempty"`
Class string `json:"class"`
Text string `json:"text,omitempty"`
Enabled bool `json:"enabled"`
Visible bool `json:"visible"`
Focused bool `json:"focused,omitempty"`
Bounds [4]int `json:"bounds"` // x, y, width, height in the coordinates of its window
Checked *bool `json:"checked,omitempty"`
Selected []int `json:"selected,omitempty"`
Value string `json:"value,omitempty"`
Path string `json:"path"`
Children []Node `json:"children,omitempty"`
}
Node is one control or item in a dump; it mirrors internal/qatree.Node.
type Selector ¶
type Selector struct {
ID string `json:"id,omitempty"`
Class string `json:"class,omitempty"`
Text string `json:"text,omitempty"`
Within *Selector `json:"within,omitempty"`
}
Selector picks controls; it mirrors internal/qatree.Selector, which the client cannot import without linking the toolkit. An empty field matches anything.