Documentation
¶
Index ¶
- Constants
- func JSON(got any) []string
- func RunBrowserCases[H any](t *testing.T, cases []BrowserCase[H], runner BrowserCaseRunner[H])
- type Artifacts
- type BrowserCase
- type BrowserCaseRunner
- type BrowserStep
- func ClassContainsStep[H interface{ ... }](selector, expected string) BrowserStep[H]
- func ClickStep[H interface{ ... }](selector string) BrowserStep[H]
- func PressStep[H interface{ ... }](selector, key string) BrowserStep[H]
- func TextContainsStep[H interface{ ... }](selector, expected string) BrowserStep[H]
- func TypeStep[H interface{ ... }](selector, text string) BrowserStep[H]
- func VisibleStep[H interface{ ... }](selector string) BrowserStep[H]
- type ConsoleMessage
- type ConsoleRecorder
- type Harness
- func (h *Harness) Click(selector string)
- func (h *Harness) ElementAbsent(selector string)
- func (h *Harness) ElementAttributeContains(selector string, name string, expected string)
- func (h *Harness) ElementAttributeEquals(selector string, name string, expected string)
- func (h *Harness) ElementHidden(selector string)
- func (h *Harness) ElementTextContains(selector string, expected string)
- func (h *Harness) ElementVisible(selector string)
- func (h *Harness) Load(path string)
- func (h *Harness) MatchScreenshot(name string)
- func (h *Harness) MatchScreenshots(screenshots []Screenshot, phase string, path string)
- func (h *Harness) Press(selector string, key string)
- func (h *Harness) Screenshot(name string)
- func (h *Harness) Type(selector string, text string)
- func (h *Harness) Viewport(width int, height int)
- type LogRecorder
- func (r *LogRecorder) Count(subset string) int
- func (r *LogRecorder) Enabled(ctx context.Context, level slog.Level) bool
- func (r *LogRecorder) Handle(ctx context.Context, record slog.Record) error
- func (r *LogRecorder) Lines() []string
- func (r *LogRecorder) Reset()
- func (r *LogRecorder) WithAttrs(attrs []slog.Attr) slog.Handler
- func (r *LogRecorder) WithGroup(name string) slog.Handler
- type Screenshot
- type T
- func (t *T) Click(page *rod.Page, selector string)
- func (t *T) ElementAbsent(page *rod.Page, selector string)
- func (t *T) ElementAttributeContains(page *rod.Page, selector string, name string, expected string)
- func (t *T) ElementAttributeEquals(page *rod.Page, selector string, name string, expected string)
- func (t *T) ElementHidden(page *rod.Page, selector string)
- func (t *T) ElementTextContains(page *rod.Page, selector string, expected string)
- func (t *T) ElementVisible(page *rod.Page, selector string)
- func (t *T) Equal(expected any, actual any, msgAndArgs ...any) bool
- func (t *T) JSON(got any) []string
- func (t *T) Load(page *rod.Page, baseURL string, path string)
- func (t *T) MatchScreenshot(page *rod.Page, name string)
- func (t *T) NoError(err error, msgAndArgs ...any)
- func (t *T) Press(page *rod.Page, selector string, chord string)
- func (t *T) Screenshot(page *rod.Page, name string)
- func (t *T) Type(page *rod.Page, selector string, text string)
- func (t *T) Viewport(page *rod.Page, width int, height int)
Constants ¶
View Source
const ( BrowserOperationTimeout = 3 * time.Second BrowserPollInterval = 50 * time.Millisecond BrowserSessionTimeout = 10 * time.Second BrowserWaitTimeout = 3 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func RunBrowserCases ¶
func RunBrowserCases[H any](t *testing.T, cases []BrowserCase[H], runner BrowserCaseRunner[H])
Types ¶
type Artifacts ¶
func NewArtifacts ¶
func (*Artifacts) ActualPath ¶
func (*Artifacts) GoldenPath ¶
func (*Artifacts) MatchScreenshot ¶
type BrowserCase ¶
type BrowserCase[H any] struct { Act []BrowserStep[H] Assert []BrowserStep[H] Console []string Name string Path string Seed []BrowserStep[H] }
type BrowserCaseRunner ¶
type BrowserStep ¶
func ClassContainsStep ¶
func ClassContainsStep[H interface {
ElementAttributeContains(string, string, string)
}](selector, expected string) BrowserStep[H]
func ClickStep ¶
func ClickStep[H interface{ Click(string) }](selector string) BrowserStep[H]
func PressStep ¶
func PressStep[H interface{ Press(string, string) }](selector, key string) BrowserStep[H]
func TextContainsStep ¶
func TextContainsStep[H interface{ ElementTextContains(string, string) }](selector, expected string) BrowserStep[H]
func TypeStep ¶
func TypeStep[H interface{ Type(string, string) }](selector, text string) BrowserStep[H]
func VisibleStep ¶
func VisibleStep[H interface{ ElementVisible(string) }](selector string) BrowserStep[H]
type ConsoleMessage ¶
type ConsoleRecorder ¶
type ConsoleRecorder struct {
// contains filtered or unexported fields
}
func NewConsoleRecorder ¶
func (*ConsoleRecorder) All ¶
func (c *ConsoleRecorder) All() []ConsoleMessage
func (*ConsoleRecorder) Errors ¶
func (c *ConsoleRecorder) Errors() []string
type Harness ¶
type Harness struct {
Browser *rod.Browser
Console *ConsoleRecorder
Page *rod.Page
Server *httptest.Server
*T
}
func (*Harness) ElementAbsent ¶
func (*Harness) ElementAttributeContains ¶
func (*Harness) ElementAttributeEquals ¶
func (*Harness) ElementHidden ¶
func (*Harness) ElementTextContains ¶
func (*Harness) ElementVisible ¶
func (*Harness) MatchScreenshot ¶
func (*Harness) MatchScreenshots ¶
func (h *Harness) MatchScreenshots(screenshots []Screenshot, phase string, path string)
func (*Harness) Screenshot ¶
type LogRecorder ¶
type LogRecorder struct {
// contains filtered or unexported fields
}
func NewLogRecorder ¶
func NewLogRecorder(t *testing.T, artifacts *Artifacts) *LogRecorder
func (*LogRecorder) Count ¶
func (r *LogRecorder) Count(subset string) int
func (*LogRecorder) Lines ¶
func (r *LogRecorder) Lines() []string
func (*LogRecorder) Reset ¶
func (r *LogRecorder) Reset()
type Screenshot ¶
type T ¶
type T struct {
A *assert.Assertions
Artifacts *Artifacts
R *require.Assertions
// contains filtered or unexported fields
}
func (*T) ElementAttributeContains ¶
func (*T) ElementAttributeEquals ¶
func (*T) ElementTextContains ¶
Click to show internal directories.
Click to hide internal directories.