|
| 1 | +import { test, expect } from '@playwright/test' |
| 2 | + |
| 3 | +test.describe('Responsive design', () => { |
| 4 | + test('no horizontal scroll on ideas page', async ({ page }) => { |
| 5 | + await page.goto('/ideas') |
| 6 | + await page.waitForLoadState('networkidle') |
| 7 | + |
| 8 | + // Check if horizontal scrolling is actually possible (accounts for VitePress sidebar hidden off-screen) |
| 9 | + const hasHorizontalScroll = await page.evaluate( |
| 10 | + () => |
| 11 | + document.documentElement.scrollWidth > |
| 12 | + document.documentElement.clientWidth, |
| 13 | + ) |
| 14 | + expect(hasHorizontalScroll).toBe(false) |
| 15 | + }) |
| 16 | + |
| 17 | + test('no horizontal scroll on resources page', async ({ page }) => { |
| 18 | + await page.goto('/resources') |
| 19 | + await page.waitForLoadState('networkidle') |
| 20 | + |
| 21 | + const hasHorizontalScroll = await page.evaluate( |
| 22 | + () => |
| 23 | + document.documentElement.scrollWidth > |
| 24 | + document.documentElement.clientWidth, |
| 25 | + ) |
| 26 | + expect(hasHorizontalScroll).toBe(false) |
| 27 | + }) |
| 28 | + |
| 29 | + test('all main pages render without errors', async ({ page }) => { |
| 30 | + const pages = ['/', '/setup', '/agenda', '/ideas', '/resources'] |
| 31 | + for (const pagePath of pages) { |
| 32 | + const errors: string[] = [] |
| 33 | + page.on('pageerror', (err) => errors.push(err.message)) |
| 34 | + |
| 35 | + await page.goto(pagePath) |
| 36 | + await page.waitForLoadState('networkidle') |
| 37 | + |
| 38 | + expect.soft(errors, `${pagePath} should have no JS errors`).toEqual([]) |
| 39 | + } |
| 40 | + }) |
| 41 | +}) |
| 42 | + |
| 43 | +test.describe('Presentation', () => { |
| 44 | + test('renders Marp slides at 1024x768', async ({ page }) => { |
| 45 | + await page.goto('/presentation.html', { waitUntil: 'networkidle' }) |
| 46 | + |
| 47 | + // Verify Marp slides rendered |
| 48 | + const slides = page.locator('svg[data-marpit-svg]') |
| 49 | + await expect(slides.first()).toBeVisible({ timeout: 10000 }) |
| 50 | + |
| 51 | + // Verify multiple slides exist |
| 52 | + const slideCount = await slides.count() |
| 53 | + expect(slideCount).toBeGreaterThan(1) |
| 54 | + }) |
| 55 | +}) |
0 commit comments