You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/utility-guides/Axe.md
+8-55Lines changed: 8 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,20 +3,18 @@
3
3
The Axe utility provided by this blueprint allows for the scanning of pages by using [axe-core](https://github.com/dequelabs/axe-core), a JavaScript
4
4
library used for scanning for accessibility issues and providing guidance on how to resolve these issues.
5
5
6
+
> NOTE: This is now a direct extension of the [pytest-playwright-axe](https://github.com/davethepunkyone/pytest-playwright-axe) plugin with logic to apply WCAG 2.2 AA rules by default.
7
+
6
8
## Table of Contents
7
9
8
10
-[Utility Guide: Axe](#utility-guide-axe)
9
11
-[Table of Contents](#table-of-contents)
10
12
-[Using the Axe class](#using-the-axe-class)
11
13
-[.run(): Single page scan](#run-single-page-scan)
@@ -43,30 +41,9 @@ By default, the `Axe.run(page)` command will do the following:
43
41
- Any steps after the `Axe.run()` command will continue to execute, and it will not cause the test in progress to fail (it runs a passive scan of the page)
44
42
- Will return the full response from axe-core as a dict object if the call is set to a variable, e.g. `axe_results = Axe.run(page)` will populate `axe_results` to interact with as required
|`ruleset`|`list[str]`| Any provided by [axe-core](https://www.deque.com/axe/core-documentation/api-documentation/)|`['wcag2a', 'wcag21a', 'wcag2aa', 'wcag21aa', 'wcag22a', 'wcag22aa', 'best-practice']`| The tags that axe-core uses to filter specific checks. Defaulted to rules used for the WCAG 2.2 AA standard. |
61
-
|`filename`|`str`| A string valid for a filename (e.g. `test_report`) || If provided, HTML and JSON reports will save with the filename provided. If not provided (default), the URL of the page under test will be used as the filename. |
62
-
|`report_on_violation_only`|`bool`|`True`, `False`|`False`| If True, HTML and JSON reports will only be generated if at least one violation is found. |
63
-
|`strict_mode`|`bool`|`True`, `False`|`False`| If True, when a violation is found an AxeAccessibilityException is raised, causing a test failure. |
64
-
|`html_report_generated`|`bool`|`True`, `False`|`True`| If True, a HTML report will be generated summarising the axe-core findings. |
65
-
|`json_report_generated`|`bool`|`True`, `False`|`True`| If True, a JSON report will be generated with the full axe-core findings. |
66
-
67
-
### Returns
44
+
### Further reading
68
45
69
-
This function can be used independently, but when set to a variable returns a `dict` with the axe-core results.
46
+
This class directly extends the pytest-playwright-axe plugin version of this function, so please see the [single page scan documentation](https://github.com/davethepunkyone/pytest-playwright-axe?tab=readme-ov-file#run-single-page-scan) for additional arguments that can be used.
70
47
71
48
### Example usage
72
49
@@ -85,33 +62,9 @@ To scan multiple URLs within your application, you can use the following method:
85
62
86
63
This runs the `Axe.run()` function noted above against each URL provided in the `page_list` argument, and will generate reports as required.
| page | playwright.sync_api.Page | A Playwright Page object to drive navigation to each page to test. |
95
-
| page_list | list[str]| A list of URLs to execute against |
96
-
97
-
> NOTE: It is heavily recommended that when using the `run_list` command, that you set a `--base-url` either via the pytest.ini file or by passing in the value when using the `pytest` command in the command line. By doing this, the list you pass in will not need to contain the base URL value and therefore make any scanning transferrable between environments.
98
-
99
-
### Optional arguments
100
-
101
-
The `Axe.run_list(page, page_list)` function has the following optional arguments that can be passed in:
102
-
103
-
| Argument | Format | Supported Values | Default Value | Description |
|`use_list_for_filename`|`bool`|`True`, `False`|`True`| If True, the filename will be derived from the value provided in the list. If False, the full URL will be used. |
106
-
|`ruleset`|`list[str]`| Any provided by [axe-core](https://www.deque.com/axe/core-documentation/api-documentation/)|`['wcag2a', 'wcag21a', 'wcag2aa', 'wcag21aa', 'wcag22a', 'wcag22aa', 'best-practice']`| The tags that axe-core uses to filter specific checks. Defaulted to rules used for the WCAG 2.2 AA standard. |
107
-
|`report_on_violation_only`|`bool`|`True`, `False`|`False`| If True, HTML and JSON reports will only be generated if at least one violation is found. |
108
-
|`strict_mode`|`bool`|`True`, `False`|`False`| If True, when a violation is found an AxeAccessibilityException is raised, causing a test failure. |
109
-
|`html_report_generated`|`bool`|`True`, `False`|`True`| If True, a HTML report will be generated summarising the axe-core findings. |
110
-
|`json_report_generated`|`bool`|`True`, `False`|`True`| If True, a JSON report will be generated with the full axe-core findings. |
111
-
112
-
### Returns
65
+
### Further reading
113
66
114
-
This function can be used independently, but when set to a variable returns a `dict` with the axe-core results for all pages scanned (using the URL value in the list provided as the key).
67
+
This class directly extends the pytest-playwright-axe plugin version of this function, so please see the [multiple page scan documentation](https://github.com/davethepunkyone/pytest-playwright-axe?tab=readme-ov-file#run_list-multiple-page-scan)for additional arguments that can be used.
0 commit comments