AI Resource Pro / website · airesourcepro.com / e2e / public-pages.spec.ts
| 1 | import { test, expect } from '@playwright/test'; |
| 2 | |
| 3 | const PAGES = ['/', '/tutorials', '/videos', '/about', '/login', '/claude', '/chatgpt', '/computer-use', '/ai-video']; |
| 4 | |
| 5 | test.describe('Public pages', () => { |
| 6 | for (const path of PAGES) { |
| 7 | test(`${path} loads`, async ({ page }) => { |
| 8 | const response = await page.goto(path); |
| 9 | expect(response?.status()).toBe(200); |
| 10 | await expect(page.locator('h1').first()).toBeVisible(); |
| 11 | }); |
| 12 | } |
| 13 | |
| 14 | test('a tutorial page renders its article and outline', async ({ page }) => { |
| 15 | await page.goto('/claude/claude-code-best-practices'); |
| 16 | await expect(page.locator('h1')).toContainText('Claude Code'); |
| 17 | await expect(page.locator('article h2').first()).toBeVisible(); |
| 18 | }); |
| 19 | |
| 20 | test('unknown track returns 404', async ({ page }) => { |
| 21 | const response = await page.goto('/not-a-track'); |
| 22 | expect(response?.status()).toBe(404); |
| 23 | }); |
| 24 | }); |