How rralex95/playwright-ts-e2e-framework works
1. What this repository is
- A TypeScript-based Playwright end-to-end test framework, not an application under test.
- Its main job is to automate browser flows against an external target site, with reusable page objects and data fixtures.
2. Top-level runtime and tooling
- The framework runs on Node.js/npm, with Playwright as the test runner and browser automation layer.
- TypeScript is used throughout for strongly typed tests and page objects.
- dotenv is used to load environment-specific values such as the base URL and credentials.
3. Environment and configuration boundary
- config/env.ts is the configuration entry point for reading environment variables.
- .env.example defines the expected runtime inputs, including BASE_URL, ADMIN_USERNAME, and ADMIN_PASSWORD.
- playwright.config.ts is the execution boundary for browser setup, test discovery, and project configuration.
4. Test data layer
- data/messages.ts centralizes validation/error text used by assertions.
- data/users.ts stores user identities and credentials/roles used by auth-oriented tests.
- data/testData.ts provides datasets for parameterized/data-driven scenarios.
- This separates test logic from test inputs so assertions and scenarios stay maintainable.
5. Page Object Model layer
- e2e/e2e/pages/... contains reusable page abstractions.
- client/ page objects cover client-facing flows such as login, registration, dashboard, and cart.
- practice/ page objects cover the practice site flows, including login and shop interactions.
- Tests call these page objects rather than directly manipulating selectors everywhere, which is the main maintainability boundary.
6. Client test suite
- e2e/e2e/tests/client/ contains focused end-to-end specs for client workflows.
- These include login and registration happy-path flows.
- The client suite maps to the client/ page object set and likely exercises a different part of the target application than the practice suite.
7. Practice test suite
- e2e/e2e/tests/practice/ is organized by concern:
- auth/ for login and validation behavior
- ui/ for dropdown, modal, radio button, and UX behavior checks
- advanced/ for data-driven scenarios
- This suite shows the framework is designed for both functional flows and UI interaction checks, not just authentication.
8. Data flow through a test
- A spec reads scenario data from data/*.
- It loads runtime configuration from config/env.ts.
- It drives the browser through a page object in e2e/e2e/pages/*.
- Assertions verify visible UI state or messages defined in the shared data files.
- That flow keeps test specs thin and pushes interaction details into the page layer.
9. Cross-browser execution model
- The framework is configured to run across Chromium, Firefox, and WebKit.
- That means the same spec suite is executed against multiple browser projects, producing the total run count described in the README.
- Browser choice is a key architectural feature here because compatibility is part of the test goal.
10. CI/CD boundary
- .github/workflows/playwright.yml runs the suite in GitHub Actions.
- The pipeline triggers on pushes to main and feature/**.
- The workflow uploads the test report as an artifact, making results available outside the runner.
11. External system under test
- The tests target a remote web application, with BASE_URL pointing to the live environment.
- Because the target is external, the framework’s architecture is centered on stable selectors, reusable flows, and environment-driven configuration rather than local service orchestration.
12. How to draw the architecture
- Place playwright.config.ts and config/env.ts as the control layer.
- Put data/* as the shared input/assertion layer.
- Put e2e/e2e/pages/* as the reusable interaction layer.
- Put e2e/e2e/tests/* as the scenario/orchestration layer.
- Show GitHub Actions as the execution/automation boundary and the external website as the system under test.
Main entry points: client Client suite · playwright.config.ts Playwright config · auth Practice auth · advanced Practice data-driven
Components 19
Control layer
Execution, configuration, and CI orchestration
- Node/npm · TypeScript Playwright test framework runtime
package.json - Playwright config · Browser projects, discovery, and execution boundary
playwright.config.ts - Env config · Reads environment variables with dotenv
config/env.ts - Env example · Expected runtime inputs such as base URL and credentials
.env.example
Shared data
Environment inputs and reusable assertions
Client pages
Page objects for client-facing flows
- Client login · Client login interactions
e2e/e2e/pages/client/ClientLoginPage.ts - Client register · Client registration interactions
e2e/e2e/pages/client/RegisterPage.ts - Client dashboard · Client dashboard interactions
e2e/e2e/pages/client/DashboardPage.ts - Client cart · Client cart interactions
e2e/e2e/pages/client/CartPage.ts
Practice pages
Page objects for practice-site flows
- Practice login · Practice-site login interactions
e2e/e2e/pages/practice/LoginPage.ts - Practice shop · Practice-site shop interactions
e2e/e2e/pages/practice/ShopPage.ts
Client tests
Client workflow specs
- Client suite · Client login and registration end-to-end scenarios
e2e/e2e/tests/client
Practice tests
Practice-site specs across auth, UI, and data-driven scenarios
- Practice auth · Practice login and validation scenarios
e2e/e2e/tests/practice/auth - Practice UI · Dropdown, modal, radio, and UX behavior checks
e2e/e2e/tests/practice/ui - Practice data-driven · Parameterized practice scenarios
e2e/e2e/tests/practice/advanced
CI/CD
GitHub Actions execution boundary
- GitHub Actions · Runs Playwright on pushes and uploads reports
.github/workflows/playwright.yml
External target
Remote application under test
- Target app · Remote web application under test
Connections 26
- Node/npm → Playwright config: runs with · Node/npm launches Playwright under this configuration
- Playwright config → Env config: loads env · Execution uses environment-derived values
- Env config → Env example: defined by · Expected variables are documented in the example file
- Playwright config → Client suite: discovers · Playwright executes client specs as projects
- Playwright config → Practice auth: discovers · Playwright executes practice specs as projects
- Playwright config → Practice UI: discovers · Playwright executes practice specs as projects
- Playwright config → Practice data-driven: discovers · Playwright executes practice specs as projects
- Client suite → Client login: uses · Client specs drive the login page object
- Client suite → Client register: uses · Client specs drive the registration page object
- Client suite → Client dashboard: uses · Client flows continue through dashboard interactions
- Client suite → Client cart: uses · Client flows can validate cart behavior
- Practice auth → Practice login: uses · Practice auth specs drive login interactions
- Practice UI → Practice shop: uses · UI specs exercise shop and widget behaviors
- Practice data-driven → Practice shop: uses · Data-driven scenarios reuse shop interactions
- Client suite → Messages: asserts with · Client assertions reuse shared message text
- Practice auth → Messages: asserts with · Auth validation uses shared message text
- Practice auth → Users: uses · Practice auth scenarios draw from user fixtures
- Client suite → Users: uses · Client auth flows use credential fixtures
- Practice data-driven → Test data: uses · Parameterized practice specs consume datasets
- Client suite → Target app: targets · Client flows exercise the remote application
- Practice auth → Target app: targets · Practice auth flows exercise the remote application
- Practice UI → Target app: targets · Practice UI checks run against the remote application
- Practice data-driven → Target app: targets · Data-driven practice scenarios run against the remote application
- GitHub Actions → Playwright config: executes · CI runs the same Playwright configuration
- GitHub Actions → Node/npm: provisions · Workflow sets up the Node/npm runtime
- GitHub Actions → Target app: tests · CI validates the external target from GitHub Actions