From 2477db4a92ac1ecf3849b3d157d60a184b59079b Mon Sep 17 00:00:00 2001 From: Stepan Arsentjev Date: Wed, 4 Feb 2026 14:25:37 -0800 Subject: [PATCH] fix: address E2E test review issues - Fix index creation timeout: use polling (90s) instead of fixed 5s wait - Add gitleaks:allow comments to prevent false positives on test API keys - Index creation now properly waits for status.ready=true Addresses review comments from PRs #27, #29 --- e2e/connection-flow.spec.ts | 2 +- e2e/electron.setup.ts | 2 +- e2e/index-collection-management.spec.ts | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/e2e/connection-flow.spec.ts b/e2e/connection-flow.spec.ts index 1208b7c..fb39199 100644 --- a/e2e/connection-flow.spec.ts +++ b/e2e/connection-flow.spec.ts @@ -75,7 +75,7 @@ test.describe('E2E-002: Connection Flow Tests', () => { id, name: 'Invalid Key Test', provider: 'pinecone' as const, - apiKey: 'invalid-api-key-12345', + apiKey: 'invalid-api-key-for-tests', // gitleaks:allow } try { diff --git a/e2e/electron.setup.ts b/e2e/electron.setup.ts index 819c5e4..8ddcfa0 100644 --- a/e2e/electron.setup.ts +++ b/e2e/electron.setup.ts @@ -181,7 +181,7 @@ export async function createPineconeTestProfile( ): Promise { const profileId = `test-pinecone-${Date.now()}` const profileName = name || `Test Pinecone ${Date.now()}` - const pineconeKey = apiKey || process.env.PINECONE_API_KEY || 'dummy-key-for-local-testing' + const pineconeKey = apiKey || process.env.PINECONE_API_KEY || 'dummy-key-for-local-testing' // gitleaks:allow await page.evaluate( async ({ id, name, apiKey }) => { diff --git a/e2e/index-collection-management.spec.ts b/e2e/index-collection-management.spec.ts index 69d8990..7c89034 100644 --- a/e2e/index-collection-management.spec.ts +++ b/e2e/index-collection-management.spec.ts @@ -182,16 +182,17 @@ test.describe('E2E-003: Index/Collection Management Tests', () => { await (window as any).electronAPI.pinecone.createIndex(id, params) }, { id: testProfileId, params: createParams }) - // Wait for index to be created and become ready - // Pinecone indexes can take a while to initialize - await page.waitForTimeout(5000) - - // Verify index was created by listing indexes - const indexes = await page.evaluate(async (id) => { - return await (window as any).electronAPI.pinecone.listIndexes(id) - }, testProfileId) + // Poll for index to become ready (can take 30-60+ seconds for serverless) + let createdIndex: any + await expect(async () => { + const indexes = await page.evaluate(async (id) => { + return await (window as any).electronAPI.pinecone.listIndexes(id) + }, testProfileId) + createdIndex = indexes.find((idx: any) => idx.name === testIndexName) + expect(createdIndex).toBeDefined() + expect(createdIndex?.status?.ready).toBe(true) + }).toPass({ timeout: 90000, intervals: [5000] }) - const createdIndex = indexes.find((idx: any) => idx.name === testIndexName) expect(createdIndex).toBeDefined() expect(createdIndex?.dimension).toBe(384) expect(createdIndex?.metric).toBe('cosine')