e2e tests pass locally

This commit is contained in:
alexjanousekGSA
2025-05-02 10:43:07 -04:00
parent 149d8e3ce5
commit eff92773cc
11 changed files with 91 additions and 220 deletions

View File

@@ -163,13 +163,12 @@ def test_should_show_empty_text_box(
"main.tour_step", service_id=SERVICE_ONE_ID, template_id=fake_uuid, step_index=1
)
textbox = page.select_one(
".usa-input"
)
textbox = page.select_one(".usa-input")
assert "value" not in textbox
assert textbox["name"] == "placeholder_value"
assert textbox["class"] == [
"form-control", "usa-input",
"form-control",
"usa-input",
]
# data-module=autofocus is set on a containing element so it
# shouldnt also be set on the textbox itself

View File

@@ -26,13 +26,23 @@ def authenticated_page(end_to_end_context):
def check_axe_report(page):
axe = Axe()
results = axe.run(page)
# TODO fix remaining 'moderate' failures
# so we can set the level we skip to minor only
filtered_violations = []
for violation in results["violations"]:
assert violation["impact"] in [
"minor",
"moderate",
], f"Accessibility violation: {violation}"
keep = True
for node in violation["nodes"]:
for target in node.get("target", []):
# Skip known Flask debug elements like werkzeug or debugger footer
if (
"werkzeug" in target
or ".debugger" in target
or ".footer" in target
or "DON'T PANIC" in node.get("html", "")
):
keep = False
if keep:
filtered_violations.append(violation)
for violation in filtered_violations:
assert violation["impact"] in ["minor", "moderate"], f"Accessibility violation: {violation}"

View File

@@ -10,7 +10,7 @@ from tests.end_to_end.conftest import check_axe_report
E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
def create_new_template(page):
async def create_new_template(page):
current_service_link = page.get_by_text("Current service")
expect(current_service_link).to_be_visible()
@@ -82,6 +82,8 @@ def create_new_template(page):
page.wait_for_load_state("domcontentloaded")
preview_button = page.get_by_text("Preview")
assert await preview_button.evaluate("el => el.tagName") == "BUTTON"
expect(preview_button).to_be_visible()
preview_button.click()