# dkishordev/pytest-juice-shop architecture

> Architecture diagram of the GitHub repository dkishordev/pytest-juice-shop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dkishordev/pytest-juice-shop
- Repository: https://github.com/dkishordev/pytest-juice-shop

## Overview

This repository is a pytest/Playwright automation framework for testing OWASP Juice Shop across UI, API, database, security, and integration layers. A typical flow uses shared fixtures to create test users and clients, drives the application through page objects or API calls, and checks application state through a read-only SQLite helper. The README also documents cross-layer checks, SQL-injection coverage, and a Dockerised target. Test and integration relationships are based on README descriptions; unsampled test implementations are not inspected.

Main entry points: [`pages/base_page.py`](https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/base_page.py) (Base page), [`conftest.py`](https://github.com/dkishordev/pytest-juice-shop/blob/main/conftest.py) (Shared fixtures), [`api/api_client.py`](https://github.com/dkishordev/pytest-juice-shop/blob/main/api/api_client.py) (API client), [`db/database.py`](https://github.com/dkishordev/pytest-juice-shop/blob/main/db/database.py) (Database helper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Shared runtime"]
  node_fixtures["Shared fixtures<br/>[conftest.py]"]
  node_settings["Test settings<br/>[settings.py]"]
  node_helpers["Test helpers<br/>[helpers.py]"]
end

subgraph group_ui["Browser testing"]
  node_ui_tests["UI tests"]
  node_base_page["Base page<br/>[base_page.py]"]
  node_home_page["Home page<br/>[home_page.py]"]
  node_login_page["Login page<br/>[login_page.py]"]
  node_register_page["Registration page<br/>[register_page.py]"]
  node_basket_page["Basket page<br/>[basket_page.py]"]
  node_product_page["Product page<br/>[product_page.py]"]
  node_contact_page["Contact page<br/>[contact_page.py]"]
end

subgraph group_api["API testing"]
  node_api_tests["API tests"]
  node_api_client["API client<br/>[api_client.py]"]
end

subgraph group_verification["State and security checks"]
  node_integration_tests["Cross-layer tests"]
  node_db_tests["Database tests"]
  node_database["Database helper<br/>[database.py]"]
  node_sqlite[("Juice Shop SQLite<br/>[juiceshop.sqlite]")]
  node_security_tests["Security tests"]
end

node_pytest_actor(("Test run"))
node_target["Juice Shop"]

node_pytest_actor -->|"starts fixtures"| node_fixtures
node_fixtures -->|"reads settings"| node_settings
node_fixtures -->|"creates client"| node_api_client
node_fixtures -->|"creates helper"| node_database
node_fixtures -->|"generates users"| node_helpers
node_fixtures -->|"logs in browser"| node_login_page
node_fixtures -.->|"opens browser context"| node_target
node_ui_tests -.->|"uses page objects"| node_base_page
node_base_page -->|"reads URL"| node_settings
node_home_page -->|"inherits from"| node_base_page
node_login_page -->|"inherits from"| node_base_page
node_register_page -->|"inherits from"| node_base_page
node_basket_page -->|"inherits from"| node_base_page
node_product_page -->|"inherits from"| node_base_page
node_contact_page -->|"inherits from"| node_base_page
node_contact_page -->|"uses CAPTCHA helper"| node_helpers
node_base_page -.->|"drives browser"| node_target
node_api_tests -.->|"uses client"| node_api_client
node_api_client -->|"reads API URL"| node_settings
node_api_client -.->|"sends requests"| node_target
node_db_tests -.->|"checks state"| node_database
node_database -->|"reads DB path"| node_settings
node_database -.->|"queries read-only"| node_sqlite
node_integration_tests -.->|"combines UI checks"| node_ui_tests
node_integration_tests -.->|"combines API checks"| node_api_tests
node_integration_tests -.->|"verifies DB state"| node_db_tests
node_security_tests -.->|"tests injection"| node_target

click node_fixtures "https://github.com/dkishordev/pytest-juice-shop/blob/main/conftest.py"
click node_settings "https://github.com/dkishordev/pytest-juice-shop/blob/main/config/settings.py"
click node_helpers "https://github.com/dkishordev/pytest-juice-shop/blob/main/utils/helpers.py"
click node_ui_tests "https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/ui"
click node_base_page "https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/base_page.py"
click node_home_page "https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/home_page.py"
click node_login_page "https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/login_page.py"
click node_register_page "https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/register_page.py"
click node_basket_page "https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/basket_page.py"
click node_product_page "https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/product_page.py"
click node_contact_page "https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/contact_page.py"
click node_api_tests "https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/api"
click node_api_client "https://github.com/dkishordev/pytest-juice-shop/blob/main/api/api_client.py"
click node_integration_tests "https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/integration"
click node_db_tests "https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/db"
click node_database "https://github.com/dkishordev/pytest-juice-shop/blob/main/db/database.py"
click node_sqlite "https://github.com/dkishordev/pytest-juice-shop/blob/main/data/juiceshop.sqlite"
click node_security_tests "https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/security"

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_fixtures,node_settings,node_helpers toneBlue
class node_ui_tests,node_base_page,node_home_page,node_login_page,node_register_page,node_basket_page,node_product_page,node_contact_page toneAmber
class node_api_tests,node_api_client toneMint
class node_integration_tests,node_db_tests,node_database,node_sqlite,node_security_tests toneRose
class node_pytest_actor,node_target toneIndigo
```

## Components

### Shared runtime

- [Shared fixtures](https://github.com/dkishordev/pytest-juice-shop/blob/main/conftest.py): `conftest.py`
- [Test settings](https://github.com/dkishordev/pytest-juice-shop/blob/main/config/settings.py): `config/settings.py`
- [Test helpers](https://github.com/dkishordev/pytest-juice-shop/blob/main/utils/helpers.py): `utils/helpers.py`

### Browser testing

- [UI tests](https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/ui): `tests/ui`
- [Base page](https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/base_page.py): `pages/base_page.py`
- [Home page](https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/home_page.py): `pages/home_page.py`
- [Login page](https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/login_page.py): `pages/login_page.py`
- [Registration page](https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/register_page.py): `pages/register_page.py`
- [Basket page](https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/basket_page.py): `pages/basket_page.py`
- [Product page](https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/product_page.py): `pages/product_page.py`
- [Contact page](https://github.com/dkishordev/pytest-juice-shop/blob/main/pages/contact_page.py): `pages/contact_page.py`

### API testing

- [API tests](https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/api): `tests/api`
- [API client](https://github.com/dkishordev/pytest-juice-shop/blob/main/api/api_client.py): `api/api_client.py`

### State and security checks

- [Cross-layer tests](https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/integration): `tests/integration`
- [Database tests](https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/db): `tests/db`
- [Database helper](https://github.com/dkishordev/pytest-juice-shop/blob/main/db/database.py): `db/database.py`
- [Juice Shop SQLite](https://github.com/dkishordev/pytest-juice-shop/blob/main/data/juiceshop.sqlite): `data/juiceshop.sqlite`
- [Security tests](https://github.com/dkishordev/pytest-juice-shop/tree/main/tests/security): `tests/security`

### Other components

- **Test run**
- **Juice Shop**

## Connections

- Test run → Shared fixtures: starts fixtures (evidence: `conftest.py`)
- Shared fixtures → Test settings: reads settings (evidence: `conftest.py`)
- Shared fixtures → API client: creates client (evidence: `conftest.py`)
- Shared fixtures → Database helper: creates helper (evidence: `conftest.py`)
- Shared fixtures → Test helpers: generates users (evidence: `conftest.py`)
- Shared fixtures → Login page: logs in browser (evidence: `conftest.py`)
- Shared fixtures → Juice Shop: opens browser context
- UI tests → Base page: uses page objects (evidence: `README.md`)
- Base page → Test settings: reads URL (evidence: `pages/base_page.py`)
- Home page → Base page: inherits from (evidence: `pages/home_page.py`)
- Login page → Base page: inherits from (evidence: `pages/login_page.py`)
- Registration page → Base page: inherits from (evidence: `pages/register_page.py`)
- Basket page → Base page: inherits from (evidence: `pages/basket_page.py`)
- Product page → Base page: inherits from (evidence: `pages/product_page.py`)
- Contact page → Base page: inherits from (evidence: `pages/contact_page.py`)
- Contact page → Test helpers: uses CAPTCHA helper (evidence: `pages/contact_page.py`)
- Base page → Juice Shop: drives browser (evidence: `README.md`)
- API tests → API client: uses client (evidence: `README.md`)
- API client → Test settings: reads API URL (evidence: `api/api_client.py`)
- API client → Juice Shop: sends requests (evidence: `README.md`)
- Database tests → Database helper: checks state (evidence: `README.md`)
- Database helper → Test settings: reads DB path (evidence: `db/database.py`)
- Database helper → Juice Shop SQLite: queries read-only (evidence: `README.md`)
- Cross-layer tests → UI tests: combines UI checks (evidence: `README.md`)
- Cross-layer tests → API tests: combines API checks (evidence: `README.md`)
- Cross-layer tests → Database tests: verifies DB state (evidence: `README.md`)
- Security tests → Juice Shop: tests injection (evidence: `README.md`)
