LIFE INSURANCE E2E AUTOMATION & ENTERPRISE REPORTING

A complete insurance domain automation framework in Playwright Python: end-to-end policy underwriting, digital KYC verification, multi-mode premium payments, death/maturity claim settlement adjudication, Pydantic DTO models, and executive Allure test reporting.

🛡️ Insurance Domain Automation: The Core Four Pillars

Life insurance digital portals require rigorous compliance, state machine consistency, and multi-tier transaction validation. An automated test suite cannot treat these operations as isolated browser forms. This case study covers the complete insurance policy lifecycle across four mission-critical operational pillars: 1. Policy Creation & Underwriting (calculating term plan premiums, riders, and medical limits), 2. Policy Verification & Underwriter Approval (document scrutiny, KYC verification, status escalation from Pending to Active), 3. Multi-Channel Premium Payment (NetBanking, UPI, credit card gateways, and recurring auto-debit ledgers), and 4. Claim Adjudication & Settlement (death benefit and maturity claim disbursement, death certificate parsing, and ledger balance reconciliation). Every step runs with strongly-typed Pydantic models, Faker data generation, and executive-level Allure reporting.

1. Insurance Core Lifecycle & State Transition Architecture
Insurance policies transition through strict compliance checkpoints. The automation framework mirrors the actual policy lifecycle from proposal ingestion to settlement payout.
State Machine & Framework Architecture Topography
INSURANCE POLICY STATE MACHINE & PIPELINE:
┌─────────────────────────────────────────────────────────────────────────────┐
│ PILLAR 1: POLICY PROPOSAL CREATION (Customer Portal)                        │
│  * Insured details (Age, Smoker status, Annual Income, Sum Assured)         │
│  * Dynamic Premium Calculation Matrix (Term life base + Critical illness)   │
│  * Output: Proposal ID generated -> State: "PROPOSAL_SUBMITTED"             │
└─────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ PILLAR 2: UNDERWRITING SCRUTINY & VERIFICATION (Admin / UW Dashboard)       │
│  * Identity proof validation (PAN / Aadhaar document scrutiny)              │
│  * Medical tele-underwriting verification & risk rating classification      │
│  * State Transition: "PROPOSAL_SUBMITTED" ──► "UNDERWRITING_APPROVED"       │
└─────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ PILLAR 3: PREMIUM PAYMENT & POLICY ISSUANCE (Billing Gateway)               │
│  * First Premium Receipt (FPR) payment via NetBanking / UPI                 │
│  * Generation of 10-digit Master Policy Number                              │
│  * State Transition: "UNDERWRITING_APPROVED" ──► "POLICY_IN_FORCE"          │
└─────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ PILLAR 4: CLAIM ADJUDICATION & DISBURSEMENT (Claims Officer Portal)         │
│  * Claim notification (Death benefit / Maturity survival claim)              │
│  * Document upload (Hospital death summary / Original policy bond)          │
│  * Settlement approval: Fund transfer via NEFT & Tax Form 16 reconciliation │
│  * Terminal State Transition: "POLICY_IN_FORCE" ──► "CLAIM_SETTLED_CLOSED"  │
└─────────────────────────────────────────────────────────────────────────────┘
Lifecycle Standard: The automated suite asserts that each state transition satisfies regulatory audit rules and updates the centralized core ledger without data loss.
Real-Time Example 1: Pydantic DTO Insurance Contracts & Data Models
Model insurance proposals, payment vouchers, and claim settlement requests using Pydantic v2 schemas to ensure strict validation of sums assured, policy tenure, and Indian tax codes.
Python (dto/insurance_models.py)
from enum import Enum
from typing import Optional
from pydantic import BaseModel, Field, EmailStr

class PolicyStatus(str, Enum):
    PROPOSAL_SUBMITTED = "PROPOSAL_SUBMITTED"
    UNDERWRITING_APPROVED = "UNDERWRITING_APPROVED"
    POLICY_IN_FORCE = "POLICY_IN_FORCE"
    CLAIM_LODGED = "CLAIM_LODGED"
    CLAIM_SETTLED_CLOSED = "CLAIM_SETTLED_CLOSED"

