How thewikidea/leaf-automated-tests works
This repository is not the LEAF application itself; it is the automated test suite for LEAF, the target system hosted elsewhere. Architecturally, it is split into two independent test harnesses that validate different layers of behavior: API-level contract testing in Go and browser-level end-to-end testing with Playwright.
The main system boundary is external: both test suites connect to a running LEAF development environment at https://host.docker.internal/ and exercise the deployed app through its HTTP APIs and UI. The tests do not appear to mock LEAF internals; instead they verify the behavior of the integrated system as a black-box consumer.
API-tests/ is the service/API validation layer. It is a Go module with many focused test files grouped by domain: employee, events, form, group, platform, service, workflow, plus auth/redirect coverage. This layer is likely doing direct HTTP/API calls and asserting response correctness, status codes, and data shape.
Within API-tests/, the presence of database/nexus_test_db.sql and database/portal_test_db.sql plus dbsetup_test.go shows that the API tests also depend on seeded relational test data. That means the API layer is not just stateless request/response testing; it validates behavior against a known database state and probably resets or prepares fixtures before execution.
API-tests/helper_test.go, main_test.go, and hotspot_benchmarks_test.go suggest shared test scaffolding and some performance-oriented coverage. The domain-specific files such as formQuery.go, formStack.go, and formWorkflow.go indicate that some tests model LEAF’s internal business objects and workflows rather than purely testing raw endpoints.
api-test-helper/ is a small Go utility module with its own main.go. It likely exists to support API test execution or environment setup, acting as a lightweight companion tool rather than a separate product subsystem.
end2end/ is the UI validation layer. It is a Node/TypeScript Playwright project with playwright.config.ts, global.setup.ts, main.js, package.json, and a suite of .spec.ts files. This layer drives a browser and verifies user-visible flows end to end.
The Playwright test suite is organized around user journeys and application areas: inbox, lifecycle/request creation, admin panels, report builder, organizational chart, mass actions, email templates, print view, advanced search, and account updater flows. These tests cover cross-cutting interactions that span UI, backend, and database state, which complements the lower-level API suite.
end2end/tests/global.setup.ts likely prepares shared authentication or environment state before the browser suite runs. The variety of specs implies that the end-to-end tests are scenario-based rather than unit-like, and they validate that LEAF features work together through the actual UI.
The repository also contains documentation artifacts under end2end/docs/ and issue templates in .github/, which support test management rather than runtime behavior. The Excel files suggest manual QA planning or traceability alongside automation.
CI/CD is handled through GitHub Actions in .github/workflows/, with CodeQL analysis and pull-request automation. This indicates the repo is set up to enforce code health and run validation on changes, though the actual test execution likely depends on external LEAF environment availability.
For an architecture diagram, the key flows are: developer/CI triggers API tests and Playwright tests; both suites connect outward to a running LEAF instance; API tests additionally depend on seeded test databases; end-to-end tests depend on browser automation setup; and GitHub Actions provides the repository-level automation and security scanning around those test assets.
Main entry points: API-tests API tests · end2end Playwright suite · pullrequests.yml PR checks · workflows GitHub Actions
Components 19
CI / repo automation
GitHub Actions, templates, and policy files that govern validation and maintenance.
- GitHub Actions · Runs code quality checks and pull-request automation.
.github/workflows - CodeQL · Static analysis and security scanning configuration.
.github/workflows/codeql-analysis.yml - PR checks · Pull request automation and repository checks.
.github/workflows/pullrequests.yml
API tests
Go-based contract and database-backed validation against the LEAF system.
- API tests · Contract and behavior tests for LEAF's HTTP and domain APIs.
API-tests - Test DBs · Seed data used to prepare and validate API test state.
API-tests/database - DB setup · Prepares or resets database state for the API suite.
API-tests/dbsetup_test.go - Shared helpers · Common test support used across API test cases.
API-tests/helper_test.go - Domain cases · Focused coverage for employee, events, form, group, platform, service, workflow, login, and redirects.
- Form models · Form query, stack, and workflow modeling used by the API suite.
API-tests/formQuery.go - Hotspot bench · Performance-oriented API coverage.
API-tests/hotspot_benchmarks_test.go - API helper tool · Small companion executable used to support API test execution or setup.
api-test-helper/main.go
End-to-end tests
Playwright browser suite that exercises LEAF through the UI.
- Playwright suite · Node/TypeScript end-to-end tests driven through a real browser.
end2end - Global setup · Shared Playwright initialization such as authentication or environment setup.
end2end/tests/global.setup.ts - Playwright config · Defines how the browser suite is executed.
end2end/playwright.config.ts - UI journeys · Scenario-based browser coverage for inbox, lifecycle, admin, reports, search, templates, print, and account flows.
end2end/tests - QA docs · Manual test planning and traceability artifacts.
end2end/docs
External LEAF system
The running LEAF environment hosted outside this repository that both test harnesses target.
- LEAF APIs · Running LEAF development environment exercised by the API suite.
- LEAF UI · Browser-facing LEAF application exercised by Playwright.
- LEAF data · Underlying application state and relational data observed by the tests.
Connections 20
- GitHub Actions → CodeQL: includes · Workflow definition for security scanning.
- GitHub Actions → PR checks: includes · Workflow definition for pull-request automation.
- PR checks → API tests: runs · Triggers the API validation suite.
- PR checks → Playwright suite: runs · Triggers the browser validation suite.
- API tests → DB setup: boots · Prepares test database state before execution.
- DB setup → Test DBs: loads · Uses seeded SQL fixtures.
- API tests → Shared helpers: shares · Common scaffolding across tests.
- API tests → Domain cases: covers · Domain-specific HTTP and behavior checks.
- API tests → Form models: models · Encodes form and workflow business objects.
- API tests → Hotspot bench: measures · Benchmark coverage.
- API tests → API helper tool: supports · Companion utility for API test execution.
- API tests → LEAF APIs: calls · Black-box HTTP/API validation against LEAF.
- API tests → LEAF data: verifies · Assertions depend on seeded database state.
- Playwright suite → Playwright config: configured by · Playwright execution settings.
- Playwright suite → Global setup: prepares · Shared browser-suite initialization.
- Playwright suite → UI journeys: runs · Scenario-based browser specs.
- Playwright suite → QA docs: documents · Manual QA and traceability artifacts.
- Playwright suite → LEAF UI: drives · Browser-based black-box interaction with LEAF.
- Playwright suite → LEAF APIs: depends on · UI flows rely on the live LEAF backend.
- Playwright suite → LEAF data: observes · Flows are validated against persistent system state.