# tamim-cste/books-automation-farman-arefin-tamim architecture

> Architecture diagram of the GitHub repository tamim-cste/books-automation-farman-arefin-tamim, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tamim-cste/books-automation-farman-arefin-tamim
- Repository: https://github.com/tamim-cste/books-automation-farman-arefin-tamim

## Overview

1. This repository is a test automation framework, not an application: it validates the public site `books.toscrape.com` using Python, Playwright, and Pytest. The architecture is centered on browser-driven UI tests with a small supporting utility layer and CI workflow.

2. The top-level execution path is: Pytest discovers tests in `tests/` → fixtures in `conftest.py` create browser/test context state → test cases call page objects in `pages/` → page objects drive Playwright against the target site. That makes the page layer the main boundary between test intent and browser mechanics.

3. `pages/` is the primary UI abstraction layer. `base_page.py` holds shared browser actions and synchronization behavior, while `home_page.py` and `book_detail_page.py` represent the two main screens under test. This keeps selectors and interaction logic out of the test cases.

4. The tests are organized by business scenario, not by technical layer:
   - `test_01_homepage.py` checks homepage integrity
   - `test_02_book_navigation.py` exercises random navigation to detail pages
   - `test_03_data_consistency.py` compares homepage and detail-page book data
   - `test_04_broken_links.py` validates href targets via HTTP
   - `test_05_image_validation.py` checks image attributes across multiple pages

5. There is a clear split between UI validation and HTTP validation. Most scenarios use Playwright in the browser, but the broken-link checks use `requests` from the utility layer to verify response codes. That means the framework crosses two protocols: DOM/browser interactions and direct network requests.

6. `utils/` is the support layer for shared logic and configuration. `config.py` likely centralizes runtime settings such as headless mode, base URL, and environment-driven defaults; `helpers.py` contains reusable functions such as price normalization and other cross-test transformations. This prevents duplicate logic in tests and page objects.

7. The suite’s data model is intentionally lightweight. The README mentions a `BookCard` dataclass, which implies book metadata is passed between page objects and tests as structured data rather than raw selectors/strings. That keeps the data flow explicit: page scrape → data object → assertion.

8. `conftest.py` is the orchestration boundary for test infrastructure. It is where browser/session fixtures, context isolation, and likely artifact capture hooks are defined. The design choice described in the README is one shared browser per run with fresh contexts per test, which balances speed and isolation.

9. Reporting is a first-class output of the framework. The suite produces pytest HTML output and Allure artifacts, and failure diagnostics include screenshots, videos, and traces. These are not part of test logic, but they are important architectural outputs because the CI pipeline and local debugging depend on them.

10. `.github/workflows/playwright.yml` is the delivery/automation layer. It installs dependencies, installs Chromium/Playwright, runs the Pytest suite, generates reports, and uploads artifacts. The workflow turns the repository into a repeatable validation pipeline triggered on push, pull request, or manual dispatch.

11. The main external dependency boundary is the target website `books.toscrape.com`. All UI assertions and data consistency checks depend on that site’s DOM structure and content. The framework is therefore sensitive to site changes, while link validation additionally depends on the availability and SSL behavior of the target endpoints.

12. For an architecture diagram, the key boxes are: CI runner, Pytest test suite, fixture/orchestration layer, page object layer, utility/config layer, Playwright browser context, and external site/HTTP endpoints. The key flows are test discovery and execution, browser interaction, data extraction/comparison, HTTP verification, and artifact/report generation.

Main entry points: [`pytest.ini`](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pytest.ini) (Pytest Runner), [`pages/home_page.py`](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pages/home_page.py) (Home Page), [`pages/book_detail_page.py`](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pages/book_detail_page.py) (Book Detail), [`conftest.py`](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/conftest.py) (Fixtures)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ci["CI / Delivery"]
  node_github_workflow["Playwright CI<br/>workflow<br/>[playwright.yml]"]
  node_reports["Reports<br/>artifacts"]
end

