|
| 1 | +# Testing the trigger.dev Webapp |
| 2 | + |
| 3 | +## Overview |
| 4 | +How to build, run, and comprehensively test the trigger.dev webapp locally. |
| 5 | + |
| 6 | +## Devin Secrets Needed |
| 7 | +None required for local testing - the webapp auto-logs in with `local@trigger.dev` in dev mode. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | +- Node.js 20.20.0 (via nvm) |
| 11 | +- pnpm 10.23.0 |
| 12 | +- Docker services running (postgres, redis, clickhouse, electric, etc.) |
| 13 | +- Migrations applied (`pnpm run db:migrate`) |
| 14 | + |
| 15 | +## Build Process |
| 16 | +The webapp build has 3 sequential steps that must all complete: |
| 17 | + |
| 18 | +```bash |
| 19 | +cd apps/webapp |
| 20 | + |
| 21 | +# Step 1: Build Remix assets (client + server bundles) |
| 22 | +npx remix build |
| 23 | + |
| 24 | +# Step 2: Build Express server entry point |
| 25 | +npx esbuild --platform=node --format=cjs ./server.ts --outdir=build --sourcemap |
| 26 | + |
| 27 | +# Step 3: Build Sentry integration module |
| 28 | +npx esbuild --platform=node --format=cjs ./sentry.server.ts --outdir=build --sourcemap |
| 29 | +``` |
| 30 | + |
| 31 | +**Important:** `remix dev` only does Step 1. Steps 2 and 3 must be run manually before starting the dev server. The server.ts imports sentry.server.ts, so both must exist. |
| 32 | + |
| 33 | +## Starting the Dev Server |
| 34 | +```bash |
| 35 | +cd apps/webapp |
| 36 | +PORT=3030 node_modules/.bin/remix dev -c "node ./build/server.js" |
| 37 | +``` |
| 38 | + |
| 39 | +The webapp will be available at `http://localhost:3030`. It auto-redirects to the login page, and in local dev mode, logging in with `local@trigger.dev` auto-completes without needing a real email. |
| 40 | + |
| 41 | +## Operational Testing with Reference Projects |
| 42 | +To test with real task data, use the hello-world reference project: |
| 43 | + |
| 44 | +### Setup |
| 45 | +1. Update `references/hello-world/trigger.config.ts` with the local project ref: |
| 46 | + ```bash |
| 47 | + # Get project ref from database |
| 48 | + docker exec database psql -U postgres -d trigger -t -A -c "SELECT externalRef FROM \"Project\" LIMIT 1;" |
| 49 | + ``` |
| 50 | + |
| 51 | +2. Authenticate the CLI against localhost: |
| 52 | + ```bash |
| 53 | + node packages/cli-v3/dist/esm/index.js login -a http://localhost:3030 --profile local |
| 54 | + ``` |
| 55 | + |
| 56 | +3. Start the dev server: |
| 57 | + ```bash |
| 58 | + cd references/hello-world |
| 59 | + node /path/to/packages/cli-v3/dist/esm/index.js dev -a http://localhost:3030 --profile local |
| 60 | + ``` |
| 61 | + |
| 62 | +### Triggering Tasks |
| 63 | +Get the dev API key from the database: |
| 64 | +```bash |
| 65 | +docker exec database psql -U postgres -d trigger -t -A -c "SELECT apiKey FROM \"RuntimeEnvironment\" WHERE type='DEVELOPMENT' LIMIT 1;" |
| 66 | +``` |
| 67 | + |
| 68 | +Trigger tasks via API: |
| 69 | +```bash |
| 70 | +curl -s http://localhost:3030/api/v1/tasks/hello-world/trigger \ |
| 71 | + -H "Authorization: Bearer <API_KEY>" \ |
| 72 | + -H "Content-Type: application/json" \ |
| 73 | + -d '{"payload":{"sleepFor":1000}}' |
| 74 | +``` |
| 75 | + |
| 76 | +## Comprehensive UI Testing Checklist |
| 77 | + |
| 78 | +### Sidebar Pages (22 pages) |
| 79 | +- **Tasks**: Task list, search filtering, columns, row click navigation |
| 80 | +- **Runs**: Run list with mixed statuses, all table columns |
| 81 | +- **Run Detail**: Trace tree, log levels, timeline, replay button, search |
| 82 | +- **Batches**: May show empty state |
| 83 | +- **Schedules**: Schedule entries with CRON, timezone, next run |
| 84 | +- **Queues**: Queue list, pagination, search, pause buttons |
| 85 | +- **Waitpoint tokens**: May show empty state with docs links |
| 86 | +- **Deployments**: Deploy instructions, environment switcher |
| 87 | +- **Test**: Task list with search, payload editor |
| 88 | +- **Bulk actions**: Instructions, "New bulk action" button |
| 89 | +- **API keys**: Secret keys with regenerate button |
| 90 | +- **Environment variables**: Add new button |
| 91 | +- **Alerts**: Environment-specific messaging |
| 92 | +- **Preview branches**: New branch button |
| 93 | +- **Regions**: May show 400 error in local dev (no worker group) - this is expected |
| 94 | +- **Limits**: Concurrency, rate limits, quotas, plan features |
| 95 | +- **Project settings General**: Project ref, name form, delete form |
| 96 | +- **Project settings Integrations**: Integration list/empty state |
| 97 | +- **Organization settings**: Logo, org name, delete form |
| 98 | +- **Team**: User list, invite button, seat count |
| 99 | + |
| 100 | +### Filter Dropdowns |
| 101 | +- **Filter menu** (funnel icon on Runs page): 11 filter types - Status, Tasks, Tags, Versions, Queues, Machines, Run ID, Batch ID, Schedule ID, Bulk action, Error ID |
| 102 | +- **Status filter**: 13 statuses - Pending version, Delayed, Queued, Dequeued, Executing, Waiting, Completed, Failed, Timed out, Crashed, System failure, Canceled, Expired |
| 103 | +- **Date filter** (Created): Custom input, relative presets (1min-30days), exact date range, quick presets |
| 104 | +- **Root only toggle**: Updates URL with `?rootOnly=true` |
| 105 | + |
| 106 | +### Switcher Dropdowns |
| 107 | +- **Environment switcher**: Dev, Staging, Preview (expandable), Production |
| 108 | +- **Project/Org switcher**: Org info, projects, New project, New org, Account, Logout |
| 109 | + |
| 110 | +## Tips |
| 111 | +- The `pnpm run dev --filter webapp` command might not work reliably. Use the manual build + `remix dev` approach instead. |
| 112 | +- If port 3030 is already in use: `fuser -k 3030/tcp` |
| 113 | +- The trigger CLI must authenticate against localhost separately from cloud: use `-a http://localhost:3030 --profile local` |
| 114 | +- `pnpm run db:seed` may hang - it's not required if migrations are applied |
| 115 | +- The Regions page showing a 400 error in local dev is expected behavior (no worker group configured) |
0 commit comments