test: add E2E tests for vault picker local options

Playwright tests verify the vault menu shows all three add-vault
options (open local folder, create new vault, connect GitHub) with
correct testids and visual appearance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-02-23 14:48:31 +01:00
parent f5254264ad
commit 9226d0c66e

View File

@@ -0,0 +1,39 @@
import { test, expect } from '@playwright/test'
test.describe('Vault Picker Local Options', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:5240')
await page.waitForSelector('text=notes', { timeout: 10000 })
})
test('vault menu shows local folder options', async ({ page }) => {
// Screenshot before opening menu
await page.screenshot({ path: 'test-results/vault-picker-before.png', fullPage: true })
// Click the vault button in the status bar to open the menu
const vaultButton = page.locator('[title="Switch vault"]')
await expect(vaultButton).toBeVisible()
await vaultButton.click()
// Wait for menu to appear
await page.waitForTimeout(300)
// Verify all three options are visible
await expect(page.locator('text=Open local folder')).toBeVisible()
await expect(page.locator('text=Create new vault')).toBeVisible()
await expect(page.locator('text=Connect GitHub repo')).toBeVisible()
// Screenshot with menu open showing all options
await page.screenshot({ path: 'test-results/vault-picker-menu-open.png', fullPage: true })
})
test('vault menu options have correct test IDs', async ({ page }) => {
const vaultButton = page.locator('[title="Switch vault"]')
await vaultButton.click()
await page.waitForTimeout(200)
await expect(page.locator('[data-testid="vault-menu-open-local"]')).toBeVisible()
await expect(page.locator('[data-testid="vault-menu-create-new"]')).toBeVisible()
await expect(page.locator('[data-testid="vault-menu-connect-github"]')).toBeVisible()
})
})