Python testing
Running all tests
From the repository root:- Install dependencies using pnpm
- Start the mock server on port 4000
- Run pytest with the test suite
- Generate a JUnit XML report
Test configuration
The test script uses the following environment variables:TIMEOUT_PROXY_MOCK_SERVER_SECONDS: Timeout for mock server startup (default: 30)MOCK_SERVER_PORT: Port for the mock server (default: 4000)PYTHONPATH: Set to${WAX_DIR}pythonfor absolute imports
Running specific tests
Pass additional pytest arguments to the script:Running helpy tests
Test the helper utilities:Test structure
Python tests are organized in:Mock server
Tests use a mock server to simulate Hive API responses. The mock server is defined in:- TypeScript implementation:
ts/wasm/__tests__/assets/proxy-mock-server.ts - Start script:
ts/wasm/__tests__/assets/start-proxy-mock-server.ts
TypeScript testing
Running all tests
From thets/ directory:
Running specific test projects
Run individual test suites:Test projects
The CI pipeline runs tests in parallel across multiple projects:wax_testsuite: Main test suitehealthchecker_tests: Health check functionalitywax_utils: Utility function testswax_non_encrypted_operations: Non-encrypted operation testswax_mock_tests: Mock server testswax_encrypted_operations: Encrypted operation testswax_custom_chain_online_tx: Custom chain testswax_testsuite_custom_chain_options: Custom chain optionswax_regression_tests: Regression test suitewax_operation_factories: Operation factory testswax_testsuite_protocol_benchmarks: Performance benchmarks
Test configuration
Tests are configured ints/playwright.config.ts with multiple projects defined for parallel execution.
Running benchmarks
Run performance benchmarks:Python examples
Running Python examples
From the repository root:Installing example dependencies
Environment variables
Examples use the following optional environment variables:PASSWORD: Wallet password (optional, defaults provided)WALLET_NAME: Wallet name (optional)ACCOUNT_NAME: Hive account nameTRANSFER_RECEIVER: Transfer recipient accountPRIVATE_KEY: Account private keyPUBLIC_KEY: Account public keyHIVED_ADDRESS: Hive node endpoint URL
Available Python examples
Examples are located inexamples/python/examples/:
create_and_sign_transaction.py: Build and sign transactions- Transaction building examples
- API call examples
- Complex operation examples
TypeScript examples
Running TypeScript examples
From thets/ directory:
Running signature extension examples
Example projects
TypeScript examples demonstrate various frameworks and use cases:package.json: Dependencies and scriptsREADME.md: Example-specific instructions- Source code demonstrating WAX usage
CI/CD testing
Pipeline test stages
The GitLab CI pipeline runs comprehensive tests:Python tests
-
test_wax_protobuf_python: Main Python test suite
- Runs pytest with mock server
- Generates JUnit XML reports
- Tests all Python versions (3.12, 3.14)
-
test_wax_protobuf_python_pattern: Verify generated proto files
- Compares generated files against patterns
- Ensures proto generation is consistent
-
test_wax_protobuf_python_examples: Run example scripts
- Validates all examples work correctly
-
test_helpy: Test helper utilities
- Runs pytest with auto-discovery
- Tests run in parallel with
-n auto
TypeScript tests
-
test_wax_wasm: Main TypeScript test suite
- Runs in parallel across multiple test projects
- Uses Playwright for browser testing
- Matrix of test groups for faster execution
-
test_wax_wasm_proto_pattern: Verify generated proto files
- Compares TypeScript proto files against patterns
- Validates npm package contents
-
test_wax_wasm_examples: Run example applications
- Validates examples build and run correctly
- Tests framework integrations
-
test_wax_wasm_signature_extension: Test browser extension
- Validates signature extension example
Test requirements
All CI jobs must pass - marking jobs as
allow_failure is not permitted in this project.Local testing before pushing
Always test locally before pushing:Test-tools package
The test-tools package provides utilities for testing:Running test-tools unit tests
Running test-tools integration tests
Linting and static analysis
Python linting
From thepython/ directory:
TypeScript linting
From thets/ directory:
Troubleshooting
Mock server won't start
Mock server won't start
Check if port 4000 is already in use:Or use a different port:
Import errors in tests
Import errors in tests
Ensure PYTHONPATH is set correctly:Or use the test script which sets it automatically:
Playwright browser not found
Playwright browser not found
Install Playwright browsers:
Tests fail with Python version mismatch
Tests fail with Python version mismatch
Ensure you’re using the correct Python version:
pnpm install fails
pnpm install fails
Try clearing the pnpm cache:
Next steps
Contributing
Learn how to contribute to WAX
Troubleshooting
Find solutions to common issues