mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-27 11:19:21 -04:00
Merge branch 'main' into 1928-develop-new-page-templates-in-code-to-sit-behind-the-log-in
This commit is contained in:
@@ -34,4 +34,5 @@ def check_axe_report(page):
|
||||
for violation in results["violations"]:
|
||||
assert violation["impact"] in [
|
||||
"minor",
|
||||
"moderate",
|
||||
], f"Accessibility violation: {violation}"
|
||||
|
||||
@@ -85,16 +85,19 @@ 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")
|
||||
check_axe_report(page)
|
||||
|
||||
page.click("text='Delete this service'")
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
page.click("text='Yes, delete'")
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# Check the page title exists and matches what we expect.
|
||||
|
||||
@@ -5,6 +5,8 @@ import uuid
|
||||
|
||||
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")
|
||||
|
||||
|
||||
@@ -16,6 +18,7 @@ def create_new_template(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
send_messages_button = page.get_by_role("link", name="Send messages")
|
||||
expect(send_messages_button).to_be_visible()
|
||||
@@ -23,6 +26,7 @@ def create_new_template(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
create_template_button = page.get_by_role("button", name="New template")
|
||||
expect(create_template_button).to_be_visible()
|
||||
@@ -30,6 +34,7 @@ def create_new_template(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
start_with_a_blank_template_radio = page.get_by_text("Start with a blank template")
|
||||
expect(start_with_a_blank_template_radio).to_be_visible()
|
||||
@@ -43,6 +48,7 @@ def create_new_template(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
template_name_input = page.get_by_text("Template name")
|
||||
expect(template_name_input).to_be_visible()
|
||||
@@ -59,6 +65,7 @@ def create_new_template(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
use_this_template_button = page.get_by_text("Use this template")
|
||||
expect(use_this_template_button).to_be_visible()
|
||||
@@ -80,6 +87,7 @@ def create_new_template(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# We are not going to send the message for this test, we just want to confirm
|
||||
# that the template has been created and we are now seeing the message from the
|
||||
@@ -92,6 +100,7 @@ def test_create_new_template(end_to_end_context):
|
||||
page.goto(f"{E2E_TEST_URI}/sign-in")
|
||||
# Wait for the next page to fully load.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
current_date_time = datetime.datetime.now()
|
||||
new_service_name = "E2E Federal Test Service {now} - {browser_type}".format(
|
||||
@@ -102,6 +111,7 @@ def test_create_new_template(end_to_end_context):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# Check the page title exists and matches what we expect.
|
||||
@@ -130,6 +140,7 @@ def test_create_new_template(end_to_end_context):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# Check for the sign in heading.
|
||||
about_heading = page.get_by_role("heading", name="About your service")
|
||||
@@ -150,6 +161,7 @@ def test_create_new_template(end_to_end_context):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# TODO this fails on staging due to duplicate results on 'get_by_text'
|
||||
# Check for the service name title and heading.
|
||||
@@ -168,16 +180,19 @@ def _teardown(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
page.click("text='Delete this service'")
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
page.click("text='Yes, delete'")
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# Check the page title exists and matches what we expect.
|
||||
|
||||
@@ -21,6 +21,7 @@ def _setup(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# Check the page title exists and matches what we expect.
|
||||
@@ -49,6 +50,7 @@ def _setup(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# Check for the sign in heading.
|
||||
about_heading = page.get_by_role("heading", name="About your service")
|
||||
@@ -69,6 +71,7 @@ def _setup(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# TODO this fails on staging due to duplicate results on 'get_by_text'
|
||||
# Check for the service name title and heading.
|
||||
@@ -98,6 +101,7 @@ def test_invite_team_member_to_service(authenticated_page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# Check for invite a team member button
|
||||
invite_team_member_button = page.get_by_role("button", name="Invite a team member")
|
||||
@@ -172,6 +176,7 @@ def _teardown(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# Check the page title exists and matches what we expect.
|
||||
|
||||
@@ -23,6 +23,7 @@ def _setup(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# Check the page title exists and matches what we expect.
|
||||
@@ -72,6 +73,7 @@ def _setup(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# TODO this fails on staging due to duplicate results on 'get_by_text'
|
||||
# Check for the service name title and heading.
|
||||
@@ -174,39 +176,38 @@ def handle_no_existing_template_case(page):
|
||||
check_axe_report(page)
|
||||
|
||||
# TODO staging starts failing here, fix.
|
||||
# dashboard_button = page.get_by_text("Dashboard")
|
||||
# expect(dashboard_button).to_be_visible()
|
||||
# dashboard_button.click()
|
||||
activity_button = page.get_by_text("Activity")
|
||||
expect(activity_button).to_be_visible()
|
||||
activity_button.click()
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# download_link = page.get_by_text("Download")
|
||||
# expect(download_link).to_be_visible()
|
||||
download_link = page.get_by_text("Download all data last 7 days (CSV)")
|
||||
expect(download_link).to_be_visible()
|
||||
|
||||
# Start waiting for the download
|
||||
# with page.expect_download() as download_info:
|
||||
# download_link.click()
|
||||
# download = download_info.value
|
||||
# download.save_as("download_test_file")
|
||||
# f = open("download_test_file", "r")
|
||||
with page.expect_download() as download_info:
|
||||
download_link.click()
|
||||
download = download_info.value
|
||||
download.save_as("download_test_file")
|
||||
f = open("download_test_file", "r")
|
||||
|
||||
# content = f.read()
|
||||
# f.close()
|
||||
# We don't want to wait 5 minutes to get a response from AWS about the message we sent
|
||||
# So we are using this invalid phone number the e2e_test_user signed up with (12025555555)
|
||||
# to shortcircuit the sending process. Our phone number validator will insta-fail the
|
||||
# message and it won't be sent, but the report will still be generated, which is all
|
||||
# we care about here.
|
||||
# assert (
|
||||
# "Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time"
|
||||
# in content
|
||||
# )
|
||||
# assert "12025555555" in content
|
||||
# assert "one-off-" in content
|
||||
# os.remove("download_test_file")
|
||||
content = f.read()
|
||||
f.close()
|
||||
# We don't want to wait 5 minutes to get a response from AWS about the message we sent
|
||||
# So we are using this invalid phone number the e2e_test_user signed up with (12025555555)
|
||||
# to shortcircuit the sending process. Our phone number validator will insta-fail the
|
||||
# message and it won't be sent, but the report will still be generated, which is all
|
||||
# we care about here.
|
||||
assert (
|
||||
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time"
|
||||
in content
|
||||
)
|
||||
assert "12025555555" in content
|
||||
assert "one-off-" in content
|
||||
os.remove("download_test_file")
|
||||
|
||||
|
||||
def handle_existing_template_case(page):
|
||||
@@ -287,44 +288,46 @@ def handle_existing_template_case(page):
|
||||
|
||||
send_button = page.get_by_role("button", name="Send")
|
||||
expect(send_button).to_be_visible()
|
||||
# send_button.click()
|
||||
send_button.click()
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# page.wait_for_load_state("domcontentloaded")
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# dashboard_button = page.get_by_text("Dashboard")
|
||||
# expect(dashboard_button).to_be_visible()
|
||||
# dashboard_button.click()
|
||||
dashboard_button = page.get_by_text("Dashboard")
|
||||
expect(dashboard_button).to_be_visible()
|
||||
dashboard_button.click()
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# page.wait_for_load_state("domcontentloaded")
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
# download_link = page.get_by_text("Download")
|
||||
# expect(download_link).to_be_visible()
|
||||
download_link = page.get_by_text("Download")
|
||||
expect(download_link).to_be_visible()
|
||||
|
||||
# Start waiting for the download
|
||||
# with page.expect_download() as download_info:
|
||||
# Perform the action that initiates download
|
||||
# download_link.click()
|
||||
# download = download_info.value
|
||||
# Wait for the download process to complete and save the downloaded file somewhere
|
||||
# download.save_as("download_test_file")
|
||||
# f = open("download_test_file", "r")
|
||||
with page.expect_download() as download_info:
|
||||
# Perform the action that initiates download
|
||||
download_link.click()
|
||||
download = download_info.value
|
||||
# Wait for the download process to complete and save the downloaded file somewhere
|
||||
download.save_as("download_test_file")
|
||||
f = open("download_test_file", "r")
|
||||
|
||||
# content = f.read()
|
||||
# f.close()
|
||||
# We don't want to wait 5 minutes to get a response from AWS about the message we sent
|
||||
# So we are using this invalid phone number the e2e_test_user signed up with (12025555555)
|
||||
# to shortcircuit the sending process. Our phone number validator will insta-fail the
|
||||
# message and it won't be sent, but the report will still be generated, which is all
|
||||
# we care about here.
|
||||
# assert (
|
||||
# "Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time"
|
||||
# in content
|
||||
# )
|
||||
# assert "12025555555" in content
|
||||
# assert "one-off-e2e_test_user" in content
|
||||
# os.remove("download_test_file")
|
||||
content = f.read()
|
||||
f.close()
|
||||
# We don't want to wait 5 minutes to get a response from AWS about the message we sent
|
||||
# So we are using this invalid phone number the e2e_test_user signed up with (12025555555)
|
||||
# to shortcircuit the sending process. Our phone number validator will insta-fail the
|
||||
# message and it won't be sent, but the report will still be generated, which is all
|
||||
# we care about here.
|
||||
assert (
|
||||
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time"
|
||||
in content
|
||||
)
|
||||
assert "12025555555" in content
|
||||
assert "one-off-e2e_test_user" in content
|
||||
os.remove("download_test_file")
|
||||
|
||||
|
||||
def test_send_message_from_existing_template(authenticated_page):
|
||||
@@ -351,6 +354,7 @@ def _teardown(page):
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
check_axe_report(page)
|
||||
|
||||
page.click("text='Yes, delete'")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user