Dev/E2E Chart of Accounts Seeding
This system provides convenient ways to seed development and testing organizations with a standard set of chart of accounts, eliminating the need to manually create accounts during testing.Overview
The seeding system provides the following standard dev chart of accounts:Account Name | Number | Type | Description | Reconciled |
---|---|---|---|---|
Shopify Bank | 1200 | Credit | Shopify bank account | ❌ |
Paypal Bank | 1201 | Credit | PayPal bank account | ❌ |
Paypal Working Capital | 1300 | Credit | PayPal working capital | ❌ |
Shopify Deb. | 70000 | Debit | Shopify debtor account | ✅ |
Paypal Deb | 70001 | Debit | PayPal debtor account | ✅ |
Shopify Fee | 4970 | Debit | Shopify fees | ❌ |
Paypal Fee | 4971 | Debit | PayPal fees | ❌ |
Shopify Transit | 1360 | Credit | Shopify transit account | ❌ |
Paypal Transit | 1361 | Credit | PayPal transit account | ❌ |
Währungsdifferenzen | 2150 | Debit | Currency differences | ❌ |
Rev DE | 8000 | Debit | Revenue Germany | ❌ |
Rev AT | 8001 | Debit | Revenue Austria | ❌ |
Rev CH | 8002 | Debit | Revenue Switzerland | ❌ |
Rev FR | 8003 | Debit | Revenue France | ❌ |
Rev UK | 8004 | Debit | Revenue United Kingdom | ❌ |
Rev ES | 8005 | Debit | Revenue Spain | ❌ |
other deb | 80000 | Debit | Other debtor accounts | ❌ |
fallback | 99999 | Debit | Fallback account | ❌ |
Usage Methods
1. UI Button (Recommended for Manual Testing)
Navigate to/setup/chart-of-accounts
in your dev environment and click the “🛠️ Seed Dev Accounts” button in the chart of accounts card header.
- Only visible in development environment (NODE_ENV === “development”)
- Uses the new
warning
button variant with proper CI colors for dev/testing purposes - Shows loading state during seeding
- Displays success/error toasts
- Automatically refreshes the page to show new accounts
2. CLI Script (Recommended for Automation)
Use the CLI script for automated testing or CI/CD pipelines:DATABASE_URL
must be set (uses organization’s database)
Features
- Interactive Prompts: Asks for required parameters if not provided as arguments
- Validation: Validates organization ID format
- Confirmation: Shows summary and asks for confirmation before seeding
- Non-Interactive Mode: Supports automation by providing arguments
3. Server Action (Programmatic Use)
For programmatic usage in tests or other server-side code:E2E Testing Integration
Playwright/E2E Tests
Add this to your test setup:CI/CD Integration
Add to your CI pipeline after creating a test organization:Features
- Upsert Logic: Accounts are upserted, so running the seed multiple times is safe
- Existing Account Handling: Won’t duplicate accounts, will update existing ones
- Audit Trail: Uses actor ID for created/modified by tracking
- Error Handling: Continues seeding even if individual accounts fail
- Logging: Comprehensive logging for debugging
- Single Source of Truth: Chart data defined once in CLI script, imported by UI seeding functions
Important Notes
⚠️ This is for development/testing only!- This seeding is NOT part of production organization setup
- It’s separate from the standard organization seeding in
create-organisation.ts
- The UI button only appears in development environment and uses the proper
warning
variant styling - Accounts are created with standard test data, not production-ready configurations
- Uses centralized
getEnvironmentInfo()
utility for consistent dev environment detection
Modifying Chart Data
To add, remove, or modify the standard dev chart of accounts:- Edit only
apps/webapp/scripts/seed-dev-chart-accounts.mjs
- Update the
DEV_CHART_OF_ACCOUNTS
array - Both UI button and CLI will automatically use the updated data
File Structure
Troubleshooting
“Organization not found” error:- Verify the organization ID is correct
- Ensure you have database access
- The script will continue without an actor ID
- You can provide a specific actor ID as the second parameter
- Verify
DATABASE_URL
environment variable is set - Check database connectivity
- Ensure you’re in a development environment
- Check that you’re authenticated and have access to the organization