helpers

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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