Documentation
¶
Overview ¶
Package fuzz is `gx fuzz` (REQ-AI-11): it runs the dev build of an app, asks it to render random prop sets of each component, and checks each render: no panic, the HTML parses to the tree that the render wrote, and axe finds no violation in headless Chrome. No node.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TreeDefect ¶
TreeDefect compares the tree that the render wrote with the tree that the HTML parser makes of the same bytes (REQ-AI-11). It returns the first difference, or the empty string when the trees are the same.
Types ¶
type Failure ¶
type Failure struct {
Component string `json:"component"`
Package string `json:"package"`
Index int `json:"index"`
// Kind is "panic", "tree" or "a11y".
Kind string `json:"kind"`
Message string `json:"message"`
// Name and Fixture are the entry for the fixtures file of the
// component: `"<Name>": <Fixture>,`. Fixture is empty when Go source
// cannot hold the prop set; Unprintable then says why.
Name string `json:"name"`
Fixture string `json:"fixture"`
Imports []string `json:"imports,omitempty"`
Unprintable string `json:"unprintable,omitempty"`
// Findings are the axe findings of an "a11y" failure, one per
// element.
Findings []Finding `json:"findings,omitempty"`
}
Failure is one prop set that fails a check.
type Finding ¶ added in v0.7.0
type Finding struct {
Rule string `json:"rule"`
Help string `json:"help"`
Selector string `json:"selector"`
Foreground string `json:"foreground,omitempty"`
Background string `json:"background,omitempty"`
Ratio float64 `json:"ratio,omitempty"`
}
Finding is one element that fails one axe rule. Selector is the CSS selector of the element; a selector into a shadow root has the selector of each host before it, with " >>> " between them. For the rule color-contrast, Foreground, Background and Ratio are the colours that axe measured and their contrast.
type Options ¶
type Options struct {
// Dir is the app module root.
Dir string
// Main is the app main package; apprun.DetectMain finds it when empty.
Main string
// Component limits the run to the components of this name. It can
// have the package name before a dot: "cart.Cart".
Component string
// Seed makes the prop sets. One seed gives the same sets each run.
Seed uint64
// Sets is the number of prop sets of each component.
Sets int
}
Options select the run.
type Result ¶
type Result struct {
Seed uint64 `json:"seed"`
Components int `json:"components"`
// Sets is the number of prop sets that the run rendered.
Sets int `json:"sets"`
Skipped []string `json:"skipped"`
Failures []Failure `json:"failures"`
Report *propgen.Report `json:"-"`
}
Result is the outcome of one run.