mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-06 22:18:25 -04:00
try expanding use of axe
This commit is contained in:
@@ -2,6 +2,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from axe_core_python.sync_playwright import Axe
|
||||||
|
|
||||||
E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
|
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")
|
page.wait_for_load_state("domcontentloaded")
|
||||||
|
|
||||||
return page
|
return page
|
||||||
|
|
||||||
|
|
||||||
|
def check_axe_report(page):
|
||||||
|
axe = Axe()
|
||||||
|
|
||||||
|
results = axe.run(page)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
len(results["violations"]) == 0
|
||||||
|
), f"Accessibility violations: {results['violations']}"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import os
|
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")
|
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.
|
# Check to make sure that we've arrived at the next page.
|
||||||
page.wait_for_load_state("domcontentloaded")
|
page.wait_for_load_state("domcontentloaded")
|
||||||
|
check_axe_report(page)
|
||||||
axe = Axe()
|
|
||||||
|
|
||||||
results = axe.run(page)
|
|
||||||
|
|
||||||
assert (
|
|
||||||
len(results["violations"]) == 0
|
|
||||||
), f"Accessibility violations: {results['violations']}"
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import re
|
|||||||
|
|
||||||
from playwright.sync_api import expect
|
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")
|
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.
|
# Check to make sure that we've arrived at the next page.
|
||||||
page.wait_for_load_state("domcontentloaded")
|
page.wait_for_load_state("domcontentloaded")
|
||||||
|
check_axe_report(page)
|
||||||
|
|
||||||
# Check to make sure that we've arrived at the next page.
|
# Check to make sure that we've arrived at the next page.
|
||||||
# Check the page title exists and matches what we expect.
|
# 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.
|
# Check to make sure that we've arrived at the next page.
|
||||||
page.wait_for_load_state("domcontentloaded")
|
page.wait_for_load_state("domcontentloaded")
|
||||||
|
check_axe_report(page)
|
||||||
|
|
||||||
# Check for the sign in heading.
|
# Check for the sign in heading.
|
||||||
about_heading = page.get_by_role("heading", name="About your service")
|
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.
|
# Check to make sure that we've arrived at the next page.
|
||||||
page.wait_for_load_state("domcontentloaded")
|
page.wait_for_load_state("domcontentloaded")
|
||||||
|
check_axe_report(page)
|
||||||
|
|
||||||
# Check for the service name title and heading.
|
# Check for the service name title and heading.
|
||||||
service_heading = page.get_by_text(new_service_name, exact=True)
|
service_heading = page.get_by_text(new_service_name, exact=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user