feat(workflow-e2e): add E2E tests for agentAutofillMedia workflow

- Setup E2E package under packages/e2e
- Use testcontainers to spin up postgres and temporal dev server
- Overwrite activities in global registry to mock AI model output
- Track temporal workers and expose shutdownWorkers() method for clean shutdown
- Integrate test:e2e:workflow into root package.json and GitHub actions CI
This commit is contained in:
yiling
2026-07-15 10:14:59 +08:00
parent 8efc9c1865
commit b018fd0fec
10 changed files with 387 additions and 14 deletions
+10
View File
@@ -9,6 +9,7 @@ import { TaskQueueAgent, TaskQueueTranscode, getConcurrencyLimit } from './workf
export class WorkflowService {
private executor: Executor
private activeWorkers: unknown[] = []
constructor() {
const type = process.env.WORKFLOW_EXECUTOR || 'local'
@@ -64,6 +65,13 @@ export class WorkflowService {
this.executor.close()
}
async shutdownWorkers(): Promise<void> {
await Promise.all(
this.activeWorkers.map((w) => (w as { shutdown: () => Promise<void> }).shutdown()),
)
this.activeWorkers = []
}
// Starts Temporal workers for specific task queues
async startWorkers(
queue: string,
@@ -156,6 +164,8 @@ export class WorkflowService {
},
})
this.activeWorkers.push(sharedWorker, specificWorker)
await Promise.all([sharedWorker.run(), specificWorker.run()])
} else {
console.log(