flowd/axeception
Composer 安装命令:
composer require flowd/axeception
包简介
Automated axe-core accessibility testing for Codeception with per-validation and per-selector expectations to catch regressions
关键字:
README 文档
README
A lightweight Codeception module + reporter to run axe-core in your browser tests and generate a consolidated HTML report (Twig-based) per test suite.
- Module: runs axe-core in the current page via WebDriver, supports axe.configure and custom axe script URL.
- Reporter: aggregates results from all tests and renders tests/_output/axeception-report.html using Twig templates.
Features
- Execute axe.run() in real browser context (Codeception WebDriver)
- Optional axe.configure(...) via YAML config (passed verbatim to axe)
- Per-violation details (rule, impact, WCAG tags, nodes with target selectors and HTML snippets)
- One consolidated HTML report with Table of Contents (anchors per test)
- Custom output filename per test (via module config reportFilename)
Requirements
- PHP 8.3+
- Codeception 5+
- Codeception WebDriver module (Chromedriver/Geckodriver etc.)
Installation
composer require flowd/axeception
The package depends on twig/twig:^3.10.
Enable in your suite
Enable WebDriver and AxeCeption in your suite (e.g. tests/Acceptance.suite.yml):
modules: enabled: - WebDriver: - Codeception\Module\AxeCeption: # Optional: filename for the HTML report (relative to _output or absolute path) reportFilename: 'axeception-report.html' # Optional: URL or local path to axe-core script # Defaults to https://unpkg.com/axe-core/axe.min.js axeJavascript: '/axe.min.js' # Optional: configuration passed to axe.configure({...}) before axe.run() axeConfigure: rules: # example: disable a rule - id: "aria-allowed-role" enabled: false # example: enable enhanced color contrast - id: "color-contrast-enhanced" enabled: true
Notes:
- The module automatically injects axe-core into the current page and runs
axe.configure(...)ifaxeConfigureis provided. - If
reportFilenameis set on the module, it will be used; an individual test can also override it (see below).
Using in tests (Cest)
Call seeNoAccessibilityIssues() in your Cest scenarios after navigating to a page:
<?php class AccessibilityCest { public function homepageHasNoCriticalViolations(AcceptanceTester $I): void { $I->amOnPage('/'); $I->seeNoAccessibilityIssues(); } }
What happens:
- The module checks that WebDriver is available.
- It injects the axe-core script (from axeJavascript).
- It applies
axeConfigure(if configured). - It runs
axe.run()and collects theviolationsarray. - For each violation, it records a custom AxeStep in the scenario (used by the reporter) and then fails the test if at least one violation exists.
The HTML report
The reporter runs at the end of the suite (RESULT_PRINT_AFTER) and produces a single HTML file.
- Default output:
tests/_output/axeception-report.html - Per-test override: in code, the module sets each AxeStep’s report path from
reportFilename. If you setreportFilenamein config, that name/path will be used. Absolute paths are respected; relative paths are resolved under_output.
Example: Consolidated report with table of contents and per-violation details
Contents of the report:
- Table of Contents with links (anchors) to each test section
- For each test: summary table of violations and detailed sections per rule
- For each node: target selectors, HTML snippet, and fix summary lines derived from axe’s failureSummary
Templates (Twig):
src/Codeception/Extension/template/page.twigsrc/Codeception/Extension/template/test.twig
You can copy and adapt these to change the appearance/structure. The reporter renders with auto-escaping enabled.
Configuration reference
- axeJavascript: string
- URL or local path to the axe-core script. Default:
https://unpkg.com/axe-core/axe.min.js
- URL or local path to the axe-core script. Default:
- axeConfigure: array
- Converted to JSON and passed to
axe.configure(...)beforeaxe.run(). - Mirrors axe documentation: https://www.deque.com/axe/core-documentation/api-documentation/
- Converted to JSON and passed to
- reportFilename: string
- File name or absolute path for the report. If relative, it will be created under Codeception’s
_outputdirectory.
- File name or absolute path for the report. If relative, it will be created under Codeception’s
Customizing output per test
You can override the report target per test by setting reportFilename in your Codeception config (applies to all tests). The reporter also respects a report path set on the recorded step. If you need programmatic control, expose a way to set a per-test path before calling seeNoAccessibilityIssues() and pass it into the module config (this repository already forwards reportFilename from config into recorded steps).
Troubleshooting
- WebDriver module not loaded
- Ensure WebDriver is enabled in your suite and appears before AxeCeption.
- axe.run() did not return a violations array
- The module surfaces JavaScript loading/execution errors. Verify the axe script URL is reachable and there are no page JS errors.
- No results in the report
- The reporter only renders tests that produced AxeStep entries (i.e., tests that called
seeNoAccessibilityIssues()and reached axe.run()).
- The reporter only renders tests that produced AxeStep entries (i.e., tests that called
- Anchors/TOC
- Anchors are derived from test names. If your test names contain special characters, they are normalized to generate stable IDs.
Development notes
- Namespaces
- Module:
Codeception\Module\AxeCeption - Reporter:
Codeception\Extension\AxeCeptionReporter - Step:
Codeception\Step\AxeStep
- Module:
- Templates live under
src/Codeception/Extension/template/. - Twig is initialized without cache for simplicity; you can enable caching by providing a writable directory in the reporter.
License
MIT
flowd/axeception 适用场景与选型建议
flowd/axeception 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 08 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「codeception」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 flowd/axeception 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 flowd/axeception 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 flowd/axeception 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Connection 'Db' codeception module to 'Yii2' module database settings
Mailtrap module for Codeception
Qase TMS Codeception reporter.
Run codeception in multiple modes in mvc structure
Codeception module for Yii2 framework
A Codeception extension & Robo task that records test runtimes and lets you split tests into equal runtime-based groups for parallel runs
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-27