Fixed test

This commit is contained in:
alexjanousekGSA
2024-12-11 09:34:24 -05:00
24 changed files with 154 additions and 220 deletions

View File

@@ -141,6 +141,10 @@ def _csp(config):
logo_domain = config["LOGO_CDN_DOMAIN"]
return {
"default-src": ["'self'", asset_domain],
"frame-src": [
"https://www.youtube.com",
"https://www.youtube-nocookie.com",
],
"frame-ancestors": "'none'",
"form-action": "'self'",
"script-src": [

View File

@@ -237,6 +237,20 @@ td.table-empty-message {
background-position: 0;
}
.folder-heading-template {
background: url(../img/material-icons/wysiwyg.svg) no-repeat;
padding-left: units(4);
display: inline-block;
background-position: 0;
}
.folder-heading-template {
background: url(../img/material-icons/wysiwyg.svg) no-repeat;
padding-left: units(4);
display: inline-block;
background-position: 0;
}
.usa-checkbox .usa-checkbox__label {
+ a.template-list-folder {
margin-left: units(4);
@@ -272,6 +286,7 @@ td.table-empty-message {
margin-bottom: units(2);
.usa-form-group {
@include u-width('mobile-lg');
margin-top: units(2);
}
input#search {
width: 100%;
@@ -407,6 +422,11 @@ td.table-empty-message {
background-image: url(../img/material-icons/description.svg);
}
}
.get-started {
border: 1px solid color('gray-90');
padding: units(2);
margin-bottom: units(4);
}
}
.dashboard-table {
@@ -983,3 +1003,11 @@ li.linked-card:hover svg,
}
}
}
// Send message flow
#breadcrumb-template-folders,
#nav-service-nav span {
font-size: units(3);
font-weight: bold;
}

View File

@@ -278,6 +278,13 @@ def guidance_index():
)
@main.route("/contact")
def contact():
return render_template(
"views/contact.html",
)
@main.route("/about")
def about_notify():
return render_template(

View File

@@ -739,7 +739,7 @@ def all_placeholders_in_session(placeholders):
def get_send_test_page_title(template_type, entering_recipient, name=None):
if entering_recipient:
return "Send {}".format(name)
return "Select recipients"
return "Personalize this message"

View File

@@ -114,4 +114,8 @@ def about_notify_nav():
},
],
},
{
"name": "Contact",
"link": "main.contact",
},
]

View File

@@ -6,9 +6,7 @@
<html lang="{{ htmlLang | default('en') }}" class="{{ htmlClasses }}">
<head>
<title>
{% block pageTitle %}
{% block per_page_title %}{% endblock %} Notify.gov
{% endblock %}
{% block pageTitle %}{% block per_page_title %}{% endblock %} Notify.gov{% endblock %}
</title>
{% include "components/head.html" %}
</head>

View File

@@ -4,9 +4,9 @@
template_type,
current_user,
link_current_item=False,
root_element='h1'
root_element='nav'
) %}
<{{ root_element }} class="font-body-lg folder-heading margin-bottom-0"{% if root_element == 'h1' %} id="page-header"{% endif %}>
<{{ root_element }} id="breadcrumb-template-folders" class="navigation-service usa-breadcrumb padding-top-0 padding-bottom-05" aria-label="Template folder path">
{% for folder in folders %}
{% if loop.last and not link_current_item %}
{% if folder.template_type or not folder.id %}

View File

@@ -17,7 +17,7 @@
{% endif %}
{% if show %}
<div class="live-search js-header" data-module="live-search" data-targets="{{ target_selector }}">
<div class="live-search js-header margin-top-0" data-module="live-search" data-targets="{{ target_selector }}">
{{ form.search(param_extensions=param_extensions) }}
<div aria-live="polite" class="live-search__status usa-sr-only"></div>
</div>

View File

