Files
Momento/memento-note/tests/search-quality.spec.ts
Sepehr Ramezani aa6a214f37 feat: rename keep-notes to memento-note, migrate to PostgreSQL, fix MCP bugs
- Rename directory keep-notes -> memento-note with all code references
- Prisma: SQLite -> PostgreSQL (both app and MCP server schemas)
- Sync MCP schema with main app (add missing fields, relations, indexes)
- Delete 17 SQLite migrations (clean slate for PostgreSQL)
- Remove SQLite dependencies (@libsql/client, better-sqlite3, etc.)
- Fix MCP server: hardcoded Windows DB paths -> DATABASE_URL env var
- Fix MCP server: .dockerignore excluded index-sse.js (SSE mode broken)
- MCP Dockerfile: node:20 -> node:22
- Docker Compose: add postgres service, remove SQLite volume
- Generate favicon.ico, icon-192.png, icon-512.png, apple-icon.png
- Update layout.tsx icons and manifest.json for PNG icons
- Update all .env files for PostgreSQL
- Rewrite README.md with updated sections
- Remove mcp-server/node_modules and prisma/client-generated from git tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-20 20:58:04 +02:00

64 lines
2.6 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Search Quality Tests', () => {
test.beforeEach(async ({ page }) => {
// 1. Go to Home
await page.goto('/');
// Handle Login if redirected (Mock behavior or real login)
if (page.url().includes('login')) {
// Assuming a simple dev login or we need to bypass.
// For this environment, let's try to just continue or fail explicitly if stuck.
console.log('Redirected to login. Please ensure you are logged in for tests.');
}
});
test('should find notes by semantic concept', async ({ page }) => {
// Clean up existing notes to avoid noise? (Optional, better to just create unique ones)
const timestamp = Date.now();
const techTitle = `React Tech ${timestamp}`;
const foodTitle = `Italian Food ${timestamp}`;
// 2. Create Tech Note
await page.getByPlaceholder('Take a note...').click();
await page.getByPlaceholder('Title').fill(techTitle);
await page.getByPlaceholder('Take a note...').fill('Hooks, useEffect, State management, Components logic.');
await page.getByRole('button', { name: 'Close' }).click();
await expect(page.getByText(techTitle)).toBeVisible();
// 3. Create Food Note
await page.getByPlaceholder('Take a note...').click();
await page.getByPlaceholder('Title').fill(foodTitle);
await page.getByPlaceholder('Take a note...').fill('Tomato sauce, Basil, Parmesan cheese, boiling water.');
await page.getByRole('button', { name: 'Close' }).click();
await expect(page.getByText(foodTitle)).toBeVisible();
// Wait a bit for potential async indexing (even if server action is awaited, good practice)
await page.waitForTimeout(2000);
// 4. Search for "Coding" (Semantic match for React)
const searchInput = page.getByPlaceholder('Search');
await searchInput.fill('Coding');
await searchInput.press('Enter');
// Allow time for search results
await page.waitForTimeout(1000);
// Assertions
// Tech note should be visible
await expect(page.getByText(techTitle)).toBeVisible();
// Food note should NOT be visible (or at least ranked lower/hidden if filtering is strict)
await expect(page.getByText(foodTitle)).toBeHidden();
// 5. Search for "Cooking" (Semantic match for Food)
await searchInput.fill('');
await searchInput.fill('Cooking dinner');
await searchInput.press('Enter');
await page.waitForTimeout(1000);
await expect(page.getByText(foodTitle)).toBeVisible();
await expect(page.getByText(techTitle)).toBeHidden();
});
});