diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86ccc12..8c85782 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: run: npm run workers & working-directory: ./apps/api - name: Run E2E tests - run: npx jest --openHandlesTimeout=60000 -- src/__tests__/e2e/index.test.ts + run: npx jest --openHandlesTimeout=60000 --watchAll=false -- src/__tests__/e2e/index.test.ts working-directory: ./apps/api diff --git a/apps/api/src/__tests__/e2e/index.test.ts b/apps/api/src/__tests__/e2e/index.test.ts index ce11207..3bc3e99 100644 --- a/apps/api/src/__tests__/e2e/index.test.ts +++ b/apps/api/src/__tests__/e2e/index.test.ts @@ -144,19 +144,20 @@ describe('E2E Tests for API Routes', () => { expect(response.body).toHaveProperty('status'); expect(response.body.status).toBe('active'); - setTimeout(async () => { - const response = await request(TEST_URL) + // wait for 30 seconds + await new Promise((r) => setTimeout(r, 30000)); + + const completedResponse = await request(TEST_URL) .get(`/v0/crawl/status/${crawlResponse.body.jobId}`) .set('Authorization', `Bearer ${process.env.TEST_API_KEY}`); - expect(response.statusCode).toBe(200); - expect(response.body).toHaveProperty('status'); - expect(response.body.status).toBe('completed'); - expect(response.body).toHaveProperty('data'); - expect(response.body.data).toHaveProperty('content'); - expect(response.body.data).toHaveProperty('markdown'); - expect(response.body.data).toHaveProperty('metadata'); - expect(response.body.data.content).toContain('🔥 FireCrawl'); - }, 30000); // 30 seconds + expect(completedResponse.statusCode).toBe(200); + expect(completedResponse.body).toHaveProperty('status'); + expect(completedResponse.body.status).toBe('completed'); + expect(completedResponse.body).toHaveProperty('data'); + expect(completedResponse.body.data).toHaveProperty('content'); + expect(completedResponse.body.data).toHaveProperty('markdown'); + expect(completedResponse.body.data).toHaveProperty('metadata'); + expect(completedResponse.body.data.content).toContain('🔥 FireCrawl'); }, 60000); // 60 seconds });