helpers

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// SeedTemplateName is a valid standard_template row.
	SeedTemplateName = "E2E Seed Answer"

	// SeedCustomerLogin / SeedCustomerPassword: customer_user of company COMP1,
	// pw stored as the unsalted SHA-256 the customer login verifies.
	SeedCustomerLogin    = "e2e.customer"
	SeedCustomerPassword = "E2eCustomer!Seed1"

	// Seed2FAAgentLogin / Seed2FAAgentPassword: agent in group users (rw) with
	// 2FA disabled, dedicated to the TOTP flow so it never touches the admin.
	Seed2FAAgentLogin    = "e2e-2fa-agent"
	Seed2FAAgentPassword = "E2eTwoFactor!Seed1" // #nosec G101 -- throwaway e2e seed password, only in the test-integration seed SQL

	// SeedDynamicFieldName is the Ticket Text dynamic field with id 1.
	SeedDynamicFieldName = "TestTextField"

	// SeedQueueName is the queue with id 5.
	SeedQueueName = "Support"
)

Rows seeded into both test databases by schema/seed/test_integration.sql (PostgreSQL) and schema/seed/test_integration_mysql.sql (MariaDB). The e2e suites rely on them; a missing row is a broken test stack, not a skip.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHelper

type AuthHelper struct {
	// contains filtered or unexported fields
}

AuthHelper provides authentication utilities for tests

func NewAuthHelper

func NewAuthHelper(browser *BrowserHelper) *AuthHelper

NewAuthHelper creates a new authentication helper

func (*AuthHelper) IsLoggedIn

func (a *AuthHelper) IsLoggedIn() bool

IsLoggedIn checks if the user is currently logged in

func (*AuthHelper) Login

func (a *AuthHelper) Login(email, password string) error

Login performs login with the given credentials

func (*AuthHelper) LoginAsAdmin

func (a *AuthHelper) LoginAsAdmin() error

LoginAsAdmin logs in with admin credentials from config

func (*AuthHelper) LoginAsCustomer added in v0.10.0

func (a *AuthHelper) LoginAsCustomer() error

LoginAsCustomer signs in through the customer portal login form with the seeded customer (SeedCustomerLogin) and waits until the portal redirect leaves /customer/login.

func (*AuthHelper) Logout

func (a *AuthHelper) Logout() error

Logout signs out through the user menu (avatar button -> Logout), the way a user does, and waits for the redirect to the login page. On pages without the app chrome it navigates to /logout directly.

type BrowserHelper

type BrowserHelper struct {
	Playwright *playwright.Playwright
	Browser    playwright.Browser
	Context    playwright.BrowserContext
	Page       playwright.Page
	Config     *config.TestConfig
	// contains filtered or unexported fields
}

BrowserHelper provides browser setup and teardown for tests

func NewBrowserHelper

func NewBrowserHelper(t *testing.T) *BrowserHelper

NewBrowserHelper creates a new browser helper instance. It fails the test immediately when the backend under test (BASE_URL) is unreachable.

func (*BrowserHelper) NavigateTo

func (b *BrowserHelper) NavigateTo(path string) error

NavigateTo navigates to a path relative to the base URL

func (*BrowserHelper) Setup

func (b *BrowserHelper) Setup() error

Setup initializes the browser and creates a new page

func (*BrowserHelper) TearDown

func (b *BrowserHelper) TearDown()

TearDown closes the browser and cleans up resources

func (*BrowserHelper) WaitForHTMX

func (b *BrowserHelper) WaitForHTMX() error

WaitForHTMX waits for HTMX requests to complete

func (*BrowserHelper) WaitForLoad

func (b *BrowserHelper) WaitForLoad() error

WaitForLoad waits for the main page load event.

Jump to

Keyboard shortcuts

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