From 5e98ec396efcc7ad6a0bf782d585e839deab6d6f Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Wed, 19 Jun 2024 13:59:39 -0700 Subject: [PATCH 1/8] made changes/fixes to tour flow --- app/assets/sass/uswds/_legacy-styles.scss | 4 +++ app/main/views/tour.py | 2 +- .../views/notifications/preview.html | 32 +++++++++++++------ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/app/assets/sass/uswds/_legacy-styles.scss b/app/assets/sass/uswds/_legacy-styles.scss index 0f16e8861..bae05d457 100644 --- a/app/assets/sass/uswds/_legacy-styles.scss +++ b/app/assets/sass/uswds/_legacy-styles.scss @@ -66,6 +66,10 @@ h2.sms-message-header { margin-bottom: 0.5rem; } +.usa-prose >*+ h2.message-header { + margin-top: 1em; +} + h2.recipient-list { margin-bottom: 0.5rem; } diff --git a/app/main/views/tour.py b/app/main/views/tour.py index 3a93b7384..7e673c886 100644 --- a/app/main/views/tour.py +++ b/app/main/views/tour.py @@ -195,7 +195,7 @@ def check_tour_notification(service_id, template_id): ) return render_template( - "views/notifications/check.html", + "views/notifications/preview.html", template=template, back_link=back_link, help="2", diff --git a/app/templates/views/notifications/preview.html b/app/templates/views/notifications/preview.html index ce94a606f..df0951980 100644 --- a/app/templates/views/notifications/preview.html +++ b/app/templates/views/notifications/preview.html @@ -9,7 +9,11 @@ {% endblock %} {% block backLink %} - {{ usaBackLink({ "href": back_link_from_preview }) }} + {% if help %} + {{ usaBackLink({ "href": back_link }) }} + {% else %} + {{ usaBackLink({ "href": back_link_from_preview }) }} + {% endif %} {% endblock %} {% block maincolumn_content %} @@ -40,16 +44,26 @@ {% endcall %} {% else %} - {{ page_header('Preview') }} + {% if not help %} + {{ page_header('Preview') }} + {% endif %} + {% endif %} + {% if not help %} +
+

Scheduled: {{ scheduled_for |format_datetime_scheduled_notification if scheduled_for else 'Now'}}

+

Template: {{template.name}}

+

From: {{ template.sender }}

+

To: {{ recipient }}

+
{% endif %} -
-

Scheduled: {{ scheduled_for |format_datetime_scheduled_notification if scheduled_for else 'Now'}}

-

Template: {{template.name}}

-

From: {{ template.sender }}

-

To: {{ recipient }}

-
-

Message

+ {% if help %} +

Example text message

+ {% else %} +

Message

+ {% endif %} + +
{{ template|string }}
From 44baaf665a86369ef30615203022e3ae7ca81090 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Mon, 24 Jun 2024 15:33:48 -0700 Subject: [PATCH 2/8] fixed testing --- app/main/views/tour.py | 2 +- app/templates/views/notifications/preview.html | 17 ++++++++++------- tests/app/main/views/test_tour.py | 8 +++++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/main/views/tour.py b/app/main/views/tour.py index 7e673c886..0e4b5f344 100644 --- a/app/main/views/tour.py +++ b/app/main/views/tour.py @@ -198,7 +198,7 @@ def check_tour_notification(service_id, template_id): "views/notifications/preview.html", template=template, back_link=back_link, - help="2", + help="3", ) diff --git a/app/templates/views/notifications/preview.html b/app/templates/views/notifications/preview.html index df0951980..5c702a386 100644 --- a/app/templates/views/notifications/preview.html +++ b/app/templates/views/notifications/preview.html @@ -5,7 +5,13 @@ {% from "components/components/button/macro.njk" import usaButton %} {% block service_page_title %} - {{ "Error" if error else "Preview" }} + {% if error %} + {{ "Error" }} + {% elif help %} + {{ "Example text message" }} + {% else %} + {{ "Preview" }} + {% endif %} {% endblock %} {% block backLink %} @@ -44,10 +50,9 @@ {% endcall %}
{% else %} - {% if not help %} - {{ page_header('Preview') }} - {% endif %} + {{ page_header("Example text message" if help else "Preview") }} {% endif %} + {% if not help %}

