playwright

package
v0.0.0-...-3107470 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package playwright imports Playwright accessibility-snapshot and action-probe fixtures as normalized evidence records.

A legacy Playwright fixture is a JSON object with the following shape:

{
  "url": "https://example.test/page",
  "observedAt": "2026-01-01T00:00:00Z",
  "snapshot": {
    "role": "...",
    "name": "...",
    "children": [...]
  },
  "actionHint": "optional_action_name"
}

The adapter walks the snapshot tree and collects all interactive nodes (role in the locator enum) as CandidateLocators. No live browser is required; tests operate on saved JSON fixtures.

Index

Constants

View Source
const (
	// FixtureVersion identifies raw fixtures emitted by Browsertools live
	// acquisition. Legacy saved-tree fixtures omit this field.
	FixtureVersion = "browsertools.playwright-capture.v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct{}

Adapter imports Playwright accessibility snapshot fixtures.

func (*Adapter) Import

func (a *Adapter) Import(raw []byte, opts adapter.Options) ([]evidence.Record, error)

Import parses a saved Playwright fixture JSON and returns a normalized evidence record. The fixture must not contain live credentials or cookies; the caller is responsible for redaction before calling Import.

func (*Adapter) Name

func (a *Adapter) Name() string

Name implements adapter.Adapter.

type Fixture

type Fixture struct {
	Version           string            `json:"version,omitempty"`
	URL               string            `json:"url"`
	ObservedAt        string            `json:"observedAt"`
	ActionHint        string            `json:"actionHint,omitempty"`
	PlaywrightVersion string            `json:"playwrightVersion,omitempty"`
	Snapshot          *SnapshotNode     `json:"snapshot,omitempty"`
	ARIASnapshot      string            `json:"ariaSnapshot,omitempty"`
	StructuredData    []json.RawMessage `json:"structuredData,omitempty"`
	Network           *NetworkSummary   `json:"network,omitempty"`
}

Fixture is the expected shape of a saved Playwright snapshot file.

type NetworkSummary

type NetworkSummary struct {
	Requests            int   `json:"requests"`
	Responses           int   `json:"responses"`
	ResponseBytes       int64 `json:"responseBytes"`
	BlockedRequests     int   `json:"blockedRequests"`
	BlockedWebSockets   int   `json:"blockedWebSockets"`
	BlockedPopups       int   `json:"blockedPopups"`
	BlockedDownloads    int   `json:"blockedDownloads"`
	BlockedDialogs      int   `json:"blockedDialogs"`
	BlockedFileChoosers int   `json:"blockedFileChoosers"`
}

NetworkSummary records bounded counts only. It intentionally contains no URLs, headers, cookies, bodies, or timing fingerprints.

type SnapshotNode

type SnapshotNode struct {
	Role     string          `json:"role"`
	Name     string          `json:"name,omitempty"`
	Value    string          `json:"value,omitempty"`
	Children []*SnapshotNode `json:"children,omitempty"`
}

SnapshotNode is one node in the Playwright accessibility tree.

Jump to

Keyboard shortcuts

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