Skip to content

feat(PINE-29): E2E index/collection management tests - #27

Merged
stepandel merged 4 commits into
masterfrom
feat/pine-29-index-collection-tests
Feb 4, 2026
Merged

feat(PINE-29): E2E index/collection management tests#27
stepandel merged 4 commits into
masterfrom
feat/pine-29-index-collection-tests

Conversation

@stepandel

@stepandel stepandel commented Feb 3, 2026

Copy link
Copy Markdown
Owner

Summary

Comprehensive E2E tests for index/collection operations.

Pinecone Tests (7 Active)

  • ✅ Refresh indexes list
  • ✅ View index stats (vector count, dimensions)
  • ✅ Create new index with provider-specific settings
  • ✅ Delete index with confirmation flow
  • ✅ Handle index stats for empty index
  • ✅ Handle errors for non-existent index
  • ✅ List indexes with correct properties

Qdrant & Weaviate Tests (13 Skipped)

  • All marked with test.skip() and detailed TODO comments
  • Ready to activate when adapter system is integrated

Test Features

  • Uses existing E2E infrastructure from PINE-28
  • Tests via window.electronAPI IPC methods
  • Proper test isolation (unique profile/index names)
  • Automatic cleanup after tests
  • Real Pinecone API testing (requires PINECONE_API_KEY)

Closes PINE-29

Summary by CodeRabbit

  • Tests

    • Added comprehensive end-to-end test suites for connection flows and index/collection management across Pinecone, Qdrant, and Weaviate providers.
    • Implemented 21+ test cases covering profile creation, connectivity validation, and index operations with real provider integration support.
  • Documentation

    • Updated testing documentation with coverage details and execution commands for the new test suites.

stepandel and others added 3 commits February 3, 2026 11:44
Implemented comprehensive E2E tests for connection management:

Pinecone Tests:
- Connection modal display and form validation
- Required field validation
- Error handling for invalid API keys
- Successful connection with valid credentials
- Collections/indexes display after connection
- Disconnect functionality
- Reconnection after disconnect
- Profile saving and loading
- Unreachable URL error handling

Qdrant/Weaviate Tests:
- Skeleton tests with test.skip() and TODO comments
- Will be enabled when adapter system is integrated

Test Features:
- Uses Docker test containers from docker-compose.test.yml
- Leverages existing e2e/electron.setup.ts helpers
- Auto-skips tests requiring real API keys when not available
- Comprehensive error path testing

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive E2E tests for index/collection operations:
- List indexes/collections after connecting
- View index/collection stats (vector count, dimensions)
- Create new collection with provider-specific settings
- Delete collection (with confirmation)
- Refresh collection list

Implementation:
- 8 active Pinecone tests covering full index lifecycle
- 13 skipped Qdrant/Weaviate tests with TODO comments
- Uses existing e2e/ infrastructure from PINE-28
- Tests use window.electronAPI for IPC communication
- Proper test isolation with unique profile/index names

Test coverage:
✅ Pinecone: List, stats, create, delete, refresh, error handling
🔲 Qdrant: Pending adapter integration
🔲 Weaviate: Pending adapter integration

References: PINE-29
Related: IndexesPanel.tsx, IndexConfigView.tsx

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@claude

claude Bot commented Feb 3, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@coderabbitai

coderabbitai Bot commented Feb 4, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This pull request introduces comprehensive end-to-end testing infrastructure for an Electron app managing vector database connections. Two major Playwright test suites (connection-flow and index-collection-management) were added, alongside documentation detailing test coverage, with Pinecone fully implemented and Qdrant/Weaviate scaffolded.

Changes

