Skip to content

Repository files navigation

JDXP Test Automation - Playwright BDD

This project provides end-to-end test automation for the JDXP (Jamaica Digital Exchange Platform) using Playwright with BDD (Behavior Driven Development) approach.

🏗️ Architecture

Modular Structure

  • Isolated Modules: Each test area (membership, third-party-accreditation) is completely separate
  • Page Object Model: Enhanced page objects with your existing locator entity approach
  • Entity-Aware Testing: Automatic handling of local vs foreign entity differences
  • Fixtures: Dependency injection for clean, reusable test code

Directory Structure

jdxp-test-automation-playwright-bdd/
├── test/
│   └── Modules/
│       ├── membership/                    # Membership module (isolated)
│       │   ├── config/
│       │   │   ├── entity-types.ts       # Entity type definitions
│       │   │   └── locators.config.ts    # Your locator entity approach
│       │   ├── features/                 # Gherkin feature files
│       │   ├── fixtures/                 # Playwright BDD fixtures
│       │   ├── pages/                    # Page Object Models
│       │   ├── steps/                    # Step definitions
│       │   └── playwright.config.ts     # Module-specific config
│       │
│       └── third-party-accreditation/    # Future module (isolated)
│
├── test-results/                         # Test outputs
├── .generated/                           # Auto-generated test files
└── package.json

🚀 Getting Started

1. Install Dependencies

npm install

2. Install Playwright Browsers

npm run test:install

3. Run Tests

Membership Module

# Generate BDD tests and run membership module
npm run bdd:membership

# Run on different environments
npm run bdd:membership:dev     # Development environment
npm run bdd:membership:qa      # QA environment
npm run bdd:membership:sandbox # Sandbox environment

# Run with different modes
npm run bdd:membership:headed   # With browser UI
npm run bdd:membership:headless # Headless mode

Future Modules

# Third-party accreditation (when implemented)
npm run bdd:accreditation
npm run bdd:accreditation:qa

# Run all modules
npm run bdd:all

🎯 Key Features

1. Entity-Aware Testing

Tests automatically adapt to local vs foreign entities using tags:

@local-entity
Scenario: Local entity registration
  # Uses local entity locators and flow

@foreign-entity  
Scenario: Foreign entity registration
  # Uses foreign entity locators and flow

2. Locator Entity Approach

Your existing locator configuration is enhanced for Playwright BDD:

// Automatic locator selection based on entity type
const memberDetailsPage = new MemberDetailsPage(page, entityType);
await memberDetailsPage.fillCompanyTRN("123456789"); // Uses correct locator

3. Workflow-Focused Page Objects

Page objects provide both granular and workflow methods:

// Granular control
await memberDetailsPage.fillCompanyTRN("123456789");
await memberDetailsPage.fillBranchNumber("001");

// Workflow methods
await memberDetailsPage.fillBasicCompanyInfo(companyData);
await memberDetailsPage.completeForm(fullData);

4. Fixtures for Clean Tests

Automatic dependency injection:

// Step definitions get pre-configured page objects
Given('I am on the member details page', async ({ memberDetailsPage }) => {
  await memberDetailsPage.goto(); // Already configured for correct entity type
});

🧪 Writing Tests

1. Feature Files

Write business-readable scenarios in features/ directories:

Feature: Member Details Registration
  @local-entity
  Scenario: Complete local entity registration
    Given I am on the member details page
    When I complete the member details form
    Then the form should be submitted successfully

2. Step Definitions

Implement steps using fixtures in steps/ directories:

When('I complete the member details form', async ({ memberDetailsPage, entityType }) => {
  console.log(`Completing form for ${entityType} entity`);
  await memberDetailsPage.completeForm(testData);
});

3. Page Objects

Create page objects in pages/ directories using your locator entity approach:

export class MemberDetailsPage extends BasePage {
  private locators = getPageLocators('memberDetails', this.entityType);
  
  async fillCompanyTRN(trn: string) {
    await this.fillInput(this.locators.companyTRN, trn);
  }
}

🔧 Configuration

Environment URLs

Set via environment variables or npm scripts:

  • Development: https://jdxp.nginxdev.egovja.com
  • QA: https://jdxp.appsqa.egovja.com
  • Sandbox: https://jdxp.appsandbox.egovja.com
  • Pre-prod: https://jdxp.appspreprod.egovja.com

Browser Configuration

Each module can configure its own browsers and settings in playwright.config.ts.

📊 Reporting

HTML Reports

npm run test:report

Test Results

  • HTML Report: test-results/membership-playwright-report/
  • JSON Results: test-results/membership-results.json
  • JUnit XML: test-results/membership-results.xml

🐛 Debugging

Debug Mode

npm run test:debug

UI Mode

npm run test:ui

Screenshots

Automatic screenshots on failure, stored in test-results/screenshots/

🔄 Adding New Modules

  1. Create new module directory: test/Modules/new-module/
  2. Copy structure from membership module
  3. Update locators, pages, and features for new module
  4. Add npm scripts in package.json
  5. Create module-specific playwright.config.ts

🎯 Benefits

  • Isolated Modules: One module failure doesn't affect others
  • Entity-Aware: Automatic local/foreign entity handling
  • Maintainable: Your existing locator entity approach preserved
  • Scalable: Easy to add new modules and tests
  • Reliable: Playwright's robust automation
  • Fast: Parallel execution and efficient test runs

📚 Documentation

Complete Documentation Suite

Key Documentation Highlights

  • Architecture Patterns - Modular design, entity-aware testing, locator entity pattern
  • Development Workflows - Adding modules, pages, entity types, and test scenarios
  • Troubleshooting Guide - Common issues and solutions
  • Best Practices - Code organization, testing strategies, and maintenance
  • Extension Guide - How to scale and extend the framework

Quick Links

This architecture provides a robust, scalable foundation for comprehensive test automation while maintaining the flexibility to adapt to changing business requirements.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages