blob: 1fa10ceacfd391adc7e48a67cd1fea36e366d911 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
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();
const waitForLoader = async () => {
await page.waitForFunction(() => {
const loading = document.querySelector('.feed-items-loading') ||
document.body.innerText.includes('Loading...');
return !loading;
}, { timeout: 15000 });
};
// 5. Navigate to Feed
console.log('Step 5: Navigate to Home');
await page.goto('/v2/');
await expect(page).toHaveURL(/.*\/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 waitForLoader();
await expect(
page
.locator('.feed-items')
.or(page.getByText('No items found'))
.or(page.locator('.feed-items-error'))
).toBeVisible({ timeout: 10000 });
// 6. Verify Tag View
// 6. Logout
console.log('Step 6: Logout');
await page.click('text=Logout');
await expect(page).toHaveURL(/.*\/v2\/login/);
});
});
|