| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A Codeception module for automated accessibility testing using axe-core.
This package provides a Codeception module that integrates with axe-core to perform accessibility testing on web pages. It allows you to automatically check your web pages for accessibility issues during your acceptance tests.
Install the package via Composer:
composer require flowd/axeceptionAdd the module to your Codeception suite configuration file (e.g., acceptance.suite.yml):
modules:
enabled:
- WebDriver:
# WebDriver configuration...
- AxeCeption:
# Optional: specify a custom URL for axe.js
axeJavascript: '/axe.min.js'By default, the module uses the axe-core library from https://unpkg.com/axe-core/axe.min.js. You can specify a different URL or a local path if needed.
In your Codeception test, use the seeNoAccessibilityIssues() method to check for accessibility issues:
<?php
// In your Cest file
public function testAccessibility(AcceptanceTester $I)
{
$I->amOnPage('/your-page');
$I->seeNoAccessibilityIssues([]);
}You can declare known (expected) violations so the test only fails when the actual count deviates from what you expect. There are two modes:
Do not mix both modes for the same rule.
<?php
public function testAccessibility(AcceptanceTester $I)
{
$I->amOnPage('/your-page');
$I->seeNoAccessibilityIssues([
'aria-allowed-role' => [
'.b-dot-seperated-list' => 1,
'.footer' => 2,
],
'label' => 1,
]);
}The test will only fail if the number of violations for each rule doesn't match the expected count.
Here's a complete example of how to use the module in a Codeception test:
<?php
namespace Tests\Acceptance;
use Codeception\Example;
use Tests\Support\FrontendUser;
class AccessibilityCest
{
/**
* Test homepage accessibility
*/
public function homepageAccessibility(FrontendUser $I)
{
$I->amOnPage('/');
$I->seeNoAccessibilityIssues([
// Known issues that we're working on
'aria-allowed-role' => [
'.b-dot-seperated-list' => 1,
'.footer' => 2,
],
'label' => 1,
]);
}
}If you see the error "WebDriver module not loaded", make sure:
If you see "Axe returned invalid data", check:
| Back | FazBrowse Home | New Git URL |