44 lines
1.9 KiB
TypeScript
44 lines
1.9 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
test('catalog search and filters update visible card count', async ({ page }) => {
|
|
await page.goto('/');
|
|
|
|
await expect(page).toHaveTitle(/ROM Hack Archive/);
|
|
await expect(page.getByRole('heading', { name: 'ROM Hack Archive' })).toBeVisible();
|
|
const catalogCards = page.locator('[data-card-grid] [data-card]:visible');
|
|
await expect(catalogCards).toHaveCount(368);
|
|
|
|
await page.getByPlaceholder('Search hacks').fill('Radical Red');
|
|
await expect(catalogCards).toHaveCount(4);
|
|
await expect(page.getByRole('region', { name: 'Hack catalog' }).getByRole('link', { name: /Open Pokémon Radical Red/ })).toBeVisible();
|
|
|
|
await page.getByPlaceholder('Search hacks').fill('');
|
|
await page.getByLabel('GBA').check();
|
|
await expect(catalogCards).toHaveCount(188);
|
|
|
|
await page.getByLabel('Difficulty').check();
|
|
await expect(catalogCards.first()).toBeVisible();
|
|
await expect(page.locator('[data-result-count]')).toContainText('shown');
|
|
});
|
|
|
|
test('detail page renders metadata and private file links', async ({ page }) => {
|
|
await page.goto('/hack/radical-red/');
|
|
|
|
await expect(page.getByRole('heading', { name: 'Pokémon Radical Red' })).toBeVisible();
|
|
await expect(page.getByText('Platform').first()).toBeVisible();
|
|
await expect(page.getByRole('heading', { name: 'Files' })).toBeVisible();
|
|
await expect(page.getByRole('link', { name: 'ROM file' })).toHaveAttribute(
|
|
'href',
|
|
/https:\/\/romhacks-files\.ginnoir\.com\/_roms\/gba\/Hacks\//,
|
|
);
|
|
await expect(page.locator('body')).not.toContainText('undefined');
|
|
});
|
|
|
|
test('browse pages render static grouped lists', async ({ page }) => {
|
|
await page.goto('/browse/type/difficulty/');
|
|
|
|
await expect(page.getByRole('heading', { name: 'Difficulty' })).toBeVisible();
|
|
await expect(page.locator('[data-card]:visible')).toHaveCount(105);
|
|
await expect(page.getByRole('link', { name: /Open Pokémon Radical Red/ })).toBeVisible();
|
|
});
|