@@ -6,12 +6,12 @@
<a href="{{ url_for('.organization_dashboard', org_id=current_service.organization_id) }}" class="usa-link navigation-organization-link">{{ current_service.organization_name }}</a>
{% endif %}
{% endif %}
<div class="font-body-2xl text-bold">
<span>
{{ current_service.name }}
{% if not current_service.active %}
<span class="navigation-service-name navigation-service-type--suspended">Suspended</span>
{% endif %}
</div>
</span>
<a href="{{ url_for('main.choose_account') }}" class="usa-link">Switch service</a>
</div>
</nav>

View File

@@ -23,8 +23,7 @@
<p>Notify.gov is an easy-to-use, web-based platform. It requires no technical expertise or system integration — users
can create an account and get started within minutes. We take the security and privacy of messaging data seriously
by minimizing data retention and using modern encryption methods.</p>
<!-- add youtube video component here -->
<h2 class="padding-bottom-3">Product Highlights</h2>
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/fkcy_xbo0Bw?si=qNo94BwL4WCeusy5&amp;start=2" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> <h2 class="padding-bottom-3">Product Highlights</h2>
{% set product_highlights = [
{
"svg_src": "#send",

View File

@@ -0,0 +1,25 @@
{% extends "base.html" %}
{% set page_title = "Contact" %}
{% block per_page_title %}{{page_title}}{% endblock %}
{% block content_column_content %}
<section class="usa-prose">
<h1>{{page_title}}</h1>
<p>Is your organization interested in using Notify.gov? Find more information at <a href="/join-notify">Join
Notify</a> or contact us at <a href="mailto:tts-notify@gsa.gov"
aria-label="contact us at tts-notify@gsa.gov">tts-notify@gsa.gov</a>.</p>
<p>You can expect a response within one business day.</p>
<div class="usa-summary-box maxw-tablet __web-inspector-hide-shortcut__" role="region"
aria-label="For partnership inquiries">
<div class="usa-summary-box__body">
<div class="usa-summary-box__text">
<p>If you are a current Notify.gov partner and have technical issues or questions, we are available at <a
href="mailto:notify-support@gsa.gov"
aria-label="Email Notify for technical questions at notify-support@gsa.gov">notify-support@gsa.gov</a></p>
</div>
</div>
</div>
</section>
{% endblock %}

View File

@@ -13,7 +13,7 @@
<script type="text/javascript" src="{{ asset_url('js/setTimezone.js') }}"></script>
<div class="dashboard margin-bottom-2">
<div class="dashboard margin-top-0 margin-bottom-2">
<h1 class="usa-sr-only">Dashboard</h1>
{% if current_user.has_permissions('manage_templates') and not current_service.all_templates %}
@@ -22,7 +22,7 @@
{{ ajax_block(partials, updates_url, 'upcoming') }}
<h2 class="font-body-xl margin-top-0">{{ current_service.name }} Dashboard</h2>
<h2 class="font-body-2xl line-height-sans-2 margin-top-0">{{ current_service.name }} Dashboard</h2>
{{ ajax_block(partials, updates_url, 'inbox') }}

View File

@@ -1,4 +1,6 @@
<h2 class="font-body-lg margin-top-0 margin-bottom-1">Get started</h2>
<a class="usa-button margin-bottom-5" href="{{ url_for('.choose_template', service_id=current_service.id) }}">
Create your first template
</a>
<div class="get-started">
<h2 class="font-body-lg margin-top-0 margin-bottom-2">Get started</h2>
<a class="usa-button" href="{{ url_for('.choose_template', service_id=current_service.id) }}">
Create your first template
</a>
</div>

View File

@@ -10,7 +10,7 @@
{% elif help %}
{{ "Example text message" }}
{% else %}
{{ "Preview" }}
{{ "Preview for sending" }}
{% endif %}
{% endblock %}
@@ -50,7 +50,7 @@
{% endcall %}
</div>
{% else %}
{{ page_header("Example text message" if help else "Preview") }}
{{ page_header("Example text message" if help else "Preview for sending") }}
{% endif %}
{% if not help %}

View File

@@ -1,4 +1,4 @@
{% from "components/folder-path.html" import folder_path, page_title_folder_path %}
{% from "components/folder-path.html" import folder_path %}
{% from "components/pill.html" import pill %}
{% from "components/live-search.html" import live_search %}
{% from "components/form.html" import form_wrapper %}
@@ -8,11 +8,9 @@
{% extends "withnav_template.html" %}
{% set page_title = 'Templates' %}
{% set page_title = 'Select or create a template' %}
{% block service_page_title %}
{{ page_title_folder_path(template_folder_path) }}
{% endblock %}
{% block service_page_title %}{{page_title}}{% endblock %}
{% block maincolumn_content %}
@@ -34,14 +32,11 @@
{% else %}
<div class="grid-row flex-column">
<h1 class="font-body-2xl line-height-sans-2 margin-bottom-1 margin-top-0">{{page_title}}</h1>
<div class="{% if current_user.has_permissions('manage_templates') %} grid-col-10 {% else %} grid-col-12 {% endif %}">
<div class="usa-alert usa-alert--slim usa-alert--info">
<div class="usa-alert__body">
<p class="usa-alert__text">
Every message starts with a template. To send, choose or create a template.
</p>
</div>
</div>
<p class="margin-top-0 margin-bottom-4">
Every message starts with a template. To send, choose or create a template.
</p>
{{ folder_path(
folders=template_folder_path,
service_id=current_service.id,

View File

@@ -3,9 +3,9 @@
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% block service_page_title %}
{{ page_title_folder_path(template_folder_path) }}
{% endblock %}
{% set page_title = 'Select or create a template' %}
{% block service_page_title %}{{page_title}}{% endblock %}
{% block maincolumn_content %}

View File

@@ -1,13 +1,13 @@
{% extends "withnav_template.html" %}
{% from "components/banner.html" import banner_wrapper %}
{% from "components/folder-path.html" import folder_path, page_title_folder_path %}
{% from "components/folder-path.html" import folder_path %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/copy-to-clipboard.html" import copy_to_clipboard %}
{% from "components/components/button/macro.njk" import usaButton %}
{% block service_page_title %}
{{ page_title_folder_path(current_service.get_template_path(template._template)) }}
{% endblock %}
{% set page_title = 'Confirm your template' %}
{% block service_page_title %}{{page_title}}{% endblock %}
{% block maincolumn_content %}
@@ -32,8 +32,8 @@
{% else %}
<div class="grid-row">
<div class="grid-col-12">
<h1 class="font-body-xl folder-heading margin-top-0">
Review your message
<h1 class="font-body-2xl line-height-sans-2 folder-heading margin-top-0">
{{page_title}}
</h1>
{{ folder_path(
folders=current_service.get_template_path(template._template),

View File

@@ -1,12 +1,7 @@
{% extends "base.html" %}
{% block per_page_title %}
{% if current_org.name %}
{% block org_page_title %}{% endblock %} {{ current_org.name }}
{% else %}
{% block service_page_title %}{% endblock %} {{ current_service.name }}
{% endif %}
{% endblock %}
{% block per_page_title %}{% if current_org.name %}{% block org_page_title %}{% endblock %} {{ current_org.name }}{%
else %}{% block service_page_title %}{% endblock %} {{ current_service.name }}{% endif %}{% endblock %}
{% block main %}
<div class="grid-container">

View File

@@ -269,7 +269,7 @@ def test_invite_goes_in_session(
("user", "landing_page_title"),
[
(create_active_user_with_permissions(), "Dashboard"),
(create_active_caseworking_user(), "Templates"),
(create_active_caseworking_user(), "Select or create a template"),
],
)
def test_accepting_invite_removes_invite_from_session(

View File

@@ -1253,7 +1253,7 @@ def test_send_one_off_has_correct_page_title(
step_index=0,
_follow_redirects=True,
)
assert page.h1.text.strip() == "Send Two week reminder"
assert page.h1.text.strip() == "Select recipients"
assert len(page.select(".banner-tour")) == 0
@@ -2712,7 +2712,7 @@ def test_preview_notification_shows_preview(
template_id=fake_uuid,
_expected_status=200,
)
assert page.h1.text.strip() == "Preview"
assert page.h1.text.strip() == "Preview for sending"
assert (page.find_all("a", {"class": "usa-back-link"})[0]["href"]) == url_for(
"main.check_notification",
service_id=service_one["id"],

View File

@@ -41,8 +41,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
@pytest.mark.parametrize(
(
"expected_title_tag",
"expected_page_title",
"expected_title_tag",
"expected_parent_link_args",
"extra_args",
"expected_nav_links",
@@ -53,8 +53,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
),
[
(
"Templates service one Notify.gov",
"Templates",
"Select or create a template service one Notify.gov",
"Select or create a template",
[],
{},
["Email", "Text message"],
@@ -92,8 +92,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
None,
),
(
"Templates service one Notify.gov",
"Templates",
"Select or create a template service one Notify.gov",
"Select or create a template",
[],
{"template_type": "all"},
["Email", "Text message"],
@@ -131,8 +131,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
None,
),
(
"Templates service one Notify.gov",
"Templates",
"Select or create a template service one Notify.gov",
"Select or create a template",
[],
{"template_type": "sms"},
["All", "Email"],
@@ -159,8 +159,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
None,
),
(
"folder_one Templates service one Notify.gov",
"Templates folder_one",
"Select or create a template service one Notify.gov",
"Select or create a template",
[{"template_type": "all"}],
{"template_folder_id": PARENT_FOLDER_ID},
["Email", "Text message"],
@@ -182,8 +182,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
None,
),
(
"folder_one Templates service one Notify.gov",
"Templates folder_one",
"Select or create a template service one Notify.gov",
"Select or create a template",
[{"template_type": "sms"}],
{"template_type": "sms", "template_folder_id": PARENT_FOLDER_ID},
["All", "Email"],
@@ -199,8 +199,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
None,
),
(
"folder_one Templates service one Notify.gov",
"Templates folder_one",
"Select or create a template service one Notify.gov",
"Select or create a template",
[{"template_type": "email"}],
{"template_type": "email", "template_folder_id": PARENT_FOLDER_ID},
["All", "Text message"],
@@ -210,8 +210,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
"There are no email templates in this folder",
),
(
"folder_one_one folder_one Templates service one Notify.gov",
"Templates folder_one folder_one_one",
"Select or create a template service one Notify.gov",
"Select or create a template",
[
{"template_type": "all"},
{"template_type": "all", "template_folder_id": PARENT_FOLDER_ID},
@@ -229,8 +229,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
None,
),
(
"folder_one_one_one folder_one_one folder_one Templates service one Notify.gov",
"Templates folder_one folder_one_one folder_one_one_one",
"Select or create a template service one Notify.gov",
"Select or create a template",
[
{"template_type": "all"},
{"template_type": "all", "template_folder_id": PARENT_FOLDER_ID},
@@ -250,8 +250,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
None,
),
(
"folder_one_one_one folder_one_one folder_one Templates service one Notify.gov",
"Templates folder_one folder_one_one folder_one_one_one",
"Select or create a template service one Notify.gov",
"Select or create a template",
[
{"template_type": "email"},
{"template_type": "email", "template_folder_id": PARENT_FOLDER_ID},
@@ -268,8 +268,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
"There are no email templates in this folder",
),
(
"folder_two Templates service one Notify.gov",
"Templates folder_two",
"Select or create a template service one Notify.gov",
"Select or create a template",
[{"template_type": "all"}],
{"template_folder_id": FOLDER_TWO_ID},
["Email", "Text message"],
@@ -279,8 +279,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
"This folder is empty",
),
(
"folder_two Templates service one Notify.gov",
"Templates folder_two",
"Select or create a template service one Notify.gov",
"Select or create a template",
[{"template_type": "sms"}],
{"template_folder_id": FOLDER_TWO_ID, "template_type": "sms"},
["All", "Email"],
@@ -290,8 +290,8 @@ def _folder(name, folder_id=None, parent=None, users_with_permission=None):
"This folder is empty",
),
(
"folder_two Templates service one Notify.gov",
"Templates folder_two",
"Select or create a template service one Notify.gov",
"Select or create a template",
[{"template_type": "all"}],
{"template_folder_id": FOLDER_TWO_ID, "template_type": "all"},
["Email", "Text message"],
@@ -346,12 +346,13 @@ def test_should_show_templates_folder_page(
**extra_args,
)
assert normalize_spaces(page.select_one("title").text) == expected_title_tag
assert normalize_spaces(page.select_one("h1").text) == expected_page_title
assert normalize_spaces(page.select_one("title").text) == expected_page_title
assert normalize_spaces(page.select_one("h1").text) == expected_title_tag
assert len(page.select("h1 a")) == len(expected_parent_link_args)
# remove this line if you don't want the breadcrumb on the first page
assert len(page.select("nav#breadcrumb-template-folders a")) == len(expected_parent_link_args)
for index, parent_link in enumerate(page.select("h1 a")):
for index, parent_link in enumerate(page.select("nav#breadcrumb-template-folders a")):
assert parent_link["href"] == url_for(
"main.choose_template",
service_id=SERVICE_ONE_ID,
@@ -529,7 +530,7 @@ def test_get_manage_folder_page(
_test_page_title=False,
)
assert normalize_spaces(page.select_one("title").text) == (
"folder_two Templates service one Notify.gov"
"Select or create a template service one Notify.gov"
)
assert page.select_one("input[name=name]")["value"] == "folder_two"
delete_link = page.find("a", string="Delete this folder")
@@ -571,7 +572,7 @@ def test_get_manage_folder_viewing_permissions_for_users(
_test_page_title=False,
)
assert normalize_spaces(page.select_one("title").text) == (
"folder_two Templates service one Notify.gov"
"Select or create a template service one Notify.gov"
)
form_labels = page.select("legend.usa-legend")
assert (
@@ -634,7 +635,7 @@ def test_get_manage_folder_viewing_permissions_for_users_not_visible_when_no_man
_test_page_title=False,
)
assert normalize_spaces(page.select_one("title").text) == (
"folder_two Templates service one Notify.gov"
"Select or create a template service one Notify.gov"
)
form_labels = page.select("legend[class=form-label]")
assert len(form_labels) == 0
@@ -671,7 +672,7 @@ def test_get_manage_folder_viewing_permissions_for_users_not_visible_for_service
_test_page_title=False,
)
assert normalize_spaces(page.select_one("title").text) == (
"folder_two Templates service one Notify.gov"
"Select or create a template service one Notify.gov"
)
form_labels = page.select("legend[class=form-label]")
assert len(form_labels) == 0

View File

@@ -69,7 +69,7 @@ def test_should_show_empty_page_when_no_templates(
service_id=service_one["id"],
)
assert normalize_spaces(page.select_one("h1").text) == ("Templates")
assert normalize_spaces(page.select_one("h1").text) == ("Select or create a template")
assert normalize_spaces(page.select_one("main p").text) == (expected_message)
assert page.select_one("#add_new_folder_form")
assert page.select_one("#add_new_template_form")
@@ -87,7 +87,7 @@ def test_should_show_add_template_form_if_service_has_folder_permission(
service_id=service_one["id"],
)
assert normalize_spaces(page.select_one("h1").text) == ("Templates")
assert normalize_spaces(page.select_one("h1").text) == ("Select or create a template")
assert normalize_spaces(page.select_one("main p").text) == (
"Every message starts with a template. You can change it later. "
"You need a template before you can send messages."
@@ -110,7 +110,7 @@ def test_should_show_add_template_form_if_service_has_folder_permission(
[
(
create_active_user_view_permissions(),
"Templates",
"Select or create a template",
{},
["Email", "Text message"],
[
@@ -122,21 +122,21 @@ def test_should_show_add_template_form_if_service_has_folder_permission(
),
(
create_active_user_view_permissions(),
"Templates",
"Select or create a template",
{"template_type": "sms"},
["All", "Email"],
["sms_template_one", "sms_template_two"],
),
(
create_active_user_view_permissions(),
"Templates",
"Select or create a template",
{"template_type": "email"},
["All", "Text message"],
["email_template_one", "email_template_two"],
),
(
create_active_caseworking_user(),
"Templates",
"Select or create a template",
{},
["Email", "Text message"],
[
@@ -148,7 +148,7 @@ def test_should_show_add_template_form_if_service_has_folder_permission(
),
(
create_active_caseworking_user(),
"Templates",
"Select or create a template",
{"template_type": "email"},
["All", "Text message"],
["email_template_one", "email_template_two"],
@@ -581,9 +581,9 @@ def test_should_be_able_to_view_a_template_with_links(
_test_page_title=False,
)
assert normalize_spaces(page.select_one("h1").text) == ("Review your message")
assert normalize_spaces(page.select_one("h1").text) == ("Confirm your template")
assert normalize_spaces(page.select_one("title").text) == (
"Two week reminder Templates service one Notify.gov"
"Confirm your template service one Notify.gov"
)
assert [

View File

@@ -62,6 +62,7 @@ EXCLUDED_ENDPOINTS = tuple(
"conversation_reply",
"conversation_reply_with_template",
"conversation_updates",
"contact",
"copy_template",
"count_content_length",
"create_and_send_messages",

View File

@@ -26,149 +26,24 @@ def test_landing_page(end_to_end_context):
name="Reach people where they are with government-powered text messages",
)
sign_in_button = page.get_by_role("link", name="Sign in with")
benefits_studio_email = page.get_by_role("link", name="tts-benefits-studio@gsa.gov")
# Check to make sure the elements are visible.
expect(main_header).to_be_visible()
expect(sign_in_button).to_be_visible()
expect(benefits_studio_email).to_be_visible()
# Check to make sure the sign-in button and email links are correct.
href_value = sign_in_button.get_attribute("href")
assert href_value is not None, "The sign-in button does not have an href attribute"
expect(benefits_studio_email).to_have_attribute(
"href", "mailto:tts-benefits-studio@gsa.gov"
)
# Retrieve all other main content headers and check that they're
# visible.
content_headers = [
"Control your content",
"See how your messages perform",
"No technical integration needed",
"About the product",
"Government texting made easy",
"Key features",
"Who can use Notify.gov",
]
for content_header in content_headers:
expect(
page.get_by_role("heading", name=re.compile(content_header))
).to_be_visible()
# def test_sign_in_and_mfa_pages(end_to_end_context):
# # Open a new page and go to the staging site.
# page = end_to_end_context.new_page()
# page.goto(f"{E2E_TEST_URI}/")
# print(f"test_sign_in_and_mfa_pages initial {page}")
#
# sign_in_button = page.get_by_role("link", name="Sign in")
#
# # Test trying to sign in.
# sign_in_button.click()
#
# # Check to make sure that we've arrived at the next page.
# page.wait_for_load_state("domcontentloaded")
#
# # Check the page title exists and matches what we expect.
# expect(page).to_have_title(re.compile("Sign in"))
#
# # Check for the sign in heading.
# sign_in_heading = page.get_by_role("heading", name="Sign in")
# expect(sign_in_heading).to_be_visible()
#
# # Check for the sign in form elements.
# # NOTE: Playwright cannot find input elements by role and recommends using
# # get_by_label() instead; however, hidden form elements do not have
# # labels associated with them, hence the XPath!
# # See https://playwright.dev/python/docs/api/class-page#page-get-by-label
# # and https://playwright.dev/python/docs/locators#locate-by-css-or-xpath
# # for more information.
# email_address_input = page.get_by_label("Email address")
# password_input = page.get_by_label("Password")
# csrf_token = page.locator('xpath=//input[@name="csrf_token"]')
# continue_button = page.get_by_role("button", name=re.compile("Continue"))
# forgot_password_link = page.get_by_role("link", name="Forgot your password?")
#
# # Make sure form elements are visible and not visible as expected.
# expect(email_address_input).to_be_visible()
# expect(password_input).to_be_visible()
# expect(continue_button).to_be_visible()
# expect(forgot_password_link).to_be_visible()
#
# expect(csrf_token).to_be_hidden()
#
# # Make sure form elements are configured correctly with the right
# # attributes.
# expect(email_address_input).to_have_attribute("type", "email")
# expect(password_input).to_have_attribute("type", "password")
# expect(csrf_token).to_have_attribute("type", "hidden")
# expect(continue_button).to_have_attribute("type", "submit")
# expect(forgot_password_link).to_have_attribute("href", "/forgot-password")
#
# # Sign in to the site.
# email_address_input.fill(os.getenv("NOTIFY_E2E_TEST_EMAIL"))
# password_input.fill(os.getenv("NOTIFY_E2E_TEST_PASSWORD"))
# print(f"email and password {os.getenv('NOTIFY_E2E_TEST_EMAIL')} {os.getenv('NOTIFY_E2E_TEST_PASSWORD')}")
# continue_button.click()
#
# # Wait for the next page to fully load.
# page.wait_for_load_state("domcontentloaded")
#
# # Check the page title exists and matches what we expect.
# print(f"test_sign_in_and_mfa_pages finally is {page}")
# expect(page).to_have_title(re.compile("Check your phone"))
#
# # Check for the sign in heading.
# sign_in_heading = page.get_by_role("heading", name="Check your phone")
# expect(sign_in_heading).to_be_visible()
#
# # Check for the sign in form elements.
# # NOTE: Playwright cannot find input elements by role and recommends using
# # get_by_label() instead; however, hidden form elements do not have
# # labels associated with them, hence the XPath!
# # See https://playwright.dev/python/docs/api/class-page#page-get-by-label
# # and https://playwright.dev/python/docs/locators#locate-by-css-or-xpath
# # for more information.
# mfa_input = page.get_by_label("Text message code")
# csrf_token = page.locator('xpath=//input[@name="csrf_token"]')
# continue_button = page.get_by_role("button", name=re.compile("Continue"))
# not_received_message_link = page.get_by_role(
# "link", name="Not received a text message?"
# )
#
# # Make sure form elements are visible and not visible as expected.
# expect(mfa_input).to_be_visible()
# expect(continue_button).to_be_visible()
# expect(not_received_message_link).to_be_visible()
#
# expect(csrf_token).to_be_hidden()
#
# # Make sure form elements are configured correctly with the right
# # attributes.
# expect(mfa_input).to_have_attribute("type", "tel")
# expect(mfa_input).to_have_attribute("pattern", "[0-9]*")
# expect(csrf_token).to_have_attribute("type", "hidden")
# expect(continue_button).to_have_attribute("type", "submit")
# expect(not_received_message_link).to_have_attribute("href", "/text-not-received")
#
# # Enter MFA code and continue.
# # TODO: Revisit this at a later point in time.
# # totp = pyotp.TOTP(
# # os.getenv('MFA_TOTP_SECRET'),
# # digits=int(os.getenv('MFA_TOTP_LENGTH'))
# # )
#
# # mfa_input.fill('totp.now()')
# # continue_button.click()
#
# # # Check to make sure that we've arrived at the next page.
# # page.wait_for_load_state('domcontentloaded')
#
# # # Check that no MFA code error happened.
# # code_not_found_error = page.get_by_text('Code not found')
# # expect(code_not_found_error).to_have_count(0)
#
# # # Check the page title exists and matches what we expect.
# # # This could be either the Dashboard of a service if there is only
# # # one, or choosing a service if there are multiple.
# # expect(page).to_have_title(re.compile('Dashboard|Choose service'))