class ProposalCreationDTO(BaseModel):
    """Proposal request schema for Term Life Insurance policy creation."""
    proposer_name: str = Field(min_length=3, max_length=80)
    email: EmailStr
    age: int = Field(ge=18, le=65, description="Eligible entry age between 18 and 65")
    is_smoker: bool
    annual_income_inr: float = Field(ge=300000.0, description="Minimum salary benchmark")
    sum_assured_inr: float = Field(ge=2500000.0, le=50000000.0)
    tenure_years: int = Field(ge=10, le=40)
    pan_number: str = Field(pattern=r"^[A-Z]{5}[0-9]{4}[A-Z]{1}$")

class ClaimSettlementDTO(BaseModel):
    """Payload schema for filing and adjudicating death/maturity claims."""
    policy_number: str = Field(pattern=r"^POL-\d{8}$")
    nominee_name: str
    nominee_bank_account: str = Field(min_length=9, max_length=18)
    ifsc_code: str = Field(pattern=r"^[A-Z]{4}0[A-Z0-9]{6}$")
    claim_amount_inr: float = Field(gt=0.0)
    cause_of_claim: str

# Sample DTO validation
proposal_data = ProposalCreationDTO(
    proposer_name="Pooja Patil",
    email="pooja.patil@nikita-infotech.com",
    age=32,
    is_smoker=False,
    annual_income_inr=1800000.0,
    sum_assured_inr=10000000.0, # ₹ 1 Crore Term Cover
    tenure_years=30,
    pan_number="ABCDE1234F"
)
print("Insurance Proposal DTO Initialized:")
print(f"  Proposer : {proposal_data.proposer_name} (Age: {proposal_data.age})")
print(f"  Coverage : ₹ {proposal_data.sum_assured_inr:,.2f} for {proposal_data.tenure_years} Years")
Output: Insurance Proposal DTO Initialized: Proposer : Pooja Patil (Age: 32) Coverage : ₹ 10,000,000.00 for 30 Years
Real-Time Example 2: Pillar 1 - Policy Proposal Creation & Premium Calculation
Automate policy generation in the customer portal. The script inputs user risk factors (age, smoker status, sum assured) and validates that the premium calculation matrix updates reactively.
Python (pages/policy_creation_page.py)
from playwright.sync_api import sync_playwright, expect

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    page = browser.new_page()

    page.set_content("""
        

Life Shield Term Insurance Plan









Annual Premium: ₹ 11,800 (incl. 18% GST)
""") # 1. Verify default premium for ₹ 1 Crore non-smoker cover expect(page.locator("#premium-display")).to_have_text("Annual Premium: ₹ 11,800 (incl. 18% GST)") # 2. Toggle smoker flag and observe dynamic premium adjustment (₹10,000 * 1.6 * 1.18 = ₹18,880) page.locator("#smoker-flag").check() expect(page.locator("#premium-display")).to_have_text("Annual Premium: ₹ 18,880 (incl. 18% GST)") # 3. Submit proposal to trigger unique proposal tracking reference page.locator("#btn-submit-proposal").click() proposal_ref = page.locator("#proposal-ref") expect(proposal_ref).to_have_text("PROPOSAL-REF-2026-99214") print(f"Policy Proposal Created: Reference = '{proposal_ref.inner_text()}'") browser.close()
Output: Policy Proposal Created: Reference = 'PROPOSAL-REF-2026-99214'
Real-Time Example 3: Pillar 2 - Underwriter Scrutiny, KYC & Verification
Automate the underwriting portal where an authorized officer inspects document proofs, verifies medical ratings, and approves the proposal into an underwritten policy ready for payment.
Python (pages/underwriting_scrutiny.py)
from playwright.sync_api import sync_playwright, expect

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    page = browser.new_page()

    page.set_content("""
        

Underwriting Workbench: Proposal #PROPOSAL-REF-2026-99214

Customer: Pooja Patil | Sum Assured: ₹ 1,00,00,000
Medical Score: Standard Healthy (Class 1)




STATUS: PENDING_SCRUTINY
""") # Assert approve button is initially disabled (strict compliance rule) approve_button = page.locator("#btn-approve-uw") expect(approve_button).to_be_disabled() # Complete document verification scrutiny checklist page.locator("#kyc-verified").check() page.locator("#income-verified").check() expect(approve_button).to_be_enabled() # Approve risk assessment approve_button.click() status_label = page.locator("#uw-status") expect(status_label).to_have_text("STATUS: UNDERWRITING_APPROVED") print(f"Underwriting Phase Verified: '{status_label.inner_text()}'") browser.close()
Output: Underwriting Phase Verified: 'STATUS: UNDERWRITING_APPROVED'
Real-Time Example 4: Pillar 3 - Premium Payment & Policy Bond Generation
Execute the initial premium payment through the billing gateway. Assert payment confirmation, capture the generated 10-digit Master Policy Number, and intercept the downloaded Policy Schedule PDF.
Python (pages/premium_payment_gateway.py)
import os
import tempfile
from playwright.sync_api import sync_playwright, expect

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    page = browser.new_page()

    page.set_content("""
        

Premium Collection Gateway

Proposal: PROPOSAL-REF-2026-99214
Payable Amount: ₹ 11,800.00



""") # Execute payment authorization click page.locator("#btn-pay-premium").click() # Verify official policy number generation policy_locator = page.locator("#master-policy-no") expect(policy_locator).to_have_text("POL-44810294") generated_policy_num = policy_locator.inner_text() # Intercept asynchronous download of the official Policy Bond PDF with page.expect_download() as download_info: page.locator("#download-policy-bond").click() bond_download = download_info.value target_path = os.path.join(tempfile.gettempdir(), bond_download.suggested_filename) bond_download.save_as(target_path) print("Policy Payment & Issuance Verified:") print(f" Master Policy Number : {generated_policy_num}") print(f" Policy Bond File : {bond_download.suggested_filename} ({os.path.getsize(target_path)} bytes)") assert generated_policy_num.startswith("POL-") assert os.path.exists(target_path) if os.path.exists(target_path): os.remove(target_path) browser.close()
Output: Policy Payment & Issuance Verified: Master Policy Number : POL-44810294 Policy Bond File : Policy_Schedule_POL-44810294.pdf (114 bytes)
Real-Time Example 5: Pillar 4 - Death & Maturity Claim Adjudication
Automate the claims officer console: filing a death benefit claim for ₹ 1 Crore, uploading digital verification records, approving the disbursement, and checking the NEFT reference ledger.
Python (pages/claim_settlement_page.py)
from playwright.sync_api import sync_playwright, expect

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    page = browser.new_page()

    page.set_content("""
        

Claims Adjudication Workbench

Active Policy: POL-44810294
Sum Assured: ₹ 1,00,00,000.00
Nominee: Aarav Patil (Spouse)






""") # 1. Verify policy eligibility expect(page.locator("#policy-disp")).to_have_text("POL-44810294") # 2. Approve and disburse settlement payout page.locator("#btn-settle-claim").click() # 3. Assert settlement outcomes utr_locator = page.locator("#utr-ref") final_status = page.locator("#final-state") expect(utr_locator).to_have_text("NEFT-RBI-2026-9941024") expect(final_status).to_have_text("Status: CLAIM_SETTLED_CLOSED") print(f"Claim Adjudication Finalized: UTR = '{utr_locator.inner_text()}'") print(f"Policy Terminal State: '{final_status.inner_text()}'") browser.close()
Output: Claim Adjudication Finalized: UTR = 'NEFT-RBI-2026-9941024' Policy Terminal State: 'Status: CLAIM_SETTLED_CLOSED'
Real-Time Example 6: Fast-Track Hybrid Seeding via Insurance Core API
Bypass UI form filling in regression suites: seed an approved policy directly in 45ms using Playwright's APIRequestContext, then load the browser directly on the claims portal to test settlement.
Python (Fast API Seeding + Direct Claims UI Validation)
import json
from playwright.sync_api import sync_playwright, expect

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    context = browser.new_context()

    # 1. API PRECONDITION: Seed active policy directly into core database in 40ms
    seeded_policy = {
        "policy_number": "POL-99482015",
        "customer_name": "Pooja Patil",
        "sum_assured_inr": 10000000.0,
        "premium_paid_inr": 11800.0,
        "status": "POLICY_IN_FORCE"
    }

    seed_res = context.request.post("https://httpbin.org/post", data=seeded_policy)
    expect(seed_res).to_be_ok()
    print(f"[Core API Setup] Policy {seeded_policy['policy_number']} seeded in 38ms.")

    # 2. UI VALIDATION: Navigate browser directly to Policy In-Force details view
    page = context.new_page()
    page.set_content(f"""
        

Policy Servicing Dashboard

{seeded_policy['policy_number']}
{seeded_policy['status']}
""") expect(page.locator("#pol-id")).to_have_text("POL-99482015") expect(page.locator("#pol-status")).to_have_text("POLICY_IN_FORCE") page.locator("#btn-lodge-claim").click() expect(page.locator("#pol-status")).to_have_text("CLAIM_LODGED") print("Hybrid test passed: Fast API creation with targeted UI claim transition!") context.close() browser.close()
Output: [Core API Setup] Policy POL-99482015 seeded in 38ms. Hybrid test passed: Fast API creation with targeted UI claim transition!
Real-Time Example 7: Complete Allure BDD Insurance Test Suite
Orchestrate the complete four-pillar life insurance user journey using Pytest and Allure BDD annotations, documenting every step from proposal submission to claim settlement.
Python (tests/e2e/test_life_insurance_e2e.py)
import allure
import pytest
from playwright.sync_api import Page, expect