Cohort / File(s) Summary
E2E Test Suites
e2e/connection-flow.spec.ts, e2e/index-collection-management.spec.ts
Comprehensive Playwright test suites covering Pinecone connection flows (setup, validation, profile management, connect/disconnect), index management (list, create, delete, stats verification), and scaffolded tests for Qdrant and Weaviate. Tests use IPC interactions with Electron app backend and include environment-gated execution for real API credentials.
E2E Documentation
PINE-29-SUMMARY.md
Documentation outlining new test suite structure, test case counts per provider, test execution commands, infrastructure details, and future work items for Qdrant/Weaviate integration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #25: Directly related as both modify the same Playwright E2E testing infrastructure, including test files, electron setup helpers, E2E documentation, and related test configuration.

Poem

🐰 Hop, hop, hop through the test suite with glee,
Pinecone connected, Qdrant waits to be,
E2E flows dance in patterns so bright,
IPC whispers secrets through the digital night,
From connection to index, all checked and just right! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: adding E2E tests for index/collection management with the PINE-29 ticket reference.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/pine-29-index-collection-tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@e2e/index-collection-management.spec.ts`:
- Around line 185-198: Replace the fixed 5s sleep used via page.waitForTimeout
with a polling loop that repeatedly calls the Pinecone API (use the same call
site: page.evaluate invoking (window as any).electronAPI.pinecone.listIndexes or
describeIndex with testProfileId) and checks the created index's status.ready
flag for the index matching testIndexName; poll at ~1s intervals up to a
reasonable timeout (e.g. 60s) and only proceed to the expect assertions once
status.ready is true (fail the test if timeout is reached).
🧹 Nitpick comments (3)
e2e/connection-flow.spec.ts (2)

92-103: Consider using test.skip annotation for conditional tests.

The current pattern of checking hasRealApiKey inside each test and calling test.skip() works but is verbose and repeated across multiple tests. Consider using Playwright's conditional skip annotation or a custom fixture.

♻️ Alternative approach using test.skip condition
// Option 1: Use test.skip with a condition at the test level
const hasRealApiKey = !!process.env.PINECONE_API_KEY &&
                      process.env.PINECONE_API_KEY !== 'dummy-key-for-local-testing'

test.describe('Pinecone Connection Flow', () => {
  test('should successfully connect with valid credentials', async () => {
    test.skip(!hasRealApiKey, 'Requires real PINECONE_API_KEY')
    // ... test body
  })
})
// Option 2: Use test.describe.configure to skip entire describe block
test.describe('Pinecone Connection Flow - Real API', () => {
  test.skip(!hasRealApiKey)
  // All tests in this block will be skipped if no API key
})

121-122: Consider replacing hardcoded timeouts with condition-based waits.

Hardcoded waitForTimeout calls can lead to flaky tests. Where possible, poll for a condition that indicates readiness.

♻️ Example: Poll until connection is ready
// Instead of:
await page.waitForTimeout(2000)

// Use a polling approach:
await expect(async () => {
  const indexes = await page.evaluate(async (id) => {
    return await (window as any).electronAPI.pinecone.listIndexes(id)
  }, profileId)
  expect(Array.isArray(indexes)).toBe(true)
}).toPass({ timeout: 10000 })
e2e/index-collection-management.spec.ts (1)

25-26: Add cleanup for test-created index to prevent resource leaks.

The testIndexName is created in one test and deleted in another. If the delete test is skipped (e.g., due to test filtering) or fails, the index may remain in the Pinecone account. Consider adding an afterAll hook to clean up any created test indexes.

♻️ Add afterAll cleanup hook
   test.describe('Pinecone Index Management', () => {
     let testProfileId: string
     let testIndexName: string

     test.beforeAll(async () => {
       // ... existing setup
     })

+    test.afterAll(async () => {
+      const { page } = electronContext
+      
+      // Cleanup any test indexes that may have been created
+      if (testIndexName && testProfileId) {
+        try {
+          await page.evaluate(async ({ id, name }) => {
+            try {
+              await (window as any).electronAPI.pinecone.deleteIndex(id, name)
+            } catch {
+              // Index may already be deleted or not exist
+            }
+          }, { id: testProfileId, name: testIndexName })
+        } catch {
+          // Ignore cleanup errors
+        }
+      }
+    })

Also applies to: 155-235

Comment on lines +185 to +198
// 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)

const createdIndex = indexes.find((idx: any) => idx.name === testIndexName)
expect(createdIndex).toBeDefined()
expect(createdIndex?.dimension).toBe(384)
expect(createdIndex?.metric).toBe('cosine')
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Index creation timeout may be insufficient.

Pinecone serverless indexes can take 30-60+ seconds to become ready. The 5-second wait at line 187 may not be sufficient, leading to flaky tests. Consider polling for the index's status.ready property.

🔧 Suggested approach: Poll for index readiness
-      // 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)
+      await expect(async () => {
+        const indexes = await page.evaluate(async (id) => {
+          return await (window as any).electronAPI.pinecone.listIndexes(id)
+        }, testProfileId)
+        const createdIndex = indexes.find((idx: any) => idx.name === testIndexName)
+        expect(createdIndex).toBeDefined()
+        expect(createdIndex?.status?.ready).toBe(true)
+      }).toPass({ timeout: 90000, intervals: [5000] })
+
+      const indexes = await page.evaluate(async (id) => {
+        return await (window as any).electronAPI.pinecone.listIndexes(id)
+      }, testProfileId)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// 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)
const createdIndex = indexes.find((idx: any) => idx.name === testIndexName)
expect(createdIndex).toBeDefined()
expect(createdIndex?.dimension).toBe(384)
expect(createdIndex?.metric).toBe('cosine')
})
// Poll for index to become ready (can take 30-60+ seconds)
await expect(async () => {
const indexes = await page.evaluate(async (id) => {
return await (window as any).electronAPI.pinecone.listIndexes(id)
}, testProfileId)
const createdIndex = indexes.find((idx: any) => idx.name === testIndexName)
expect(createdIndex).toBeDefined()
expect(createdIndex?.status?.ready).toBe(true)
}).toPass({ timeout: 90000, intervals: [5000] })
const indexes = await page.evaluate(async (id) => {
return await (window as any).electronAPI.pinecone.listIndexes(id)
}, testProfileId)
const createdIndex = indexes.find((idx: any) => idx.name === testIndexName)
expect(createdIndex).toBeDefined()
expect(createdIndex?.dimension).toBe(384)
expect(createdIndex?.metric).toBe('cosine')
🤖 Prompt for AI Agents
In `@e2e/index-collection-management.spec.ts` around lines 185 - 198, Replace the
fixed 5s sleep used via page.waitForTimeout with a polling loop that repeatedly
calls the Pinecone API (use the same call site: page.evaluate invoking (window
as any).electronAPI.pinecone.listIndexes or describeIndex with testProfileId)
and checks the created index's status.ready flag for the index matching
testIndexName; poll at ~1s intervals up to a reasonable timeout (e.g. 60s) and
only proceed to the expect assertions once status.ready is true (fail the test
if timeout is reached).

@stepandel
stepandel merged commit b58e4a6 into master Feb 4, 2026
4 checks passed
@stepandel
stepandel deleted the feat/pine-29-index-collection-tests branch February 4, 2026 22:14
stepandel added a commit that referenced this pull request Feb 4, 2026
- 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
stepandel added a commit that referenced this pull request Feb 4, 2026
- 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

Co-authored-by: Stepan Arsentjev <stepandel@users.noreply.github.com>
stepandel added a commit that referenced this pull request Feb 4, 2026
* 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

* fix: address remaining E2E review issues

- Add teardown in namespace-operations.spec.ts to delete test-created namespaces/vectors
- Change vector-browsing.spec.ts to create dedicated test namespace with known metadata instead of reusing existing namespace
- Fix forEach callbacks in vector-browsing.spec.ts to use explicit block bodies instead of implicit returns
- Use test.describe.serial for stateful index create/delete tests in index-collection-management.spec.ts
- Replace fixed sleeps with polling in index-collection-management.spec.ts

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Stepan Arsentjev <stepandel@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant