* Main cleanup function
()
| 61 | * Main cleanup function |
| 62 | */ |
| 63 | async function cleanup() { |
| 64 | console.log('🧹 E2E Test Cleanup'); |
| 65 | console.log(''); |
| 66 | |
| 67 | try { |
| 68 | // Fetch all workflows |
| 69 | const workflows = await getWorkflows(); |
| 70 | |
| 71 | // Filter test workflows (those starting with "Error Test:") |
| 72 | const testWorkflows = workflows.filter((wf: any) => |
| 73 | wf.name?.startsWith(TEST_WORKFLOW_PREFIX) |
| 74 | ); |
| 75 | |
| 76 | if (testWorkflows.length === 0) { |
| 77 | console.log('✨ No test workflows found - workspace is clean'); |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | console.log(`Found ${testWorkflows.length} test workflow(s):`); |
| 82 | |
| 83 | // Delete each test workflow |
| 84 | for (const workflow of testWorkflows) { |
| 85 | await deleteWorkflow(workflow.id, workflow.name); |
| 86 | } |
| 87 | |
| 88 | console.log(''); |
| 89 | console.log(`✨ Cleanup complete - deleted ${testWorkflows.length} test workflow(s)`); |
| 90 | |
| 91 | } catch (error) { |
| 92 | console.error(''); |
| 93 | console.error('❌ Cleanup failed:', error); |
| 94 | process.exit(1); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | // Run cleanup |
| 99 | cleanup().catch(error => { |
no test coverage detected