aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/tests/crawl.spec.ts
blob: 175a764ef3bb7852dbe2e7023f4ca39850f4acf6 (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
import { test, expect } from '@playwright/test';

test.describe('Crawl Integration', () => {
    test('should add a feed and see items after crawl', async ({ page }) => {
        const mockFeedUrl = 'http://localhost:9090/mock_feed.xml';

        // 1. Login and go to Settings
        await page.goto('/v2/settings');

        // 2. Add the mock feed
        await page.fill('input[type="url"]', mockFeedUrl);
        await page.click('text=Add Feed');

        // Wait for feed to be added
        await expect(page.getByText(mockFeedUrl)).toBeVisible({ timeout: 5000 });

        // 3. Trigger Crawl
        const crawlButton = page.getByRole('button', { name: /crawl/i });
        await expect(crawlButton).toBeVisible();

        // Handle the alert
        page.on('dialog', dialog => dialog.accept());
        await crawlButton.click();

        // 4. Go to Home and check for items
        await page.goto('/v2/');

        // The mock feed has "Mock Item 1" and "Mock Item 2"
        await expect(page.getByText('Mock Item 1')).toBeVisible({ timeout: 10000 });
        await expect(page.getByText('Mock Item 2')).toBeVisible({ timeout: 10000 });
    });
});