test-endorphin
v1.0.0
Published
This directory simulates a real user project to test the Endorphin AI package from the user's perspective.
Downloads
5
Readme
Endorphin AI User Project Test Environment
This directory simulates a real user project to test the Endorphin AI package from the user's perspective.
🎯 Purpose
Test that:
- ✅ Package installs correctly from local repository
- ✅ Test recorder creates files in USER project (not framework)
- ✅ All CLI commands work from user project perspective
- ✅ Environment variables are properly inherited
- ✅ Configuration works as expected
🚀 Quick Start
1. Setup the Environment
./setup-user-project.sh2. Test the Test Recorder Location
./test-recorder.sh3. Test Running Tests
./run-test.sh USER-0014. Use Quick Commands
./quick-commands.sh📋 Available Scripts
| Script | Purpose |
|--------|---------|
| setup-user-project.sh | Initialize/reset the user project environment |
| test-recorder.sh | Verify test recorder creates files in correct location |
| run-test.sh <test-id> | Run a specific test |
| quick-commands.sh | Convenient shortcuts for all operations |
🧪 Test Scenarios
Scenario 1: Package Installation
./quick-commands.sh setup
./quick-commands.sh statusScenario 2: Test Discovery
./quick-commands.sh listScenario 3: Test Recording
./quick-commands.sh recorder
# Check that files are created in ./test-recorder/ (not framework)Scenario 4: Test Execution
./quick-commands.sh run USER-001Scenario 5: File Location Verification
./quick-commands.sh test-location📁 Expected Directory Structure
After running tests, you should see:
tmp/test-endorphin/ # User project (THIS directory)
├── .env # Environment variables (copied from main repo)
├── endorphin.config.js # User configuration
├── package.json # User project manifest
├── node_modules/
│ └── endorphin-ai/ # Installed package
├── tests/ # User's test files
│ └── user-basic-test.js
├── test-recorder/ # ✅ Recording artifacts (USER project)
│ └── REC-[timestamp]/
│ ├── test-session.json
│ ├── summary.json
│ └── steps/
└── test-results/ # Test execution results
../../test-recorder/ # Framework directory
# ✅ Should remain EMPTY🔍 Verification Points
✅ Success Indicators
- [ ] Package installs without errors
- [ ]
npx endorphin --versionworks - [ ]
npx endorphin listdiscovers tests - [ ] Test recorder creates
./test-recorder/in USER project - [ ] Framework
test-recorder/directory remains empty - [ ] Generated tests appear in
./tests/directory - [ ] Environment variables work correctly
❌ Failure Indicators
- [ ] Package fails to install
- [ ] CLI commands don't work
- [ ] Test recorder creates files in framework directory
- [ ] Missing environment variables
- [ ] Configuration not loaded properly
🔧 Environment Setup
The setup script automatically:
- Creates a fresh npm project
- Installs endorphin-ai from local repository
- Copies
.envfrom main repo (including OPENAI_API_KEY) - Creates user configuration file
- Sets up convenient npm scripts
- Creates sample test files
💡 Usage Tips
Quick Commands Examples
# Setup everything
./quick-commands.sh setup
# List all available tests
./quick-commands.sh list
# Run specific test
./quick-commands.sh run USER-001
# Start test recorder
./quick-commands.sh recorder
# Check project status
./quick-commands.sh status
# Clean up generated files
./quick-commands.sh cleanManual Testing
# Test CLI directly
npx endorphin --version
npx endorphin list
npx endorphin run test USER-001
npx endorphin run test-recorder
# Check file locations
ls -la test-recorder/ # Should have recordings
ls -la ../../test-recorder/ # Should be empty🐛 Troubleshooting
"Package not found"
# Reinstall from local repository
npm install ../../"API key not set"
# Check environment variables
cat .env
# Copy from main repo if needed
cp ../../.env .env"Test recorder files in wrong location"
# Run verification script
./test-recorder.sh"Tests not discovered"
# Check test format
cat tests/user-basic-test.js
# Verify exports are correctThis test environment ensures that the Endorphin AI package works correctly from a user's perspective and that all files are created in the appropriate locations.
