# jinabn/ai_test_repo architecture

> Architecture diagram of the GitHub repository jinabn/ai_test_repo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jinabn/ai_test_repo
- Repository: https://github.com/jinabn/ai_test_repo

## Overview

This is a Playwright/TypeScript end-to-end automation framework for Dynamics 365 CRM and Inventory Management. Its main workflow runs authenticated browser tests through page objects, using generated test data and producing reports; a separate ticket-to-test workflow fetches Azure DevOps work items, optionally uses an AI provider to generate cases, then writes runnable specs and synchronizes test cases. The graph includes documented capabilities and source-index-supported dependencies; unsampled test-runner wiring is represented only where the README documents it.

Main entry points: [`tests/crm/contacts.spec.ts`](https://github.com/jinabn/ai_test_repo/blob/main/tests/crm/contacts.spec.ts) (CRM specs), [`src/azure/AzureDevOpsClient.ts`](https://github.com/jinabn/ai_test_repo/blob/main/src/azure/AzureDevOpsClient.ts) (Azure client), [`src/pages/crm/ContactsPage.ts`](https://github.com/jinabn/ai_test_repo/blob/main/src/pages/crm/ContactsPage.ts) (Contacts page), [`src/pages/BasePage.ts`](https://github.com/jinabn/ai_test_repo/blob/main/src/pages/BasePage.ts) (Page primitives)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_execution["Browser testing"]
  node_crmtests["CRM specs<br/>[contacts.spec.ts]"]
  node_inventorytests["Inventory spec"]
  node_authsetup["Session setup<br/>[auth.setup.ts]"]
  node_bdd["BDD steps<br/>[contacts.steps.ts]"]
  node_world["Scenario context<br/>[world.ts]"]
end

subgraph group_pages["Application pages"]
  node_basepage["Page primitives<br/>[BasePage.ts]"]
  node_dashboard["CRM navigation"]
  node_login["CRM login<br/>[LoginPage.ts]"]
  node_contacts["Contacts page<br/>[ContactsPage.ts]"]
  node_accounts["Accounts page<br/>[AccountsPage.ts]"]
  node_leads["Leads page<br/>[LeadsPage.ts]"]
  node_inventorypage["Inventory page"]
end

subgraph group_generation["Test generation"]
  node_azurecli["Azure sync CLI<br/>[syncTestCases.ts]"]
  node_manual["Manual workflow<br/>[manualWorkflow.ts]"]
  node_generatecli["Local generation CLI<br/>[generateTests.ts]"]
  node_generator["AI case generator"]
  node_writer["Spec writer<br/>[TestCaseWriter.ts]"]
end

subgraph group_integrations["External systems"]
  node_azureclient["Azure client"]
  node_azure["Azure DevOps"]
  node_ai["AI provider"]
  node_crm["Dynamics CRM"]
  node_inventory["Inventory system"]
end

subgraph group_shared["Shared support"]
  node_authhelper["Session reuse<br/>[authHelper.ts]"]
  node_testdata["Test data factory<br/>[testDataHelper.ts]"]
  node_screenshots["Screenshots"]
  node_config["Environment config<br/>[index.ts]"]
end

node_qa(("QA engineer"))

node_qa -->|"runs tests"| node_crmtests
node_qa -->|"runs tests"| node_inventorytests
node_authsetup -->|"saves session"| node_authhelper
node_crmtests -->|"uses page object"| node_contacts
node_crmtests -->|"uses page object"| node_accounts
node_crmtests -->|"uses page object"| node_leads
node_crmtests -->|"reuses session"| node_authhelper
node_inventorytests -->|"automates inventory"| node_inventorypage
node_contacts -->|"inherits navigation"| node_dashboard
node_accounts -->|"inherits navigation"| node_dashboard
node_leads -->|"inherits navigation"| node_dashboard
node_dashboard -->|"extends helpers"| node_basepage
node_login -->|"extends helpers"| node_basepage
node_inventorypage -->|"extends helpers"| node_basepage
node_basepage -->|"drives browser"| node_crm
node_inventorypage -->|"drives browser"| node_inventory
node_bdd -->|"uses context"| node_world
node_bdd -->|"calls page actions"| node_contacts
node_contacts -->|"uses generated data"| node_testdata
node_azurecli -->|"fetches and syncs"| node_azureclient
node_azurecli -->|"generates cases"| node_generator
node_azurecli -->|"writes specs"| node_writer
node_manual -->|"fetches work item"| node_azureclient
node_manual -->|"creates test data"| node_testdata
node_generatecli -->|"generates cases"| node_generator
node_generatecli -->|"writes specs"| node_writer
node_generatecli -->|"fetches ticket"| node_azureclient
node_generator -->|"requests generation"| node_ai
node_azureclient -->|"calls REST API"| node_azure
node_config -->|"provides settings"| node_azureclient
node_config -->|"provides credentials"| node_generator
node_authhelper -->|"reads settings"| node_config

click node_crmtests "https://github.com/jinabn/ai_test_repo/blob/main/tests/crm/contacts.spec.ts"
click node_inventorytests "https://github.com/jinabn/ai_test_repo/blob/main/tests/inventory/validate-inventory-management-navigation-for-stock-transfer-.spec.ts"
click node_authsetup "https://github.com/jinabn/ai_test_repo/blob/main/tests/auth/auth.setup.ts"
click node_bdd "https://github.com/jinabn/ai_test_repo/blob/main/step-definitions/crm/contacts.steps.ts"
click node_world "https://github.com/jinabn/ai_test_repo/blob/main/step-definitions/world.ts"
click node_basepage "https://github.com/jinabn/ai_test_repo/blob/main/src/pages/BasePage.ts"
click node_dashboard "https://github.com/jinabn/ai_test_repo/blob/main/src/pages/CRMDashboardPage.ts"
click node_login "https://github.com/jinabn/ai_test_repo/blob/main/src/pages/LoginPage.ts"
click node_contacts "https://github.com/jinabn/ai_test_repo/blob/main/src/pages/crm/ContactsPage.ts"
click node_accounts "https://github.com/jinabn/ai_test_repo/blob/main/src/pages/crm/AccountsPage.ts"
click node_leads "https://github.com/jinabn/ai_test_repo/blob/main/src/pages/crm/LeadsPage.ts"
click node_inventorypage "https://github.com/jinabn/ai_test_repo/blob/main/src/pages/inventory/ValidateInventoryManagementPage.ts"
click node_azurecli "https://github.com/jinabn/ai_test_repo/blob/main/src/azure/syncTestCases.ts"
click node_manual "https://github.com/jinabn/ai_test_repo/blob/main/src/azure/manualWorkflow.ts"
click node_generatecli "https://github.com/jinabn/ai_test_repo/blob/main/src/ai/generateTests.ts"
click node_generator "https://github.com/jinabn/ai_test_repo/blob/main/src/ai/AITestCaseGenerator.ts"
click node_writer "https://github.com/jinabn/ai_test_repo/blob/main/src/ai/TestCaseWriter.ts"
click node_azureclient "https://github.com/jinabn/ai_test_repo/blob/main/src/azure/AzureDevOpsClient.ts"
click node_authhelper "https://github.com/jinabn/ai_test_repo/blob/main/src/utils/authHelper.ts"
click node_testdata "https://github.com/jinabn/ai_test_repo/blob/main/src/utils/testDataHelper.ts"
click node_screenshots "https://github.com/jinabn/ai_test_repo/blob/main/src/utils/screenshotHelper.ts"
click node_config "https://github.com/jinabn/ai_test_repo/blob/main/src/config/index.ts"

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_crmtests,node_inventorytests,node_authsetup,node_bdd,node_world toneBlue
class node_basepage,node_dashboard,node_login,node_contacts,node_accounts,node_leads,node_inventorypage toneAmber
class node_azurecli,node_manual,node_generatecli,node_generator,node_writer toneMint
class node_azureclient,node_azure,node_ai,node_crm,node_inventory toneRose
class node_authhelper,node_testdata,node_screenshots,node_config,node_qa toneIndigo
```

## Components

### Browser testing

- [CRM specs](https://github.com/jinabn/ai_test_repo/blob/main/tests/crm/contacts.spec.ts): `tests/crm/contacts.spec.ts`
- [Inventory spec](https://github.com/jinabn/ai_test_repo/blob/main/tests/inventory/validate-inventory-management-navigation-for-stock-transfer-.spec.ts): `tests/inventory/validate-inventory-management-navigation-for-stock-transfer-.spec.ts`
- [Session setup](https://github.com/jinabn/ai_test_repo/blob/main/tests/auth/auth.setup.ts): `tests/auth/auth.setup.ts`
- [BDD steps](https://github.com/jinabn/ai_test_repo/blob/main/step-definitions/crm/contacts.steps.ts): `step-definitions/crm/contacts.steps.ts`
- [Scenario context](https://github.com/jinabn/ai_test_repo/blob/main/step-definitions/world.ts): `step-definitions/world.ts`

### Application pages

- [Page primitives](https://github.com/jinabn/ai_test_repo/blob/main/src/pages/BasePage.ts): `src/pages/BasePage.ts`
- [CRM navigation](https://github.com/jinabn/ai_test_repo/blob/main/src/pages/CRMDashboardPage.ts): `src/pages/CRMDashboardPage.ts`
- [CRM login](https://github.com/jinabn/ai_test_repo/blob/main/src/pages/LoginPage.ts): `src/pages/LoginPage.ts`
- [Contacts page](https://github.com/jinabn/ai_test_repo/blob/main/src/pages/crm/ContactsPage.ts): `src/pages/crm/ContactsPage.ts`
- [Accounts page](https://github.com/jinabn/ai_test_repo/blob/main/src/pages/crm/AccountsPage.ts): `src/pages/crm/AccountsPage.ts`
- [Leads page](https://github.com/jinabn/ai_test_repo/blob/main/src/pages/crm/LeadsPage.ts): `src/pages/crm/LeadsPage.ts`
- [Inventory page](https://github.com/jinabn/ai_test_repo/blob/main/src/pages/inventory/ValidateInventoryManagementPage.ts): `src/pages/inventory/ValidateInventoryManagementPage.ts`

### Test generation

- [Azure sync CLI](https://github.com/jinabn/ai_test_repo/blob/main/src/azure/syncTestCases.ts): `src/azure/syncTestCases.ts`
- [Manual workflow](https://github.com/jinabn/ai_test_repo/blob/main/src/azure/manualWorkflow.ts): `src/azure/manualWorkflow.ts`
- [Local generation CLI](https://github.com/jinabn/ai_test_repo/blob/main/src/ai/generateTests.ts): `src/ai/generateTests.ts`
- [AI case generator](https://github.com/jinabn/ai_test_repo/blob/main/src/ai/AITestCaseGenerator.ts): `src/ai/AITestCaseGenerator.ts`
- [Spec writer](https://github.com/jinabn/ai_test_repo/blob/main/src/ai/TestCaseWriter.ts): `src/ai/TestCaseWriter.ts`

### External systems

- [Azure client](https://github.com/jinabn/ai_test_repo/blob/main/src/azure/AzureDevOpsClient.ts): `src/azure/AzureDevOpsClient.ts`
- **Azure DevOps**
- **AI provider**
- **Dynamics CRM**
- **Inventory system**

### Shared support

- [Session reuse](https://github.com/jinabn/ai_test_repo/blob/main/src/utils/authHelper.ts): `src/utils/authHelper.ts`
- [Test data factory](https://github.com/jinabn/ai_test_repo/blob/main/src/utils/testDataHelper.ts): `src/utils/testDataHelper.ts`
- [Screenshots](https://github.com/jinabn/ai_test_repo/blob/main/src/utils/screenshotHelper.ts): `src/utils/screenshotHelper.ts`
- [Environment config](https://github.com/jinabn/ai_test_repo/blob/main/src/config/index.ts): `src/config/index.ts`

### Other components

- **QA engineer**

## Connections

- QA engineer → CRM specs: runs tests (evidence: `README.md`)
- QA engineer → Inventory spec: runs tests (evidence: `README.md`)
- Session setup → Session reuse: saves session (evidence: `README.md`)
- CRM specs → Contacts page: uses page object (evidence: `README.md`)
- CRM specs → Accounts page: uses page object (evidence: `README.md`)
- CRM specs → Leads page: uses page object (evidence: `README.md`)
- CRM specs → Session reuse: reuses session (evidence: `README.md`)
- Inventory spec → Inventory page: automates inventory (evidence: `README.md`)
- Contacts page → CRM navigation: inherits navigation (evidence: `src/pages/crm/ContactsPage.ts`)
- Accounts page → CRM navigation: inherits navigation (evidence: `src/pages/crm/AccountsPage.ts`)
- Leads page → CRM navigation: inherits navigation (evidence: `src/pages/crm/LeadsPage.ts`)
- CRM navigation → Page primitives: extends helpers (evidence: `src/pages/CRMDashboardPage.ts`)
- CRM login → Page primitives: extends helpers (evidence: `src/pages/LoginPage.ts`)
- Inventory page → Page primitives: extends helpers
- Page primitives → Dynamics CRM: drives browser (evidence: `README.md`)
- Inventory page → Inventory system: drives browser (evidence: `README.md`)
- BDD steps → Scenario context: uses context (evidence: `step-definitions/crm/contacts.steps.ts`)
- BDD steps → Contacts page: calls page actions (evidence: `step-definitions/crm/contacts.steps.ts`)
- Contacts page → Test data factory: uses generated data (evidence: `step-definitions/crm/contacts.steps.ts`)
- Azure sync CLI → Azure client: fetches and syncs (evidence: `src/azure/syncTestCases.ts`)
- Azure sync CLI → AI case generator: generates cases (evidence: `src/azure/syncTestCases.ts`)
- Azure sync CLI → Spec writer: writes specs (evidence: `src/azure/syncTestCases.ts`)
- Manual workflow → Azure client: fetches work item (evidence: `src/azure/manualWorkflow.ts`)
- Manual workflow → Test data factory: creates test data (evidence: `src/azure/manualWorkflow.ts`)
- Local generation CLI → AI case generator: generates cases (evidence: `src/ai/generateTests.ts`)
- Local generation CLI → Spec writer: writes specs (evidence: `src/ai/generateTests.ts`)
- Local generation CLI → Azure client: fetches ticket (evidence: `src/ai/generateTests.ts`)
- AI case generator → AI provider: requests generation (evidence: `src/ai/AITestCaseGenerator.ts`)
- Azure client → Azure DevOps: calls REST API (evidence: `src/azure/AzureDevOpsClient.ts`)
- Environment config → Azure client: provides settings (evidence: `src/azure/AzureDevOpsClient.ts`)
- Environment config → AI case generator: provides credentials (evidence: `src/ai/AITestCaseGenerator.ts`)
- Session reuse → Environment config: reads settings (evidence: `src/utils/authHelper.ts`)