subgraph group_tests["Pytest Suite"]
  node_pytest_core["Pytest Runner<br/>[pytest.ini]"]
  node_conftest["Fixtures<br/>orchestration<br/>[conftest.py]"]
  node_homepage_test["Homepage Test<br/>scenario test"]
  node_nav_test["Navigation Test<br/>scenario test"]
  node_consistency_test["Consistency Test<br/>scenario test"]
  node_links_test["Broken Links<br/>scenario test"]
  node_images_test["Image Validation<br/>scenario test"]
end

subgraph group_app["Browser Flow"]
  node_base_page["Base Page<br/>page object<br/>[base_page.py]"]
  node_home_page["Home Page<br/>page object<br/>[home_page.py]"]
  node_book_detail_page["Book Detail<br/>page object"]
  node_browser[("Playwright<br/>browser runtime")]
end

subgraph group_support["Support Layer"]
  node_config["Config<br/>runtime settings<br/>[config.py]"]
  node_helpers["Helpers<br/>shared utilities<br/>[helpers.py]"]
  node_book_card["BookCard<br/>data model"]
end

subgraph group_external["External Systems"]
  node_target_site[("Books Site<br/>external website")]
  node_http_endpoints[("HTTP Endpoints<br/>network targets")]
end

node_github_workflow -->|"runs"| node_pytest_core
node_github_workflow -->|"uploads"| node_reports
node_pytest_core -->|"loads"| node_conftest
node_pytest_core -->|"executes"| node_homepage_test
node_pytest_core -->|"executes"| node_nav_test
node_pytest_core -->|"executes"| node_consistency_test
node_pytest_core -->|"executes"| node_links_test
node_pytest_core -->|"executes"| node_images_test
node_conftest -->|"creates"| node_browser
node_conftest -->|"captures"| node_reports
node_homepage_test -->|"uses"| node_home_page
node_nav_test -->|"uses"| node_home_page
node_nav_test -->|"uses"| node_book_detail_page
node_consistency_test -->|"uses"| node_home_page
node_consistency_test -->|"uses"| node_book_detail_page
node_links_test -->|"uses"| node_helpers
node_images_test -->|"uses"| node_helpers
node_home_page -->|"inherits"| node_base_page
node_book_detail_page -->|"inherits"| node_base_page
node_base_page -->|"drives"| node_browser
node_home_page -->|"navigates"| node_target_site
node_book_detail_page -->|"navigates"| node_target_site
node_home_page -->|"returns"| node_book_card
node_book_detail_page -->|"returns"| node_book_card
node_home_page -->|"reads"| node_config
node_book_detail_page -->|"reads"| node_config
node_links_test -->|"checks"| node_http_endpoints
node_images_test -->|"inspects"| node_target_site

