Skip to content

ONDC-Official/automation-winx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

automation-winx

workbench in a Box - ONDC Protocol workbench testing tool

License: ISC TypeScript Node.js

Automation-Winx is a comprehensive terminal-based testing and validation framework for ONDC (Open Network for Digital Commerce) protocol implementations. It simulates the complete ONDC workbench experience directly in your terminal, enabling automated end-to-end flow testing with multi-layered validation.

🎯 Overview

This tool provides a "workbench in a box" solution that:

  • Validates config: Validates the schema of configuration files
  • Api Service Simulation: Performs L0 (Schema), L1 (Business Logic), and l1- Custom validations
  • Mock Service Simulation: Generates realistic API responses for comprehensive flow testing
  • Reporting: Generates detailed CLI and file-based reports with validation results

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Automation-Winx                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   Config Validation β”‚    Flow Execution   β”‚     API Validation      β”‚
β”‚   β”œβ”€ YAML Schemas   β”‚    β”œβ”€ Mock Service   β”‚     β”œβ”€ L0 (Schema)      β”‚
β”‚   β”œβ”€ Flow Config    β”‚    β”œβ”€ API Service    β”‚     β”œβ”€ L1 (Business)    β”‚
β”‚   └─ Factory Config β”‚    └─ Session Mgmt   β”‚     └─ Custom Rules     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚                         β”‚
                    β”‚    Reporting System     β”‚
                    β”‚  β”œβ”€ CLI Report          β”‚
                    β”‚  β”œβ”€ JSON Artifacts      β”‚
                    β”‚  β”œβ”€ Flow Traces         β”‚
                    β”‚  └─ Error Analysis      β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Features

πŸ”§ Multi-Layer Validation Engine

  • L0 Validations: JSON Schema compliance checks
  • L1 Validations: Business logic rule validation
  • L1 Custom Validations: Domain-specific validation rules
  • Context Validations: Protocol context and timing validations

🌊 Flow Execution Engine

  • Complete Journey Simulation: End-to-end transaction flow execution
  • Mock Response Generation: Intelligent API response simulation
  • Session Management: Redis-based session state management
  • Error Handling: Comprehensive error capture and reporting

πŸ“Š Reporting

  • CLI Reports: Color-coded terminal output with status indicators
  • Detailed File Reports: JSON artifacts with complete execution traces
  • Flow Visualization: Step-by-step flow execution breakdown
  • Error Analytics: Comprehensive error categorization and analysis

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • TypeScript

Installation

  1. Clone the repository

    git clone https://github.com/ONDC-Official/automation-winx.git
    cd automation-winx
  2. Install dependencies

    npm install
  3. Set environment variables

    export DOMAIN=ONDC:TRV14
    export VERSION=2.0.0
    export NODE_ENV=development
  4. Replace config files with your own in src/config/

  5. Run the workbench

    npm run workbench

πŸ“– Usage

Basic Execution

# Run complete workbench with all validations
npm run workbench

# Run with specific configuration
DOMAIN=ONDC:TRV14 VERSION=2.0.0 npm run workbench

Configuration Options

The runner supports various configuration options via the runner-config-manager:

// Customize validation behavior
setRunnerConfig({
	runFlows: true,
	runConfigValidations: true,
	runApiService: {
		L0Validations: true,
		L1Validations: true,
		L1CustomValidations: true,
		ContextValidations: true,
	},
});

πŸ“ˆ Reporting

CLI Report Features

πŸ” ONDC VALIDATION REPORT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: PASSED | Errors: 0 | Warnings: 2
Report ID: 1726325400000

⚠️ Context validations skipped as per configuration
βœ… All protocol flows executed successfully

Full report: ./winx-report/
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
VALIDATION PASSED

File Report Structure

winx-report/
β”œβ”€β”€ flows/                     # Flow execution details
β”‚   β”œβ”€β”€ incremental-pull-journey/
β”‚   β”œβ”€β”€ purchase-journey-without-form/
β”‚   └── user-cancellation-full/
β”œβ”€β”€ redis/                     # Session cache data
β”œβ”€β”€ errors.json               # Detailed error logs
β”œβ”€β”€ warnings.json             # Warning details
└── meta.json                 # Report metadata

πŸ› Troubleshooting

Common Issues

  1. Environment Variables Missing check .env file or set manually:

    DOMAIN=ONDC:TRV14
    VERSION=2.0.0
    NODE_ENV=development
  2. Validation Module Not Found

    • Run code generation if validation modules are missing
    • Check generated/ directories for required files
  3. Configuration Validation Failures

    • Validate YAML syntax in configuration files
    • Check schema compliance using provided validators

πŸ“š API Reference

Configuration Types

type MainRunnerConfigType = {
	createApiService: boolean;
	runFlows: boolean;
	runConfigValidations: boolean;
	runApiService: {
		skipAll: boolean;
		L0Validations: boolean;
		L1Validations: boolean;
		L1CustomValidations: boolean;
		ContextValidations: boolean;
	};
	runMockService: {
		skipAll: boolean;
	};
};

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the ISC License - see the LICENSE file for details.

πŸ“ž Support


Automation-Winx - Bringing the power of ONDC workbench testing to your terminal! πŸš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages