Merge branch 'main' into 2105-contact

This commit is contained in:
Beverly Nguyen
2024-12-04 14:27:03 -08:00
38 changed files with 757 additions and 370 deletions

View File

@@ -125,6 +125,7 @@ def test_static_pages(client_request, mock_get_organization_by_domain, view, moc
"write_for_action",
"multiple_languages",
"benchmark_performance",
"guidance_index"
]
return (
not current_app.config["FEATURE_BEST_PRACTICES_ENABLED"]

View File

@@ -18,6 +18,7 @@ EXCLUDED_ENDPOINTS = tuple(
Navigation.get_endpoint_with_blueprint,
{
"about_notify",
"about_security",
"accept_invite",
"accept_org_invite",
"accessibility_statement",
@@ -219,6 +220,7 @@ EXCLUDED_ENDPOINTS = tuple(
"suspend_service",
"template_history",
"template_usage",
"test_feature_flags",
"tour_step",
"trial_mode",
"trial_mode_new",
@@ -258,6 +260,7 @@ EXCLUDED_ENDPOINTS = tuple(
"view_template_version",
"view_template_versions",
"who_its_for",
"why_text_messaging",
"write_for_action",
},
)

View File

@@ -58,6 +58,7 @@ def _get_notifications_csv(
"to": recipient,
"recipient": recipient,
"client_reference": "ref 1234",
"carrier": "AT&T Mobility",
}
for i in range(rows)
],
@@ -88,15 +89,15 @@ def get_notifications_csv_mock(
(
None,
[
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time\n",
"8005555555,foo,,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n",
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time,Carrier\n",
"8005555555,foo,,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern,AT&T Mobility\r\n",
],
),
(
"Anne Example",
[
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time\n",
"8005555555,foo,Anne Example,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n", # noqa
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time,Carrier\n",
"8005555555,foo,Anne Example,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern,AT&T Mobility\r\n", # noqa
],
),
],
@@ -135,6 +136,7 @@ def test_generate_notifications_csv_without_job(
"Carrier Response",
"Status",
"Time",
"Carrier",
],
[
"8005555555",
@@ -144,6 +146,7 @@ def test_generate_notifications_csv_without_job(
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"AT&T Mobility",
],
),
(
@@ -159,6 +162,7 @@ def test_generate_notifications_csv_without_job(
"Carrier Response",
"Status",
"Time",
"Carrier",
"a",
"b",
"c",
@@ -171,6 +175,7 @@ def test_generate_notifications_csv_without_job(
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"AT&T Mobility",
"🐜",
"🐝",
"🦀",
@@ -189,6 +194,7 @@ def test_generate_notifications_csv_without_job(
"Carrier Response",
"Status",
"Time",
"Carrier",
"a",
"b",
"c",
@@ -201,6 +207,7 @@ def test_generate_notifications_csv_without_job(
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"AT&T Mobility",
"🐜,🐜",
"🐝,🐝",
"🦀",

View File

@@ -0,0 +1,72 @@
import os
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")
def test_best_practices_side_menu(authenticated_page):
page = authenticated_page
page.goto(f"{E2E_TEST_URI}")
page.wait_for_load_state("domcontentloaded")
check_axe_report(page)
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="Best Practices").click()
expect(page).to_have_title(re.compile("Best Practice"))
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="Rules and regulations").click()
expect(page).to_have_title(re.compile("Rules and regulations"))
page.get_by_role("link", name="Establish trust").click()
expect(page).to_have_title(re.compile("Establish trust"))
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="Multiple languages").click()
expect(page).to_have_title(re.compile("Text in multiple languages"))
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"))
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()
def test_breadcrumbs_best_practices(authenticated_page):
page = authenticated_page
page.goto(f"{E2E_TEST_URI}")
page.wait_for_load_state("domcontentloaded")
check_axe_report(page)
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()