@allure.epic("Life Insurance Core Operations")
@allure.feature("End-to-End Policy Lifecycle Management")
class TestLifeInsuranceE2E:

    @allure.story("Pillars 1 to 4: Proposal, Underwriting, Payment & Settlement")
    @allure.severity(allure.severity_level.BLOCKER)
    @allure.title("Complete Life Insurance Cycle: Creation to Claim Payout")
    def test_full_policy_lifecycle(self, page: Page):

        # ── PILLAR 1: PROPOSAL CREATION ─────────────────────────────
        with allure.step("Pillar 1: Create Term Life Proposal with ₹ 1 Crore Sum Assured"):
            page.set_content("""
                
STAGE_PROPOSAL
""") page.locator("#btn-next").click() expect(page.locator("#stage")).to_have_text("STAGE_UNDERWRITING_APPROVED") allure.attach("Proposal Ref: PROP-2026-9921", name="Proposal_Metadata", attachment_type=allure.attachment_type.TEXT) # ── PILLAR 2: UNDERWRITING SCRUTINY ──────────────────────── with allure.step("Pillar 2: Complete KYC Document Scrutiny & Risk Approval"): page.evaluate("""() => { document.getElementById('stage').innerText = 'STAGE_PAYMENT_READY'; }""") expect(page.locator("#stage")).to_have_text("STAGE_PAYMENT_READY") # ── PILLAR 3: PREMIUM PAYMENT ─────────────────────────────── with allure.step("Pillar 3: Process Annual Premium Payment of ₹ 11,800 via NetBanking"): page.evaluate("""() => { document.getElementById('stage').innerText = 'POLICY_IN_FORCE: POL-44810294'; }""") expect(page.locator("#stage")).to_contain_text("POL-44810294") allure.attach("10-Digit Master Policy Number: POL-44810294", name="Policy_Issuance_Confirmation", attachment_type=allure.attachment_type.TEXT) # ── PILLAR 4: CLAIM SETTLEMENT ────────────────────────────── with allure.step("Pillar 4: Adjudicate Death Benefit Claim & Disburse ₹ 1 Crore via NEFT"): page.evaluate("""() => { document.getElementById('stage').innerText = 'CLAIM_SETTLED_CLOSED: UTR-994102'; }""") expect(page.locator("#stage")).to_contain_text("CLAIM_SETTLED_CLOSED") allure.attach("NEFT Disbursed: ₹ 1,00,00,000.00 | UTR: UTR-994102", name="Settlement_Voucher", attachment_type=allure.attachment_type.TEXT) print("All 4 insurance pillars executed and documented in Allure executive report!")
Allure Executive Report: Epic: Life Insurance Core Operations -> Feature: End-to-End Policy Lifecycle Management * Story: Pillars 1 to 4: Proposal, Underwriting, Payment & Settlement [Severity: BLOCKER] ✓ Pillar 1: Create Term Life Proposal with ₹ 1 Crore Sum Assured ✓ Pillar 2: Complete KYC Document Scrutiny & Risk Approval ✓ Pillar 3: Process Annual Premium Payment of ₹ 11,800 via NetBanking ✓ Pillar 4: Adjudicate Death Benefit Claim & Disburse ₹ 1 Crore via NEFT Attachments: Proposal_Metadata, Policy_Issuance_Confirmation, Settlement_Voucher
Real-Time Example 8: CI/CD GitHub Actions Workflow for Insurance Regression
A production-ready GitHub Actions YAML pipeline that runs the insurance test suite across parallel workers, enforces Allure report compilation, and archives policy bond test artifacts.
YAML (.github/workflows/insurance_pipeline.yml)
name: Life Insurance Core Automation Pipeline

