|
| 1 | +import { test, expect } from '@playwright/test'; |
| 2 | + |
| 3 | +test.describe('Search flow', () => { |
| 4 | + test('search TP53, click first result, verify detail page', async ({ page }) => { |
| 5 | + await page.goto('/content/query?q=TP53'); |
| 6 | + await expect(page.locator('.result-count')).toBeVisible({ timeout: 15000 }); |
| 7 | + await expect(page.locator('.result-count')).toContainText('results found'); |
| 8 | + |
| 9 | + const firstResult = page.locator('.entry-name').first(); |
| 10 | + await expect(firstResult).toBeVisible(); |
| 11 | + await firstResult.click(); |
| 12 | + |
| 13 | + await expect(page).toHaveURL(/\/content\/detail\//); |
| 14 | + }); |
| 15 | + |
| 16 | + test('search nonexistent term, verify no-results section', async ({ page }) => { |
| 17 | + await page.goto('/content/query?q=xyzzy_no_match_99999'); |
| 18 | + await expect(page.locator('.no-results')).toBeVisible({ timeout: 15000 }); |
| 19 | + await expect(page.locator('.no-results h2')).toContainText('No results found'); |
| 20 | + }); |
| 21 | + |
| 22 | + test('search apoptosis, click a facet, verify filter chip appears', async ({ page }) => { |
| 23 | + await page.goto('/content/query?q=apoptosis'); |
| 24 | + await expect(page.locator('.result-count')).toBeVisible({ timeout: 15000 }); |
| 25 | + |
| 26 | + const firstFacet = page.locator('.facet-option').first(); |
| 27 | + await expect(firstFacet).toBeVisible(); |
| 28 | + await firstFacet.click(); |
| 29 | + |
| 30 | + await expect(page.locator('.filter-chip')).toBeVisible({ timeout: 10000 }); |
| 31 | + }); |
| 32 | +}); |
0 commit comments