Files
Toiminnanohjaus/tests/Browser/AccessibilityTest.php
T
petriandClaude Opus 5.5 d403a86443 Add WCAG 2.2 AA accessibility baseline and browser tests
- Layout: skip link to the main content and a <main> landmark
- Home page: stable button label, counter announced via a live status region
- Pest browser plugin + Playwright: axe checks (level 2) in light/dark and
  desktop/mobile, plus a keyboard-only interaction test
- Register the Browser test suite in phpunit.xml and Pest.php
- CLAUDE.md: accessibility development rules and browser test notes
- Boost-refreshed testing-best-practices skill files

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-22 09:45:13 +02:00

29 lines
1.1 KiB
PHP

<?php
it('has no accessibility issues on the home page', function (string $device, string $colorScheme) {
$page = visit(route('home'));
$page = $device === 'mobile' ? $page->on()->mobile() : $page->on()->desktop();
$page = $colorScheme === 'dark' ? $page->inDarkMode() : $page->inLightMode();
$page->assertSee('Toiminnanohjaus')
->assertNoJavaScriptErrors()
->assertNoAccessibilityIssues(level: 2);
})->with([
'desktop, light' => ['desktop', 'light'],
'desktop, dark' => ['desktop', 'dark'],
'mobile, light' => ['mobile', 'light'],
'mobile, dark' => ['mobile', 'dark'],
]);
it('can be operated with the keyboard alone', function () {
$page = visit(route('home'));
$page->keys('html > body', 'Tab')
->assertScript('document.activeElement.textContent.trim()', 'Siirry pääsisältöön')
->keys('a[href="#main-content"]', 'Tab')
->assertScript('document.activeElement.textContent.trim()', 'Lisää klikkaus')
->keys('#main-content button', 'Enter')
->assertSeeIn('[role="status"]', 'Klikattu 1 kertaa');
});