browser

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastMessage

type BroadcastMessage struct {
	Channel string
	Data    any
}

type CoordinationHarness

type CoordinationHarness struct{}

CoordinationHarness provides deterministic cross-tab, worker, and offline controls.

func NewCoordinationHarness

func NewCoordinationHarness(parseTb testing.TB, parseOptions ...Options) *CoordinationHarness

NewCoordinationHarness requires a js/wasm test environment.

func (*CoordinationHarness) CrossTabMessages

func (parseH *CoordinationHarness) CrossTabMessages(parseChannel string) []BroadcastMessage

CrossTabMessages returns broadcast messages, optionally filtered by channel name.

func (*CoordinationHarness) Environment

func (parseH *CoordinationHarness) Environment() *Environment

Environment returns the underlying browser environment for advanced setup.

func (*CoordinationHarness) FailRetry

func (parseH *CoordinationHarness) FailRetry(parseId string, parseErr string)

FailRetry records one retry failure and keeps the entry pending while attempts remain.

func (*CoordinationHarness) IsOffline

func (parseH *CoordinationHarness) IsOffline() bool

IsOffline reports whether offline mode is active.

func (*CoordinationHarness) OpenTab

func (parseH *CoordinationHarness) OpenTab(parsePath string, parseName string) *MockWindow

OpenTab opens one additional mock browser tab and returns that tab handle.

func (*CoordinationHarness) QueueRetry

func (parseH *CoordinationHarness) QueueRetry(parseId string, parseMaxAttempts int)

QueueRetry stores one retryable background operation.

func (*CoordinationHarness) Reconnect

func (parseH *CoordinationHarness) Reconnect() ReconnectSnapshot

Reconnect returns one snapshot of reconnect state.

func (*CoordinationHarness) RecordReconnectFailure

func (parseH *CoordinationHarness) RecordReconnectFailure(parseErr string)

RecordReconnectFailure records one reconnect failure and increments attempts.

func (*CoordinationHarness) RecordReconnectSuccess

func (parseH *CoordinationHarness) RecordReconnectSuccess()

RecordReconnectSuccess records one successful reconnect.

func (*CoordinationHarness) ResolveRetry

func (parseH *CoordinationHarness) ResolveRetry(parseId string)

ResolveRetry marks one queued retry as completed.

func (*CoordinationHarness) RetryEntries

func (parseH *CoordinationHarness) RetryEntries() []RetryEntry

RetryEntries returns one stable snapshot of queued retry entries.

func (*CoordinationHarness) SetOffline

func (parseH *CoordinationHarness) SetOffline(isOffline bool)

SetOffline sets the offline state used by retry and reconnect flows.

func (*CoordinationHarness) Worker

func (parseH *CoordinationHarness) Worker(parseIndex int) *MockWorker

Worker returns one worker handle by index.

func (*CoordinationHarness) Workers

func (parseH *CoordinationHarness) Workers() []*MockWorker

Workers returns all currently created worker handles.

type Environment

type Environment struct{}

func Install

func Install(parseTb testing.TB, parseOptions ...Options) *Environment

type MockWindow

type MockWindow struct{}

type MockWorker

type MockWorker struct{}

type OpenCall

type OpenCall struct {
	URL      string
	Name     string
	Features string
}

type Options

type Options struct {
	Path           string
	HashRouting    bool
	LocalStorage   map[string]string
	SessionStorage map[string]string
	MediaMatches   map[string]bool
}

type ReconnectSnapshot

type ReconnectSnapshot struct {
	IsConnected bool
	Attempts    int
	LastError   string
}

ReconnectSnapshot captures reconnect progress in the coordination harness.

type RetryEntry

type RetryEntry struct {
	ID          string
	Attempts    int
	MaxAttempts int
	LastError   string
	Pending     bool
}

RetryEntry captures one queued retry flow in the coordination harness.

Jump to

Keyboard shortcuts

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