Skip to content

Playwright automation

Browser automation lives under src/play/ (page objects) and is orchestrated by src/signoff_timecard.py.

Page objects

Class File Role
LoginPage play/pages/login_page.py Portal login (MC Network / other domains)
DashboardPage play/pages/dashboard_page.py Post-login navigation
EmployeePage play/pages/employee_page.py Timecard / employee view, tooltips, sign-off affordances
SignOffConfirmationPage play/pages/signoff_confirmation_page.py Confirm sign-off dialog

Login URL path (relative to APIHC_BASE_URL) targets the LLCA419 live external portal login page.

Workflow (sign_off_for_user)

Typical path:

  1. New browser context; open login; submit username/password/domain.
  2. Navigate to employee timecard for the pay period.
  3. Detect already signed off vs need to sign.
  4. Confirm sign-off when required.
  5. Capture screenshots on failure or for confirmation; optional upload via src/storage.

Errors are prefixed (login error:, site error:, etc.) so Celery can map them to TimecardRunStatus in categorize_error_status.

Config knobs

Env Purpose
APIHC_BASE_URL Portal origin
APIHC_DOMAIN Directory dropdown (e.g. MC Network)
APIHC_HEADLESS Headless browser
APIHC_SLOW_MO Playwright slow-mo ms
APIHC_TIMEOUT Default timeout ms

Tests

src/play/tests/ exercises page objects against a real or local setup when credentials are present. Do not commit screenshots or traces that contain employee PII (.gitignore covers screenshots/ and test-results/).

Signoff archive • Material for MkDocs