Merge branch 'feature/sidenav-expand-sublinks' of https://github.com/GSA/notifications-admin into feature/sidenav-expand-sublinks

This commit is contained in:
Jonathan Bobel
2025-01-13 12:45:12 -05:00
13 changed files with 38 additions and 69 deletions

View File

@@ -50,7 +50,7 @@
{% block maincolumn_content %}
<div class="grid-row">
{% if navigation_links %}
<div class="tablet:grid-col-3 margin-bottom-4">
<div class="tablet:grid-col-2 margin-bottom-4">
<nav class="nav">
<ul class="usa-sidenav">
{% for item in navigation_links %}
@@ -80,9 +80,9 @@
</nav>
</div>
<div class="tablet:grid-col-9 tablet:padding-left-4 usa-prose site-prose">
<div class="tablet:grid-col-10 tablet:padding-left-4 usa-prose site-prose">
{% else %}
<div class="tablet:grid-col-9">
<div class="tablet:grid-col-10">
{% endif %}
{% block content_column_content %}{% endblock %}
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 926 KiB

After

Width:  |  Height:  |  Size: 931 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 KiB

After

Width:  |  Height:  |  Size: 559 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 KiB

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 KiB

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 KiB

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

View File

@@ -108,52 +108,33 @@ def test_hiding_pages_from_search_engines(
def test_static_pages(client_request, mock_get_organization_by_domain, view, mocker):
mocker.patch("app.notify_client.user_api_client.UserApiClient.deactivate_user")
# Function to check if a view is feature-flagged and should return 404 when disabled
def is_feature_flagged(view):
feature_flagged_views = [
"clear_goals",
"rules_and_regulations",
"establish_trust",
"write_for_action",
"multiple_languages",
"benchmark_performance",
"guidance_index",
]
return (
view in feature_flagged_views
)
request = partial(client_request.get, "main.{}".format(view))
# If the guidance feature is disabled, expect a 404 for feature-flagged views
if is_feature_flagged(view):
page = request(_expected_status=404)
else:
# Check the page loads when user is signed in
page = request()
assert page.select_one("meta[name=description]")
# Assert the page loads successfully
page = request(_expected_status=200)
assert page.select_one("meta[name=description]")
# Check it still works when they dont have a recent service
with client_request.session_transaction() as session:
session["service_id"] = None
request()
# Check the behavior when no recent service is set
with client_request.session_transaction() as session:
session["service_id"] = None
request()
# Check it redirects to the login screen when they sign out
client_request.logout()
with client_request.session_transaction() as session:
session["service_id"] = None
session["user_id"] = None
request(
_expected_status=302,
_expected_redirect="/sign-in?next={}".format(
url_for("main.{}".format(view))
),
)
# Check redirection to login screen when signed out
client_request.logout()
with client_request.session_transaction() as session:
session["service_id"] = None
session["user_id"] = None
request(
_expected_status=302,
_expected_redirect="/sign-in?next={}".format(
url_for("main.{}".format(view))
),
)
def test_guidance_pages_link_to_service_pages_when_signed_in(client_request, mocker):
mocker.patch("app.notify_client.user_api_client.UserApiClient.deactivate_user")
request = partial(client_request.get, "main.edit_and_format_messages")
selector = ".list-number li a"
@@ -175,8 +156,7 @@ def test_guidance_pages_link_to_service_pages_when_signed_in(client_request, moc
with client_request.session_transaction() as session:
session["service_id"] = None
session["user_id"] = None
page = request(_expected_status=302)
assert not page.select_one(selector)
request(_expected_status=302)
@pytest.mark.parametrize(

View File

@@ -11,15 +11,14 @@ 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")
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)
# 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"))
@@ -30,35 +29,25 @@ def test_best_practices_side_menu(authenticated_page):
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"))
expect(page).to_have_title(re.compile("Write for action"))
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"))
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()
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
# Test breadcrumb navigation from a subpage
page.get_by_role("link", name="Clear goals", exact=True).click()
page.locator("ol").get_by_role("link", name="Best Practices").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"))