on:
  push:
    branches: [main]
  pull_request:

jobs:
  insurance-regression:
    name: Four-Pillars Policy Lifecycle Suite
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"
          cache: "pip"

      - name: Install Dependencies
        run: |
          pip install -r requirements.txt
          playwright install --with-deps chromium

      - name: Run Complete Insurance Test Suite
        run: |
          pytest tests/e2e/test_life_insurance_e2e.py \
            -n 2 \
            --alluredir=allure-results \
            --tracing retain-on-failure

      - name: Compile Allure HTML Report
        uses: simple-elf/allure-report-action@master
        if: always()
        with:
          allure_results: allure-results
          allure_history: allure-history
          keep_reports: 20

      - name: Deploy Report to GitHub Pages
        if: always()
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: gh-pages
          publish_dir: allure-history
CI Pipeline Status: 4-Pillar Insurance Suite executed cleanly across parallel workers. Allure Report published with step attachments, trace downloads, and execution trends.
Real-Time Example 9: Insurance Domain Automation Reference Matrix
A comprehensive reference summary aligning each insurance domain phase with its specific testing challenge, Playwright Python solution, and validation criteria.
Life Insurance Automation Architectural Matrix
LIFE INSURANCE DOMAIN AUTOMATION MATRIX:
┌──────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┐
│ Insurance Phase / Pillar     │ Automation Challenge                     │ Recommended Playwright Python Solution   │
├──────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┤
│ 1. Proposal Creation         │ Dynamic premium recalculation on smoker/  │ expect(page.locator("#prem")).to_have_   │
│                              │ age change without full page reloads     │ text(...) with auto-waiting              │
│ 2. Underwriting Verification │ Multi-tier KYC checks and document       │ Checkbox assertions + verifying state    │
│                              │ review blocking status escalation        │ transitions to UNDERWRITING_APPROVED     │
│ 3. Premium Payment           │ Third-party payment gateways and PDF     │ Intercept payment via mock route +       │
│                              │ policy schedule bond generation          │ page.expect_download() for PDF capture   │
│ 4. Claim Adjudication        │ Adjudicating ₹1 Cr+ payouts, death cert   │ Assert NEFT UTR generation and terminal  │
│                              │ uploads, and terminal policy closures    │ status change to CLAIM_SETTLED_CLOSED    │
│ Hybrid Fast-Track Seeding    │ Avoid 15-minute form filling to reach    │ Seed active policies via direct API      │
│                              │ the claims stage during regression runs  │ calls in 40ms using context.request      │
│ Executive Reporting          │ Complex financial audit requirements     │ allure-pytest steps with attached UTR    │
│                              │ and regulatory compliance logs           │ numbers, policy IDs, and failure traces  │
└──────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┘
Engineering Best Practice: Fast-track deep insurance regression by seeding policy states directly via APIRequestContext. Use Page Objects for visual calculations and document every step using Allure to generate auditable compliance reports.