Branchwell

Become a Pro / website · becomeapro.ai / e2e / public-pages.spec.ts

Raw 1.4 KB on f63bc385c0fa362af985bfb576a8b5aa2a3df60f
1import { test, expect } from '@playwright/test';
2
3const PAGES = ['/', '/trades', '/knowledge-work', '/english', '/math', '/teaching', '/knowledge-work/using-ai', '/research', '/privacy', '/login'];
4
5test.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('home is plain Become a Pro text', async ({ page }) => {
15 await page.goto('/');
16 await expect(page.locator('h1')).toHaveText('Become a Pro');
17 const html = await page.content();
18 expect(html).not.toMatch(/AI Resource|youtube|three\.js/i);
19 });
20
21 test('a lesson renders with its updated date', async ({ page }) => {
22 await page.goto('/knowledge-work/using-ai/claude-md-guide');
23 await expect(page.locator('h1')).toContainText('CLAUDE.md');
24 await expect(page.getByText(/Updated/)).toBeVisible();
25 });
26
27 test('old tutorial paths redirect to Using AI at work', async ({ page }) => {
28 await page.goto('/claude/claude-md-guide');
29 expect(new URL(page.url()).pathname).toBe('/knowledge-work/using-ai/claude-md-guide');
30 });
31
32 test('unknown area returns 404', async ({ page }) => {
33 const response = await page.goto('/not-an-area');
34 expect(response?.status()).toBe(404);
35 });
36});