feat(PINE-27): Setup Playwright E2E testing infrastructure - #25
Conversation
Implements VEX-001 through VEX-004 from multi-db analysis: - Unified VectorDatabase interface for all three providers - Base adapter class with common functionality - Factory for creating database adapters by provider - Pinecone adapter (refactored from existing service) - Qdrant adapter (new implementation) - Weaviate adapter (new implementation) Dependencies added: - @qdrant/js-client-rest - weaviate-client All adapters implement: - Connection management - Collection/index operations (list, create, delete, stats) - Vector operations (list, fetch, query, upsert, update, delete) - Provider-specific filter translation
- Add Playwright configuration for Electron testing - Create E2E test examples with helper utilities - Add Docker Compose setup for Qdrant/Weaviate test containers - Add GitHub Actions workflow for E2E tests - Add E2E_TESTING.md documentation - Skip Qdrant/Weaviate tests until adapter system is integrated Closes PINE-27
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This reverts commit ce9ccbf.
The encryption key is derived from app path, which differs between normal and test runs. This caused JSON parsing errors when trying to decrypt store data with a mismatched key. Clearing the encrypted store files before launching ensures a fresh encryption key is generated that matches the test environment.
|
@claude can you fix the failing e2e test runs |
|
Claude finished @stepandel's task in 1m 11s —— View job E2E test failures fixed ✓
Root CauseThe workflow was failing at the "Setup pnpm cache" step with error: The issue was in Fix AppliedAdded The fix has been committed and pushed to the branch. The E2E workflow should now pass. |
Fixes CI failure caused by missing packages field in pnpm-workspace.yaml. When pnpm detects this file, it treats the project as a workspace which requires a packages array to be defined. Co-authored-by: Stepan Arsentjev <stepandel@users.noreply.github.com>
|
@claude fix e2e failing test runs |
|
Claude finished @stepandel's task in 1m 39s —— View job E2E test failures fixed ✓
Root CauseThe E2E tests were failing due to two issues:
Fixes Appliede2e/electron.setup.ts:68
e2e/example.spec.ts:15
Changes PushedThe fixes have been committed and pushed to |
📝 WalkthroughWalkthroughAdds Playwright-based E2E testing for the Electron Pinecone Explorer: Playwright config and scripts, test TS includes, .gitignore updates, Electron test helpers (launch, profile management, cleanup), an example spec, and a comprehensive E2E guide (E2E_TESTING.md). Changes
Sequence DiagramsequenceDiagram
participant Test as Playwright Test
participant Launcher as Test Harness
participant Electron as Electron App
participant IPC as window.electronAPI
participant FS as File System
participant Pinecone as Pinecone API
Test->>Launcher: launchElectronApp()
Launcher->>FS: clearEncryptedStores()
FS-->>Launcher: cleared
Launcher->>Electron: spawn with E2E_USER_DATA_DIR, env=test
Electron-->>Launcher: ready (page)
Launcher-->>Test: return (app, page)
Test->>IPC: createPineconeTestProfile(name, apiKey)
IPC->>Electron: create profile
Electron->>Pinecone: initialize client (apiKey)
Pinecone-->>Electron: auth/ready
Electron->>FS: persist profile (test-*)
FS-->>Electron: saved
Electron-->>Test: profileId
Test->>IPC: connectToProfile(profileId)
IPC->>Electron: activate profile
Electron-->>Test: connected
Test->>IPC: cleanupTestProfiles()
IPC->>Electron: delete test-* profiles
Electron->>FS: remove configs
FS-->>Electron: removed
Electron-->>Test: cleanup complete
Test->>Electron: closeElectronApp()
Electron->>Electron: graceful shutdown
Electron-->>Test: closed
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
a643487 to
5bf7944
Compare
Electron cannot run in the GitHub Actions sandbox environment.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@E2E_TESTING.md`:
- Around line 57-64: The fenced code block showing the project tree (starting
with "pinecone-explorer/") in E2E_TESTING.md is missing a language tag which
triggers markdownlint MD040; update that fenced block to include a language
identifier (e.g., add "text" after the opening ``` fence) so the block begins
with ```text and preserves the same tree contents and comments.
In `@e2e/electron.setup.ts`:
- Around line 68-72: The CI failure is due to a missing X server—adding
'--no-sandbox' in the Electron launch args (see electronPath and args where
'--no-sandbox' is pushed) doesn't provide a display; update the CI workflow to
run tests under Xvfb by either wrapping the e2e test command with xvfb-run (e.g.
xvfb-run -a <your test command>) or add a step to start Xvfb before running
tests so Electron has a virtual DISPLAY available.
- Around line 15-66: clearEncryptedStores() currently deletes files from the
real userData path (getAppDataPath()), which will wipe developer data during
local E2E runs; update launchElectronApp() to set a test-only userData directory
via an E2E_USER_DATA_DIR env var and stop using getAppDataPath() for deletions,
and modify clearEncryptedStores() to operate only inside
process.env.E2E_USER_DATA_DIR when present. Also update the Electron main
process (electron/main.ts) to call app.setPath('userData',
process.env.E2E_USER_DATA_DIR) early (before any store initialization) when
NODE_ENV === 'test' so the renderer/main stores use the test directory. Ensure
references: clearEncryptedStores(), getAppDataPath(), launchElectronApp(), and
the app.setPath('userData', ...) change in main.ts.
🧹 Nitpick comments (1)
e2e/electron.setup.ts (1)
128-137: Avoid fixed sleeps after connect to reduce flakiness.
waitForTimeout(1000)can be too short on slower CI. Prefer a deterministic signal (e.g.,page.waitForFunction(...)or a UI-ready selector) if available.
- Update getAppDataPath() to check for E2E_USER_DATA_DIR env var
- Modify clearEncryptedStores() to accept path as parameter
- Set test-specific userData directory in launchElectronApp()
- Add app.setPath('userData') in main.ts to redirect in test mode
This prevents E2E tests from wiping real user data during local development.
Co-authored-by: Stepan Arsentjev <stepandel@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@e2e/electron.setup.ts`:
- Around line 128-137: In connectToProfile remove the fixed 1s sleep and rely on
the IPC call to resolve: delete the await page.waitForTimeout(1000) line in the
connectToProfile function so the function returns once page.evaluate (which
awaits electronAPI.pinecone.connect) completes; keep the rest of the evaluate
block and ensure no other artificial waits are added.
The IPC call already waits for connection to complete, making the fixed timeout unnecessary and potentially flaky on slower machines. Co-authored-by: Stepan Arsentjev <stepandel@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@e2e/electron.setup.ts`:
- Around line 58-101: The code must guard against an empty E2E_USER_DATA_DIR
before using it as testUserDataDir and before calling clearEncryptedStores: in
launchElectronApp check that process.env.E2E_USER_DATA_DIR is a non-empty string
(e.g. trim() !== '') and that the resolved testUserDataDir is not '.' or
process.cwd(); if the env var is empty or resolves to the current working
directory, fall back to path.join(os.tmpdir(), 'pinecone-explorer-e2e') and only
then call clearEncryptedStores(testUserDataDir). Reference: launchElectronApp,
testUserDataDir, and clearEncryptedStores.
Prevent empty E2E_USER_DATA_DIR env var from being treated as valid by the ?? operator, which would cause clearEncryptedStores to delete files in the current working directory. Co-authored-by: Stepan Arsentjev <stepandel@users.noreply.github.com>
Summary
Sets up Playwright E2E testing infrastructure for the Electron app.
Changes
Test Results
Notes
test.skipuntil the multi-database adapter system is integrated into the main IPC handlersCloses PINE-27
Summary by CodeRabbit
Tests
Documentation
Chores