Documentation
¶
Overview ¶
Package preview renders every Sweef UI page through the real Sweef engine (the same Tab and paintPage path that `sweef screenshot` uses) with a mocked window.sweef and sample state. It is the design feedback loop and the basis of the UI regression test.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Result ¶
type Result struct {
PNG []byte
Errors []string // console errors and uncaught exceptions
Posts [][]interface{} // messages the page posted to Go
}
Result of rendering a scenario.
type Scenario ¶
type Scenario struct {
Name string // file stem
Page string // path in ui.FS, e.g. chrome/index.html
Query string // "?k=v" appended to the URL
W, H int
State any // JSON-marshalled and delivered as the "state" message
Setup string // JS run after the state arrives (open popovers, stream events...)
Then string // JS run after Setup has settled (for steps that need lazily loaded code)
Backdrop string // fake web page behind the transparent viewport: article|shop|blank
// BackdropFrom names another scenario whose screenshot is placed in the viewport hole (the engine does not paint iframes)
BackdropFrom string
Skip bool // used only as a backdrop source: not written or tested on its own
NoState bool
}
Scenario is one screenshot: a page, a viewport, a state snapshot and a script.
type Session ¶
Session is one loaded page that tests and previews can drive.
func (*Session) Errors ¶
Errors returns console errors, warnings and uncaught exceptions seen so far.
func (*Session) Posts ¶
func (s *Session) Posts() [][]interface{}
Posts returns every message the page has posted to Go so far.