Skip to content

Architecture

yhAutomationQA edited this page May 9, 2026 · 1 revision

Architecture

Project Structure

├── config/         Environment configuration
├── fixtures/       Custom Playwright fixtures (DI)
├── helpers/        ApiClient, HttpStatus constants
├── pages/          Page Object Model (BasePage, Login, Inventory, Cart)
├── tests/          Test specs (UI + API)
├── utils/          Logger, test data
├── .github/        GitHub Actions CI pipeline
├── Dockerfile      Docker image definition
├── docker-compose.yml  Docker orchestration
├── Jenkinsfile     Jenkins CI pipeline
└── sonar-project.properties  SonarCloud config

Page Object Model

All page objects extend BasePage which provides:

  • navigate(url) — page navigation
  • click(locator) — element click (auto-waits for actionability)
  • fill(locator, text) — text input
  • selectOption(locator, value) — dropdown selection
  • getText(locator) / getTexts(locator) — text retrieval
  • getCount(locator) — element count
  • isVisible(locator) / isHidden(locator) — visibility checks

Playwright's auto-waiting means no explicit waitForElement is needed.

Fixtures (Dependency Injection)

Custom fixtures in fixtures/index.ts handle setup/teardown:

  • loginPage — navigates to login page, cleans up after
  • inventoryPage — auto-login as standard_user
  • cartPage — auto-login and land on cart
  • apiClient — pre-configured HTTP client

ApiClient

Typed HTTP client that wraps Playwright's APIRequestContext:

Method Description
get GET request with optional query params
post POST request with JSON body
put PUT request with JSON body
delete DELETE request

Custom headers via setHeader(key, value) and removeHeader(key).

Clone this wiki locally