Documentation
¶
Index ¶
- type ServerManager
- type TestContext
- func (tc *TestContext) AssertContains(s, contains interface{}, msgAndArgs ...interface{})
- func (tc *TestContext) AssertEqual(expected, actual interface{}, msgAndArgs ...interface{})
- func (tc *TestContext) AssertNoError(err error, msgAndArgs ...interface{})
- func (tc *TestContext) AssertTrue(value bool, msgAndArgs ...interface{})
- func (tc *TestContext) GetContext() context.Context
- func (tc *TestContext) Logf(format string, args ...interface{})
- func (tc *TestContext) SetLogger(logger func(format string, args ...interface{}))
- func (tc *TestContext) SetStructuredLogger(logger interface{})
- func (tc *TestContext) Setup() error
- func (tc *TestContext) SetupBrowser() error
- func (tc *TestContext) TakeScreenshot(filename string) error
- func (tc *TestContext) TakeScreenshotOnError(testName string)
- func (tc *TestContext) Teardown()
- func (tc *TestContext) WaitForServer(maxAttempts int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServerManager ¶
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) 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