Scheduled: {{ scheduled_for |format_datetime_scheduled_notification if scheduled_for else 'Now'}}

@@ -57,9 +62,7 @@
{% endif %} - {% if help %} -

Example text message

- {% else %} + {% if not help %}

Message

{% endif %} diff --git a/tests/app/main/views/test_tour.py b/tests/app/main/views/test_tour.py index 749a8097f..4b4aa31f1 100644 --- a/tests/app/main/views/test_tour.py +++ b/tests/app/main/views/test_tour.py @@ -530,10 +530,11 @@ def test_should_200_for_check_tour_notification( assert normalize_spaces(page.select(".banner-tour .heading-medium")[0].text) == ( "Try sending yourself this example" ) - selected_hint = page.select(".banner-tour .grid-row")[1] + selected_hint = page.select(".banner-tour .grid-row")[2] selected_hint_text = normalize_spaces(selected_hint.select(".usa-body")[0].text) + print(selected_hint_text) assert "greyed-out-step" not in selected_hint["class"] - assert selected_hint_text == "The template pulls in the data you provide" + assert selected_hint_text == "Notify delivers the message" assert normalize_spaces(page.select(".sms-message-recipient")[0].text) == ( "To: 202-867-5303" @@ -544,9 +545,10 @@ def test_should_200_for_check_tour_notification( # post to send_notification keeps help argument assert page.form.attrs["action"] == url_for( - "main.preview_notification", + "main.send_notification", service_id=SERVICE_ONE_ID, template_id=fake_uuid, + help=3, ) From e72af9671b7f7f0053ab070afcaa3175ddd549f7 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Mon, 24 Jun 2024 16:54:31 -0700 Subject: [PATCH 3/8] removed print --- tests/app/main/views/test_tour.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/app/main/views/test_tour.py b/tests/app/main/views/test_tour.py index 4b4aa31f1..2916d0887 100644 --- a/tests/app/main/views/test_tour.py +++ b/tests/app/main/views/test_tour.py @@ -532,7 +532,6 @@ def test_should_200_for_check_tour_notification( ) selected_hint = page.select(".banner-tour .grid-row")[2] selected_hint_text = normalize_spaces(selected_hint.select(".usa-body")[0].text) - print(selected_hint_text) assert "greyed-out-step" not in selected_hint["class"] assert selected_hint_text == "Notify delivers the message" From 6e5ca9464323155c193440318eb5dd577e5547cd Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Wed, 26 Jun 2024 16:52:23 -0700 Subject: [PATCH 4/8] commented out get_by_text_ preview --- .../test_send_message_from_existing_template.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/end_to_end/test_send_message_from_existing_template.py b/tests/end_to_end/test_send_message_from_existing_template.py index 56ced9b62..7b5a64ac4 100644 --- a/tests/end_to_end/test_send_message_from_existing_template.py +++ b/tests/end_to_end/test_send_message_from_existing_template.py @@ -256,12 +256,12 @@ def handle_existing_template_case(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") - preview_button = page.get_by_text("Preview") - expect(preview_button).to_be_visible() - preview_button.click() + # preview_button = page.get_by_text("Preview") + # expect(preview_button).to_be_visible() + # preview_button.click() - # Check to make sure that we've arrived at the next page. - page.wait_for_load_state("domcontentloaded") + # # Check to make sure that we've arrived at the next page. + # page.wait_for_load_state("domcontentloaded") send_button = page.get_by_role("button", name="Send") expect(send_button).to_be_visible() From 83d3b1684fe1c50c427f3433b0889f40d729174c Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Wed, 26 Jun 2024 16:59:12 -0700 Subject: [PATCH 5/8] removed commented preview button --- tests/end_to_end/test_accounts_page.py | 2 ++ .../end_to_end/test_send_message_from_existing_template.py | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/end_to_end/test_accounts_page.py b/tests/end_to_end/test_accounts_page.py index b6fe8c5ac..591c3eb7c 100644 --- a/tests/end_to_end/test_accounts_page.py +++ b/tests/end_to_end/test_accounts_page.py @@ -21,6 +21,8 @@ def test_add_new_service_workflow(authenticated_page, end_to_end_context): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + print(page.url) + print(page.title()) # Check to make sure that we've arrived at the next page. # Check the page title exists and matches what we expect. diff --git a/tests/end_to_end/test_send_message_from_existing_template.py b/tests/end_to_end/test_send_message_from_existing_template.py index 7b5a64ac4..53b98be55 100644 --- a/tests/end_to_end/test_send_message_from_existing_template.py +++ b/tests/end_to_end/test_send_message_from_existing_template.py @@ -256,12 +256,6 @@ def handle_existing_template_case(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") - # preview_button = page.get_by_text("Preview") - # expect(preview_button).to_be_visible() - # preview_button.click() - - # # Check to make sure that we've arrived at the next page. - # page.wait_for_load_state("domcontentloaded") send_button = page.get_by_role("button", name="Send") expect(send_button).to_be_visible() From abb011fcb680e7aa2341fe5950c0d68043195208 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Wed, 26 Jun 2024 17:00:00 -0700 Subject: [PATCH 6/8] removed print statements --- tests/end_to_end/test_accounts_page.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/end_to_end/test_accounts_page.py b/tests/end_to_end/test_accounts_page.py index 591c3eb7c..b6fe8c5ac 100644 --- a/tests/end_to_end/test_accounts_page.py +++ b/tests/end_to_end/test_accounts_page.py @@ -21,8 +21,6 @@ def test_add_new_service_workflow(authenticated_page, end_to_end_context): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") - print(page.url) - print(page.title()) # Check to make sure that we've arrived at the next page. # Check the page title exists and matches what we expect. From 4fe3e54dd0f01ce499c9649e1bd24b30e8121ab5 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Wed, 26 Jun 2024 17:04:19 -0700 Subject: [PATCH 7/8] removed blank statements --- tests/end_to_end/test_send_message_from_existing_template.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/end_to_end/test_send_message_from_existing_template.py b/tests/end_to_end/test_send_message_from_existing_template.py index 53b98be55..27aa0a08e 100644 --- a/tests/end_to_end/test_send_message_from_existing_template.py +++ b/tests/end_to_end/test_send_message_from_existing_template.py @@ -256,7 +256,6 @@ def handle_existing_template_case(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") - send_button = page.get_by_role("button", name="Send") expect(send_button).to_be_visible() # send_button.click() From bd3e8e15c80609c524e53dde1b9b8a0ec5911121 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 2 Jul 2024 15:55:10 -0700 Subject: [PATCH 8/8] revised e2e --- .../test_send_message_from_existing_template.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/end_to_end/test_send_message_from_existing_template.py b/tests/end_to_end/test_send_message_from_existing_template.py index 27aa0a08e..ef083ea14 100644 --- a/tests/end_to_end/test_send_message_from_existing_template.py +++ b/tests/end_to_end/test_send_message_from_existing_template.py @@ -256,6 +256,15 @@ def handle_existing_template_case(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + if "/tour" not in page.url: + # Only execute this part if the current page is not the /tour page + preview_button = page.get_by_text("Preview") + expect(preview_button).to_be_visible() + preview_button.click() + + # Check to make sure that we've arrived at the next page. + page.wait_for_load_state("domcontentloaded") + send_button = page.get_by_role("button", name="Send") expect(send_button).to_be_visible() # send_button.click()