context

package
v0.0.0-...-2e3c39d Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServerManager

type ServerManager interface {
	Start() error
	Stop() error
	GetBaseURL() string
	IsReady() bool
}

ServerManager defines the interface for managing test servers

type TestContext

type TestContext struct {
	Server  ServerManager
	Browser *browser.Browser
	BaseURL string
	T       *testing.T

	StructuredLogger interface{} // Optional structured logger
	// contains filtered or unexported fields
}

TestContext holds shared test state

func NewTestContext

func NewTestContext(t *testing.T, baseURL string) *TestContext

NewTestContext creates a new test context

func (*TestContext) AssertContains

func (tc *TestContext) AssertContains(s, contains interface{}, msgAndArgs ...interface{})

AssertContains asserts a string contains a substring

func (*TestContext) AssertEqual

func (tc *TestContext) AssertEqual(expected, actual interface{}, msgAndArgs ...interface{})

AssertEqual asserts two values are equal

func (*TestContext) AssertNoError

func (tc *TestContext) AssertNoError(err error, msgAndArgs ...interface{})

AssertNoError asserts no error occurred

func (*TestContext) AssertTrue

func (tc *TestContext) AssertTrue(value bool, msgAndArgs ...interface{})

AssertTrue asserts a condition is true

func (*TestContext) GetContext

func (tc *TestContext) GetContext() context.Context

GetContext returns the context

func (*TestContext) Logf

func (tc *TestContext) Logf(format string, args ...interface{})

Logf logs a formatted message

func (*TestContext) SetLogger

func (tc *TestContext) SetLogger(logger func(format string, args ...interface{}))

SetLogger sets the logger function

func (*TestContext) SetStructuredLogger

func (tc *TestContext) SetStructuredLogger(logger interface{})

SetStructuredLogger sets an optional structured logger

func (*TestContext) Setup

func (tc *TestContext) Setup() error

Setup sets up test environment

func (*TestContext) SetupBrowser

func (tc *TestContext) SetupBrowser() error

SetupBrowser creates and initializes browser instance

func (*TestContext) TakeScreenshot

func (tc *TestContext) TakeScreenshot(filename string) error

TakeScreenshot takes a screenshot and saves it to the specified path

func (*TestContext) TakeScreenshotOnError

func (tc *TestContext) TakeScreenshotOnError(testName string)

TakeScreenshotOnError takes a screenshot if an error occurs

func (*TestContext) Teardown

func (tc *TestContext) Teardown()

Teardown cleans up test environment

func (*TestContext) WaitForServer

func (tc *TestContext) WaitForServer(maxAttempts int) error

WaitForServer waits for the server to become ready

Jump to

Keyboard shortcuts

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