-
Notifications
You must be signed in to change notification settings - Fork 779
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update docs on running tests (#3556)
* docs: update docs on running tests * Update doc/developer-guide.md Co-authored-by: Dan Bowling <[email protected]> * suggestion * non-headless * readmes * typo * better link * typo * update * typo * wording * major typo Co-authored-by: Dan Bowling <[email protected]>
- Loading branch information
Showing
5 changed files
with
93 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# ACT Mapping | ||
|
||
Contains information on how to run axe-core rules against the [ACT-Rules](https://act-rules.github.io/). Each ACT rule suite is its own JSON file (named after the axe-core rule to run) which contains the following information: | ||
|
||
- `id` - string(required). The ACT Rule Id | ||
- `title` - string(required). The title of the test taken from the ACT rule name. Used in the `describe` block of the test suite. | ||
- `axeRules` - array(required). List of axe-core rules to run | ||
|
||
When the tests are run using `npm run test:act`, each JSON file is converted into a test suite file using [Karmas preprocessor](https://karma-runner.github.io/latest/config/preprocessors.html) and [runner.js](./runner.js) as the test suite template. | ||
|
||
You can run and debug the tests in a non-headless browser by running `npm run test:act:debug`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ARIA Practices | ||
|
||
Runs axe-core on the examples provided in the [ARIA Practices](https://www.w3.org/WAI/ARIA/apg/). To run the tests, run `npm run test:apg`. | ||
|
||
If certain axe-core rules should not be run on certain pages, you can disable those rules using the `disabledRules` object in [apg.spec.js](./apg.spec.js). Please be sure to add a comment as to why the rule should not be run. If applicable, please open an issue in either axe-core or [aria-practices](https://github.com/w3c/aria-practices) and link to the issue in the code so that we can track the issue and know when we can run the rule again. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Full Integration Tests | ||
|
||
Full Integration tests are tests that require a complete HTML page rather than testing content inside of a fixture element. Full integration tests are run using a non-headless browser and requires a page navigation to the relevant HTML test file. | ||
|
||
To run the full integration tests, run `npm run test:integration`. Different browsers can be used using various npm scripts: | ||
|
||
- `npm run test:integration:chrome` - Run the tests using Chrome (default when using `test:integration`) | ||
- `npm run test:integration:firefox` - Run the tests using Firefox | ||
- `npm run test:integration:ie` - Run the tests using Internet Explorer (requires running on Windows machine) | ||
|
||
Because the full integration tests are not run using Mocha, Mocha styles and scripts, Chai, axe-core, [testutils.js](../../tesstutils.js), and the [adapter.js](../adapter.js) file will need to be loaded on the page. | ||
|
||
If the Mocha output would interfere with the axe-core results, you can load the [no-ui-reporter.js](../no-ui-reporter.js) to hide the Mocha test output in the browser UI and instead report the results in the browsers devtools console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Rule Integration Tests | ||
|
||
Rule Integration tests take an HTML snippet file and runs an axe-core rule against it. The results for the run are then compared against the companion JSON file to ensure that every node returns as the expected result (passes, violation, incomplete, inapplicable). | ||
|
||
To run the rule integration tests, run `npm run test:unit:integration`. You can run and debug the tests in a non-headless browser by running `npm run test:debug -- testDirs=integration`. | ||
|
||
When the tests are run, each JSON file is converted into a test suite file using [Karmas preprocessor](https://karma-runner.github.io/latest/config/preprocessors.html) and [runner.js](./runner.js) as the test suite template. | ||
|
||
The JSON file for a rule integration test contains the following information: | ||
|
||
- `description` - string(required). The title of the test. Used in the `describe` block of the test suite | ||
- `rule` - string(required) The axe-core rule to run | ||
- `violations` array(optional). List of axe-core selectors of nodes that should return as Violations | ||
- `passes` array(optional). List of axe-core selectors of nodes that should return as Passes | ||
- `incomplete` array(optional). List of axe-core selectors of nodes that should return as Needs Review | ||
|
||
The JSON file should have at least one of the `violations`, `passes`, or `incomplete` arrays. Inapplicable results are not listed as the test will fail if any node is found in one of the 3 arrays that is not explicitly listed. |