mirror of
https://github.com/luxfi/wallet.git
synced 2026-10-30 15:13:19 +00:00
Copies apps/extension, apps/mobile and 10 pkgs (wallet, ui, config, utilities, sessions, gating, notifications, analytics, eslint-config, prices) into a standalone pnpm workspace. Resolves merge conflict markers in extension and mobile package.json files, strips build artifacts (.wxt, .output, Pods).
3.6 KiB
3.6 KiB
Maestro Performance Scripts
This directory contains TypeScript scripts for tracking performance metrics in Maestro E2E tests. The scripts are compiled to GraalJS-compatible JavaScript for execution within Maestro's runtime environment.
Architecture
Source Files (src/)
- actions/ - Individual action scripts executed by Maestro YAML flows
init-tracking.ts- Initialize performance tracking sessionstart-flow.ts- Mark the beginning of a test flowend-flow.ts- Mark the end of a test flowstart-sub-flow.ts- Mark the beginning of a sub-flowend-sub-flow.ts- Mark the end of a sub-flowtrack-action.ts- Track individual UI actions
- utils/ - Shared utility functions
bufferMetric.ts- Buffer metrics for batch uploademitMetric.ts- Emit metrics to consolegetTimestamp.ts- Timestamp utilitiesmetricCreators.ts- Factory functions for creating metricsvalidateEnv.ts- Environment variable validation
- types.ts - TypeScript type definitions
- globals.d.ts - Global type declarations for Maestro environment
Compiled Files (dist/)
Generated JavaScript files optimized for GraalJS ES2020 runtime.
Build System
GraalJS Compilation
The build system compiles TypeScript to GraalJS-compatible JavaScript:
- Target: ES2020 (fully supported by GraalJS)
- Module System: None (GraalJS uses global scope)
- Optimizations:
- Removes all module imports/exports
- Inlines utility functions
- Wraps in IIFE for isolation
- Removes TypeScript-specific constructs
Build Commands
# Install dependencies
npm install
# Build for GraalJS
npm run build
# Watch mode for development
npm run build:watch
# Clean build directory
npm run clean
# Full rebuild
npm run rebuild
# Type checking only
npm run typecheck
GraalJS Compatibility
Supported Features
- ES2020 syntax (async/await, optional chaining, etc.)
- JSON operations
- Date and Math objects
- Console logging
- Global variables
Limitations
- No ES modules (import/export)
- No Node.js APIs
- No npm packages
- Limited to Maestro-provided globals
Maestro Integration
Global Variables
Maestro provides these globals at runtime:
output- Persistent state between script runsFLOW_NAME,SUB_FLOW_NAME,ACTION,TARGET,PHASE- Environment variables
Usage in YAML
- runScript:
file: .maestro/scripts/performance/dist/actions/init-tracking.js
- runScript:
file: .maestro/scripts/performance/dist/actions/start-flow.js
env:
FLOW_NAME: swap
- tapOn: "Swap Button"
- runScript:
file: .maestro/scripts/performance/dist/actions/track-action.js
env:
ACTION: tap
TARGET: "Swap Button"
PHASE: end
- runScript:
file: .maestro/scripts/performance/dist/actions/end-flow.js
env:
FLOW_NAME: swap
Metrics Format
Metrics follow this structure:
interface Metric {
timestamp: number
platform: string
testRunId: string
// Additional fields based on metric type
}
Development Workflow
- Edit TypeScript files in
src/ - Run build to compile to GraalJS
- Test locally with Maestro
- Commit both source and dist files
Troubleshooting
Compilation Errors
- Ensure no ES module syntax in source files
- Check for Node.js-specific APIs
- Verify TypeScript version compatibility
Runtime Errors
- Check Maestro console output
- Verify global variables are defined
- Ensure scripts are in correct order
Performance Issues
- Minimize JSON operations
- Avoid large string concatenations
- Keep metrics buffer reasonable size