From e3c379d069ffa9661561d25cdbf2f5894a2f8ee8 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Sat, 14 Feb 2026 08:58:38 -0800 Subject: Refactor: project structure, implement dependency injection, and align v2 UI with v1 --- frontend/tests/e2e.spec.ts | 114 ++++++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 52 deletions(-) (limited to 'frontend/tests') diff --git a/frontend/tests/e2e.spec.ts b/frontend/tests/e2e.spec.ts index ca4b4ad..3f4898a 100644 --- a/frontend/tests/e2e.spec.ts +++ b/frontend/tests/e2e.spec.ts @@ -1,56 +1,66 @@ import { test, expect } from '@playwright/test'; test.describe('Neko Reader E2E', () => { - test('should allow login, viewing feeds, and logout', async ({ page }) => { - // 1. Go to Login - await page.goto('/v2/login'); - await expect(page).toHaveTitle(/Neko/); - - // 2. Login - // 2. Login - // Password is empty by default in test env - await page.click('button[type="submit"]'); - - // Check for error message if login failed (optional, for debugging) - // await expect(page.locator('.error-message')).toBeVisible({ timeout: 2000 }).catch(() => {}); - - // 3. Verify Dashboard - // Keep checking for /v2/ or /v2 - await expect(page).toHaveURL(/.*\/v2\/?$/); - await expect(page.locator('h1.logo')).toContainText('🐱'); - await expect(page.getByText('Logout')).toBeVisible(); - - // 4. Verify Feed List - await page.click('text=Settings'); - await expect(page).toHaveURL(/.*\/v2\/settings/); - - // Add a feed - const feedUrl = 'http://rss.cnn.com/rss/cnn_topstories.rss'; - await page.fill('input[type="url"]', feedUrl); - await page.click('text=Add Feed'); - - // Wait for it to appear - await expect(page.getByText(feedUrl)).toBeVisible(); - - // 5. Navigate to Feed - await page.goto('/v2/'); - // Default view is now the stream. - // It should NOT show "Select a feed" anymore. - // Wait for items or "No items found" or loading state - await expect(page.locator('.feed-items').or(page.locator('.feed-items-loading')).or(page.getByText('No items found'))).toBeVisible({ timeout: 10000 }); - - // 6. Verify Tag View - // Go to a tag URL (simulated, since we can't easily add tags via UI in this test yet without setup) - // But we can check if the route loads without crashing - await page.goto('/v2/tag/Tech'); - // The TagView component might show "Category: Tech" or "Tag: Tech" or just items. - // In the current FeedItems.tsx it doesn't show a header, but it should load. - // The TagView component might show "Category: Tech" or "Tag: Tech" or just items. - // In the current FeedItems.tsx it doesn't show a header, but it should load. - await expect(page.locator('.feed-items').or(page.locator('.feed-items-loading')).or(page.getByText('No items found'))).toBeVisible({ timeout: 10000 }); - - // 7. Logout - await page.click('text=Logout'); - await expect(page).toHaveURL(/.*\/v2\/login/); - }); + test('should allow login, viewing feeds, and logout', async ({ page }) => { + // 1. Go to Login + await page.goto('/v2/login'); + await expect(page).toHaveTitle(/Neko/); + + // 2. Login + // 2. Login + // Password is empty by default in test env + await page.click('button[type="submit"]'); + + // Check for error message if login failed (optional, for debugging) + // await expect(page.locator('.error-message')).toBeVisible({ timeout: 2000 }).catch(() => {}); + + // 3. Verify Dashboard + // Keep checking for /v2/ or /v2 + await expect(page).toHaveURL(/.*\/v2\/?$/); + await expect(page.locator('h1.logo')).toContainText('🐱'); + await expect(page.getByText('Logout')).toBeVisible(); + + // 4. Verify Feed List + await page.click('text=Settings'); + await expect(page).toHaveURL(/.*\/v2\/settings/); + + // Add a feed + const feedUrl = 'http://rss.cnn.com/rss/cnn_topstories.rss'; + await page.fill('input[type="url"]', feedUrl); + await page.click('text=Add Feed'); + + // Wait for it to appear + await expect(page.getByText(feedUrl)).toBeVisible(); + + // 5. Navigate to Feed + await page.goto('/v2/'); + // Default view is now the stream. + // It should NOT show "Select a feed" anymore. + // Wait for items or "No items found" or loading state + await expect( + page + .locator('.feed-items') + .or(page.locator('.feed-items-loading')) + .or(page.getByText('No items found')) + ).toBeVisible({ timeout: 10000 }); + + // 6. Verify Tag View + // Go to a tag URL (simulated, since we can't easily add tags via UI in this test yet without setup) + // But we can check if the route loads without crashing + await page.goto('/v2/tag/Tech'); + // The TagView component might show "Category: Tech" or "Tag: Tech" or just items. + // In the current FeedItems.tsx it doesn't show a header, but it should load. + // The TagView component might show "Category: Tech" or "Tag: Tech" or just items. + // In the current FeedItems.tsx it doesn't show a header, but it should load. + await expect( + page + .locator('.feed-items') + .or(page.locator('.feed-items-loading')) + .or(page.getByText('No items found')) + ).toBeVisible({ timeout: 10000 }); + + // 7. Logout + await page.click('text=Logout'); + await expect(page).toHaveURL(/.*\/v2\/login/); + }); }); -- cgit v1.2.3