click node_github_workflow "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/.github/workflows/playwright.yml"
click node_pytest_core "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pytest.ini"
click node_conftest "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/conftest.py"
click node_homepage_test "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_01_homepage.py"
click node_nav_test "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_02_book_navigation.py"
click node_consistency_test "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_03_data_consistency.py"
click node_links_test "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_04_broken_links.py"
click node_images_test "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_05_image_validation.py"
click node_base_page "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pages/base_page.py"
click node_home_page "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pages/home_page.py"
click node_book_detail_page "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pages/book_detail_page.py"
click node_config "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/utils/config.py"
click node_helpers "https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/utils/helpers.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_github_workflow,node_reports toneBlue
class node_pytest_core,node_conftest,node_homepage_test,node_nav_test,node_consistency_test,node_links_test,node_images_test toneAmber
class node_base_page,node_home_page,node_book_detail_page,node_browser toneMint
class node_config,node_helpers,node_book_card toneRose
class node_target_site,node_http_endpoints toneIndigo
```

## Components

### CI / Delivery

Automation and artifact publishing

- [Playwright CI](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/.github/workflows/playwright.yml): workflow · Installs dependencies, runs tests, and publishes reports/artifacts · `.github/workflows/playwright.yml`
- **Reports**: artifacts · HTML, Allure, screenshots, videos, and traces

### Pytest Suite

Test scenarios and orchestration

- [Pytest Runner](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pytest.ini): test runner · Discovers and executes the suite · `pytest.ini`
- [Fixtures](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/conftest.py): orchestration · Browser/session setup, context isolation, and artifact hooks · `conftest.py`
- [Homepage Test](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_01_homepage.py): scenario test · Checks homepage integrity · `tests/test_01_homepage.py`
- [Navigation Test](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_02_book_navigation.py): scenario test · Exercises random navigation to book detail pages · `tests/test_02_book_navigation.py`
- [Consistency Test](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_03_data_consistency.py): scenario test · Compares homepage and detail-page book data · `tests/test_03_data_consistency.py`
- [Broken Links](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_04_broken_links.py): scenario test · Validates href targets with HTTP requests · `tests/test_04_broken_links.py`
- [Image Validation](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/tests/test_05_image_validation.py): scenario test · Checks image attributes across multiple pages · `tests/test_05_image_validation.py`

### Browser Flow

Page objects and browser interaction layer

- [Base Page](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pages/base_page.py): page object · Shared browser actions and synchronization · `pages/base_page.py`
- [Home Page](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pages/home_page.py): page object · Homepage selectors and interactions · `pages/home_page.py`
- [Book Detail](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/pages/book_detail_page.py): page object · Detail-page selectors and data access · `pages/book_detail_page.py`
- **Playwright**: browser runtime · Browser context used for UI validation

### Support Layer

Shared config, helpers, and data models

- [Config](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/utils/config.py): runtime settings · Central runtime defaults such as base URL and headless mode · `utils/config.py`
- [Helpers](https://github.com/tamim-cste/books-automation-farman-arefin-tamim/blob/main/utils/helpers.py): shared utilities · Reusable transforms such as price normalization · `utils/helpers.py`
- **BookCard**: data model · Lightweight book metadata passed between pages and tests

### External Systems

Target site and network endpoints

- **Books Site**: external website · books.toscrape.com target for all UI assertions
- **HTTP Endpoints**: network targets · Book and asset URLs checked by link validation

## Connections

- Playwright CI → Pytest Runner: runs · CI invokes the test runner
- Playwright CI → Reports: uploads · Artifacts and reports are collected in CI
- Pytest Runner → Fixtures: loads · Pytest initializes shared fixtures and hooks
- Pytest Runner → Homepage Test: executes · Suite includes homepage validation
- Pytest Runner → Navigation Test: executes · Suite includes navigation validation
- Pytest Runner → Consistency Test: executes · Suite includes data consistency validation
- Pytest Runner → Broken Links: executes · Suite includes link validation
- Pytest Runner → Image Validation: executes · Suite includes image validation
- Fixtures → Playwright: creates · Fixtures provision browser and fresh contexts
- Fixtures → Reports: captures · Failures emit screenshots, videos, and traces
- Homepage Test → Home Page: uses · Homepage scenario delegates browser actions
- Navigation Test → Home Page: uses · Navigation begins from the homepage abstraction
- Navigation Test → Book Detail: uses · Navigation lands on detail pages
- Consistency Test → Home Page: uses · Scrapes book data from homepage cards
- Consistency Test → Book Detail: uses · Compares homepage data with detail pages
- Broken Links → Helpers: uses · Shared logic supports response checks and transforms
- Image Validation → Helpers: uses · Shared transformations support image assertions
- Home Page → Base Page: inherits · Homepage builds on common browser behavior
- Book Detail → Base Page: inherits · Detail page builds on common browser behavior
- Base Page → Playwright: drives · Common actions execute through Playwright
- Home Page → Books Site: navigates · Homepage automation targets the public site
- Book Detail → Books Site: navigates · Detail-page automation targets the public site
- Home Page → BookCard: returns · Homepage scraping produces structured book data
- Book Detail → BookCard: returns · Detail-page scraping produces structured book data
- Home Page → Config: reads · Page behavior uses shared runtime settings
- Book Detail → Config: reads · Page behavior uses shared runtime settings
- Broken Links → HTTP Endpoints: checks · Broken-link validation verifies URL responses
- Image Validation → Books Site: inspects · Image assertions depend on rendered site content
