feature flag for testing

This commit is contained in:
Beverly Nguyen
2024-10-31 12:04:26 -07:00
parent e09eabd8ae
commit 109f3d9992
2 changed files with 50 additions and 25 deletions

View File

@@ -16,38 +16,43 @@ def test_best_practices_side_menu(authenticated_page):
page.wait_for_load_state("domcontentloaded")
check_axe_report(page)
page.get_by_role("link", name="Best Practices").click()
expect(page).to_have_title(re.compile("Best Practice"))
response = page.request.get(f"{E2E_TEST_URI}/test/feature-flags")
feature_flags = response.json()
feature_best_practices_enabled = feature_flags.get("FEATURE_BEST_PRACTICES_ENABLED")
page.get_by_role("link", name="Clear goals", exact=True).click()
expect(page).to_have_title(re.compile("Establish clear goals"))
if feature_best_practices_enabled:
page.get_by_role("link", name="Best Practices").click()
expect(page).to_have_title(re.compile("Best Practice"))
page.get_by_role("link", name="Rules and regulations").click()
expect(page).to_have_title(re.compile("Rules and regulations"))
page.get_by_role("link", name="Clear goals", exact=True).click()
expect(page).to_have_title(re.compile("Establish clear goals"))
page.get_by_role("link", name="Establish trust").click()
expect(page).to_have_title(re.compile("Establish trust"))
page.get_by_role("link", name="Rules and regulations").click()
expect(page).to_have_title(re.compile("Rules and regulations"))
page.get_by_role("link", name="Write for action").click()
expect(page).to_have_title(re.compile("Write texts that provoke"))
page.get_by_role("link", name="Establish trust").click()
expect(page).to_have_title(re.compile("Establish trust"))
page.get_by_role("link", name="Multiple languages").click()
expect(page).to_have_title(re.compile("Text in multiple languages"))
page.get_by_role("link", name="Write for action").click()
expect(page).to_have_title(re.compile("Write texts that provoke"))
page.get_by_role("link", name="Benchmark performance").click()
expect(page).to_have_title(re.compile("Measuring performance with"))
page.get_by_role("link", name="Multiple languages").click()
expect(page).to_have_title(re.compile("Text in multiple languages"))
parent_link = page.get_by_role("link", name="Establish trust")
parent_link.hover()
page.get_by_role("link", name="Benchmark performance").click()
expect(page).to_have_title(re.compile("Measuring performance with"))
submenu_item = page.get_by_role("link", name=re.compile("Get the word out"))
submenu_item.click()
parent_link = page.get_by_role("link", name="Establish trust")
parent_link.hover()
expect(page).to_have_url(re.compile(r"#get-the-word-out"))
submenu_item = page.get_by_role("link", name=re.compile("Get the word out"))
submenu_item.click()
anchor_target = page.locator("#get-the-word-out")
expect(anchor_target).to_be_visible()
anchor_target.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()
def test_breadcrumbs_best_practices(authenticated_page):
@@ -58,5 +63,10 @@ def test_breadcrumbs_best_practices(authenticated_page):
page.wait_for_load_state("domcontentloaded")
check_axe_report(page)
page.get_by_role("link", name="Clear goals", exact=True).click()
page.locator("ol").get_by_role("link", name="Best Practices").click()
response = page.request.get(f"{E2E_TEST_URI}/test/feature-flags")
feature_flags = response.json()
feature_best_practices_enabled = feature_flags.get("FEATURE_BEST_PRACTICES_ENABLED")
if feature_best_practices_enabled:
page.get_by_role("link", name="Clear goals", exact=True).click()
page.locator("ol").get_by_role("link", name="Best Practices").click()