Documentation
¶
Overview ¶
Package chrome runs one headless Chrome through chromedp for the tools that look at a rendered page: the screenshots and the audits of the dev MCP server (REQ-AI-04) and the audits of `gx fuzz` (REQ-AI-11). The audit uses the vendored axe-core. No node.
Index ¶
Constants ¶
const ( AxeVersion = "4.13.0" AxeSHA256 = "c24f097bd2f451d4f933e8bc7d8d539f8672a2ebcb5cc9f9f3eec8ca9470a0c1" )
AxeVersion and AxeSHA256 pin the embedded axe-core build.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuditNode ¶
type AuditNode struct {
Target []string `json:"target"`
HTML string `json:"html"`
Summary string `json:"summary"`
Foreground string `json:"foreground,omitempty"`
Background string `json:"background,omitempty"`
Ratio float64 `json:"ratio,omitempty"`
}
AuditNode is one element that fails a rule. Target is the CSS selector of the element, one entry per shadow root. For the rule color-contrast, Foreground and Background are the colours that axe measured and Ratio is their contrast; they are empty when axe could not measure them.
type AuditOptions ¶ added in v0.7.0
type AuditOptions struct {
// DisableRules are the ids of the axe rules that do not run.
DisableRules []string
// ReducedMotion emulates prefers-reduced-motion: reduce, so that a
// component that ends its transitions under it shows its final
// colours to axe.
ReducedMotion bool
}
AuditOptions change one audit. The zero value runs every rule with the motion settings of Chrome.
type AuditOutput ¶
type AuditOutput struct {
Violations []Violation `json:"violations"`
// Passes is the number of rules that passed.
Passes int `json:"passes"`
Axe string `json:"axe"`
}
AuditOutput is the result of one audit.
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
Browser is one headless Chrome. It starts on the first tab. The zero value is ready to use.
func (*Browser) Audit ¶
func (b *Browser) Audit(ctx context.Context, target, selector string, opt AuditOptions) (AuditOutput, error)
Audit runs axe on the page at target. A selector limits the audit to one element: the rules for a whole page, such as the rule for a level-one heading, then do not apply. An empty selector audits the document.