try expanding use of axe

This commit is contained in:
Kenneth Kehl
2024-09-11 12:36:58 -07:00
parent 286166c2ad
commit 8ef357ea61
3 changed files with 18 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ import os
import re
import pytest
from axe_core_python.sync_playwright import Axe
E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
@@ -105,3 +106,13 @@ def authenticated_page(end_to_end_context):
page.wait_for_load_state("domcontentloaded")
return page
def check_axe_report(page):
axe = Axe()
results = axe.run(page)
assert (
len(results["violations"]) == 0
), f"Accessibility violations: {results['violations']}"

View File

@@ -1,6 +1,6 @@
import os
from axe_core_python.sync_playwright import Axe
from tests.end_to_end.conftest import check_axe_report
E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
@@ -19,11 +19,4 @@ def test_a11y(authenticated_page, end_to_end_context):
# Check to make sure that we've arrived at the next page.
page.wait_for_load_state("domcontentloaded")
axe = Axe()
results = axe.run(page)
assert (
len(results["violations"]) == 0
), f"Accessibility violations: {results['violations']}"
check_axe_report(page)

View File

@@ -4,6 +4,8 @@ import re
from playwright.sync_api import expect
from tests.end_to_end.conftest import check_axe_report
E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
@@ -21,6 +23,7 @@ def test_add_new_service_workflow(authenticated_page, end_to_end_context):
# Check to make sure that we've arrived at the next page.
page.wait_for_load_state("domcontentloaded")
check_axe_report(page)
# Check to make sure that we've arrived at the next page.
# Check the page title exists and matches what we expect.
@@ -49,6 +52,7 @@ def test_add_new_service_workflow(authenticated_page, end_to_end_context):
# Check to make sure that we've arrived at the next page.
page.wait_for_load_state("domcontentloaded")
check_axe_report(page)
# Check for the sign in heading.
about_heading = page.get_by_role("heading", name="About your service")
@@ -69,6 +73,7 @@ def test_add_new_service_workflow(authenticated_page, end_to_end_context):
# Check to make sure that we've arrived at the next page.
page.wait_for_load_state("domcontentloaded")
check_axe_report(page)
# Check for the service name title and heading.
service_heading = page.get_by_text(new_service_name, exact=True)