Skip to content

Commit

Permalink
Trying one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjanousekGSA committed Jan 13, 2025
1 parent 0ba7146 commit 41ffb27
Showing 1 changed file with 16 additions and 37 deletions.
53 changes: 16 additions & 37 deletions tests/end_to_end/test_best_practices_content_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,43 @@
def test_best_practices_side_menu(authenticated_page):
page = authenticated_page

page.goto(f"{E2E_TEST_URI}")

page.wait_for_load_state("domcontentloaded")
page.goto(f"{E2E_TEST_URI}/guides/best-practices")
page.wait_for_load_state("networkidle")
check_axe_report(page)

# Test Best Practices navigation
page.get_by_role("link", name="Best Practices").click()
expect(page).to_have_title(re.compile("Best Practice"))
# Test navigation for "Best Practices" and its sub-links
expect(page.get_by_role("link", name="Best Practices")).to_be_visible(timeout=10000)

expect(page.get_by_role("link", name="Clear goals", exact=True)).to_be_visible(timeout=5000)
# Test the individual sublinks under Best Practices
page.get_by_role("link", name="Clear goals", exact=True).click()
expect(page).to_have_title(re.compile("Establish clear goals"))
expect(page).to_have_title(re.compile("Clear goals"))

expect(page.get_by_role("link", name="Rules and regulations")).to_be_visible(timeout=5000)
page.get_by_role("link", name="Rules and regulations").click()
expect(page).to_have_title(re.compile("Rules and regulations"))

expect(page.get_by_role("link", name="Establish trust")).to_be_visible(timeout=5000)
page.get_by_role("link", name="Establish trust").click()
expect(page).to_have_title(re.compile("Establish trust"))

expect(page.get_by_role("link", name="Write for action")).to_be_visible(timeout=5000)
page.get_by_role("link", name="Write for action").click()
expect(page).to_have_title(re.compile("Write texts that provoke"))
expect(page).to_have_title(re.compile("Write for action"))

expect(page.get_by_role("link", name="Multiple languages")).to_be_visible(timeout=5000)
page.get_by_role("link", name="Multiple languages").click()
expect(page).to_have_title(re.compile("Text in multiple languages"))
expect(page).to_have_title(re.compile("Multiple languages"))

expect(page.get_by_role("link", name="Benchmark performance")).to_be_visible(timeout=5000)
page.get_by_role("link", name="Benchmark performance").click()
expect(page).to_have_title(re.compile("Measuring performance with"))

parent_link = page.get_by_role("link", name="Establish trust")
parent_link.hover()

submenu_item = page.get_by_role("link", name=re.compile("Get the word out"))
expect(submenu_item).to_be_visible(timeout=5000)
submenu_item.click()

expect(page).to_have_url(re.compile(r"#get-the-word-out"))

anchor_target = page.locator("#get-the-word-out")
expect(anchor_target).to_be_visible()
anchor_target.click()
expect(page).to_have_title(re.compile("Benchmark performance"))


def test_breadcrumbs_best_practices(authenticated_page):
page = authenticated_page

page.goto(f"{E2E_TEST_URI}")

page.wait_for_load_state("domcontentloaded")
page.goto(f"{E2E_TEST_URI}/guides/best-practices")
page.wait_for_load_state("networkidle")
check_axe_report(page)

# Test Best Practices breadcrumbs
expect(page.get_by_role("link", name="Clear goals", exact=True)).to_be_visible(timeout=5000)
# Test breadcrumb navigation from a subpage
page.get_by_role("link", name="Clear goals", exact=True).click()
breadcrumbs_link = page.locator("ol").get_by_role("link", name="Best Practices")
expect(breadcrumbs_link).to_be_visible(timeout=5000)
breadcrumbs_link.click()
breadcrumb_link = page.locator("ol").get_by_role("link", name="Best Practices")
expect(breadcrumb_link).to_be_visible(timeout=10000)
breadcrumb_link.click()
expect(page).to_have_title(re.compile("Best Practices"))

0 comments on commit 41ffb27

Please sign in to comment.