mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 08:44:23 -04:00
Removed all govuk css (#2814)
* Removed all govuk css * Updated reference files * Removing govuk js * Fixed casing for modules, removed unused page * Got more reference images * Updated template page * Removed govuk padding util * Updated hint to uswds hint * More govuk cleanup * Commiting backstopjs ref files * Fixed all unit tests that broke due to brittleness around govuk styling * Added new ref images * Final removal of govuk * Officially removed all govuk references * Updated reference file * Updated link to button * UI modernization * Cleanup * removed govuk escaping tests since they are no longer needed * Fix CodeQL security issue in escapeElementName function - Escape backslashes first before other special characters - Prevents potential double-escaping vulnerability - Addresses CodeQL alert about improper string escaping * Found more govuk removal. Fixed unit tests * Add missing pipeline check to pre-commit * updated test * Updated e2e test * More update to e2e test * Fixed another e2e test * Simple PR comments addressed * More updates * Updated backstop ref files * Refactored folder selection for non-admins * Updated redundant line * Updated tests to include correct mocks * Added more ref files * Addressing carlos comments * Addressing Carlo comments, cleanup of window initing * More cleanup and addressing carlo comments * Fixing a11 scan * Fixed a few issues with javascript * Fixed for pr * Fixing e2e tests * Tweaking e2e test * Added more ref files and cleaned up urls.js * Fixed bug with creating new template * Removed brittle test - addressed code ql comment * e2e race condition fix * More e2e test fixes * Updated e2e tests to not wait for text sent * Updated test to not wait for button click response * Made tear down more resilent if staging is down * reverted e2e test to what was working before main merge * Updated backstopRef images * Updated gulp to include job-polling differently
This commit is contained in:
@@ -393,8 +393,8 @@ def test_should_not_allow_files_to_be_uploaded_without_the_correct_permission(
|
||||
page.select("main p")[0].text.strip()
|
||||
== "Sending text messages has been disabled for your service."
|
||||
)
|
||||
assert page.select(".usa-back-link")[0].text == "Back"
|
||||
assert page.select(".usa-back-link")[0]["href"] == url_for(
|
||||
assert "Back" in page.select("nav.usa-breadcrumb a")[0].text
|
||||
assert page.select("nav.usa-breadcrumb a")[0]["href"] == url_for(
|
||||
".view_template",
|
||||
service_id=service_one["id"],
|
||||
template_id=template_id,
|
||||
@@ -758,7 +758,7 @@ def test_upload_csv_file_with_very_long_placeholder_shows_check_page_with_errors
|
||||
+12028675109
|
||||
""",
|
||||
(
|
||||
"There’s a problem with your column names "
|
||||
"There's a problem with your column names "
|
||||
"Your file needs a column called ‘phone number’. "
|
||||
"Right now it has columns called ‘telephone’ and ‘name’."
|
||||
),
|
||||
@@ -779,7 +779,7 @@ def test_upload_csv_file_with_very_long_placeholder_shows_check_page_with_errors
|
||||
+12027900111,+12027900222,+12027900333,
|
||||
""",
|
||||
(
|
||||
"There’s a problem with your column names "
|
||||
"There's a problem with your column names "
|
||||
"We found more than one column called ‘phone number’ or ‘PHONE_NUMBER’. "
|
||||
"Delete or rename one of these columns and try again."
|
||||
),
|
||||
@@ -1208,8 +1208,8 @@ def test_send_one_off_does_not_send_without_the_correct_permissions(
|
||||
page.select("main p")[0].text.strip()
|
||||
== "Sending text messages has been disabled for your service."
|
||||
)
|
||||
assert page.select(".usa-back-link")[0].text == "Back"
|
||||
assert page.select(".usa-back-link")[0]["href"] == url_for(
|
||||
assert "Back" in page.select("nav.usa-breadcrumb a")[0].text
|
||||
assert page.select("nav.usa-breadcrumb a")[0]["href"] == url_for(
|
||||
".view_template",
|
||||
service_id=service_one["id"],
|
||||
template_id=template_id,
|
||||
@@ -1440,13 +1440,11 @@ def test_send_one_off_offers_link_to_upload(
|
||||
template_id=fake_uuid,
|
||||
_follow_redirects=True,
|
||||
)
|
||||
back_link = page.select_one(".usa-back-link")
|
||||
back_link = page.select_one("nav.usa-breadcrumb a")
|
||||
link = page.select_one("form a")
|
||||
|
||||
assert back_link.text.strip() in {
|
||||
"Back to all templates",
|
||||
"Back to confirm your template",
|
||||
}
|
||||
# Back button now just says "Back" instead of descriptive text
|
||||
assert "Back" in back_link.text.strip()
|
||||
|
||||
assert link.text.strip() == "Upload a list of phone numbers"
|
||||
assert link["href"] == url_for(
|
||||
@@ -1516,10 +1514,10 @@ def test_link_to_upload_not_offered_when_entering_personalisation(
|
||||
step_index=1,
|
||||
)
|
||||
|
||||
# We’re entering personalization
|
||||
# We're entering personalization
|
||||
assert page.select_one("input[type=text]")["name"] == "placeholder_value"
|
||||
assert page.select_one("label").text.strip() == "name"
|
||||
# No ‘Upload’ link shown
|
||||
# No 'Upload' link shown
|
||||
assert len(page.select("main a")) == 0
|
||||
assert "Upload" not in page.select_one("main").text
|
||||
|
||||
@@ -1741,7 +1739,7 @@ def test_send_one_off_step_0_back_link(
|
||||
step_index=0,
|
||||
)
|
||||
|
||||
assert page.select(".usa-back-link")[0]["href"] == url_for(
|
||||
assert page.select("nav.usa-breadcrumb a")[0]["href"] == url_for(
|
||||
expected_back_link_endpoint, service_id=SERVICE_ONE_ID, **extra_args
|
||||
)
|
||||
|
||||
@@ -1762,7 +1760,7 @@ def test_send_one_off_sms_message_back_link_with_multiple_placeholders(
|
||||
step_index=2,
|
||||
)
|
||||
|
||||
assert page.select_one(".usa-back-link")["href"] == url_for(
|
||||
assert page.select_one("nav.usa-breadcrumb a")["href"] == url_for(
|
||||
"main.send_one_off_step",
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=unchanging_fake_uuid,
|
||||
@@ -2279,7 +2277,7 @@ def test_check_messages_back_link(
|
||||
**extra_args,
|
||||
)
|
||||
|
||||
actual_href = page.find_all("a", {"class": "usa-back-link"})[0]["href"]
|
||||
actual_href = page.select("nav.usa-breadcrumb a")[0]["href"]
|
||||
expected_href = expected_url(service_id=SERVICE_ONE_ID, template_id=fake_uuid)
|
||||
|
||||
assert (
|
||||
@@ -2291,10 +2289,10 @@ def test_check_messages_back_link(
|
||||
@pytest.mark.parametrize(
|
||||
("num_requested", "expected_msg"),
|
||||
[
|
||||
(None, "‘example.csv’ contains 1,234 phone numbers."),
|
||||
("0", "‘example.csv’ contains 1,234 phone numbers."),
|
||||
(None, "'example.csv' contains 1,234 phone numbers."),
|
||||
("0", "'example.csv' contains 1,234 phone numbers."),
|
||||
# This used to trigger the too many messages errors but we removed the daily limit
|
||||
("1", "‘example.csv’ contains 1,234 phone numbers."),
|
||||
("1", "'example.csv' contains 1,234 phone numbers."),
|
||||
],
|
||||
ids=["none_sent", "none_sent", "some_sent"],
|
||||
)
|
||||
@@ -2339,7 +2337,6 @@ def test_check_messages_shows_too_many_messages_errors(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
upload_id=fake_uuid,
|
||||
_test_page_title=False,
|
||||
)
|
||||
|
||||
assert page.find("h1").text.strip() == "Too many recipients"
|
||||
@@ -2353,7 +2350,8 @@ def test_check_messages_shows_too_many_messages_errors(
|
||||
details = " ".join(
|
||||
[line.strip() for line in details.text.split("\n") if line.strip() != ""]
|
||||
)
|
||||
assert details == expected_msg
|
||||
assert "example.csv" in details
|
||||
assert "contains 1,234 phone numbers" in details
|
||||
|
||||
|
||||
def test_check_messages_shows_trial_mode_error(
|
||||
@@ -2389,7 +2387,6 @@ def test_check_messages_shows_trial_mode_error(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
upload_id=fake_uuid,
|
||||
_test_page_title=False,
|
||||
)
|
||||
|
||||
assert " ".join(page.find("div", class_="banner-dangerous").text.split()) == (
|
||||
@@ -2431,7 +2428,6 @@ def test_warns_if_file_sent_already(
|
||||
template_id="5d729fbd-239c-44ab-b498-75a985f3198f",
|
||||
upload_id=fake_uuid,
|
||||
original_file_name=uploaded_file_name,
|
||||
_test_page_title=False,
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select_one(".banner-dangerous").text) == (
|
||||
@@ -2488,7 +2484,6 @@ def stmt_for_test_warns_if_file_sent_already_errors(
|
||||
template_id="5d729fbd-239c-44ab-b498-75a985f3198f",
|
||||
upload_id=fake_uuid,
|
||||
original_file_name=uploaded_file_name,
|
||||
_test_page_title=False,
|
||||
)
|
||||
assert normalize_spaces(page.select_one(".banner-dangerous").text) == (
|
||||
"These messages have already been sent today "
|
||||
@@ -2537,11 +2532,12 @@ def test_check_messages_column_error_doesnt_show_optional_columns(
|
||||
_test_page_title=False,
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select_one(".banner-dangerous").text) == (
|
||||
"There’s a problem with your column names "
|
||||
"Your file needs a column called ‘phone number’. "
|
||||
"Right now it has columns called ‘address_line_1’, ‘address_line_2’ and ‘foo’."
|
||||
)
|
||||
banner_text = normalize_spaces(page.select_one(".banner-dangerous").text)
|
||||
assert "problem with your column names" in banner_text
|
||||
assert "phone number" in banner_text
|
||||
assert "address_line_1" in banner_text
|
||||
assert "address_line_2" in banner_text
|
||||
assert "foo" in banner_text
|
||||
|
||||
|
||||
def test_check_messages_adds_sender_id_in_session_to_metadata(
|
||||
@@ -2578,7 +2574,6 @@ def test_check_messages_adds_sender_id_in_session_to_metadata(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
upload_id=fake_uuid,
|
||||
_test_page_title=False,
|
||||
)
|
||||
|
||||
mock_s3_set_metadata.assert_called_once_with(
|
||||
@@ -2626,7 +2621,6 @@ def test_check_messages_shows_over_max_row_error(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
upload_id=fake_uuid,
|
||||
_test_page_title=False,
|
||||
)
|
||||
|
||||
assert " ".join(page.find("div", class_="banner-dangerous").text.split()) == (
|
||||
@@ -2675,7 +2669,7 @@ def test_check_notification_shows_scheduler(
|
||||
)
|
||||
|
||||
assert page.h1.text.strip() == "Select delivery time"
|
||||
assert (page.find_all("a", {"class": "usa-back-link"})[0]["href"]) == url_for(
|
||||
assert (page.select("nav.usa-breadcrumb a")[0]["href"]) == url_for(
|
||||
"main.send_one_off_step",
|
||||
service_id=service_one["id"],
|
||||
template_id=fake_uuid,
|
||||
@@ -2715,7 +2709,7 @@ def test_preview_notification_shows_preview(
|
||||
)
|
||||
|
||||
assert page.h1.text.strip() == "Preview for sending"
|
||||
back_link = page.find_all("a", {"class": "usa-back-link"})[0]
|
||||
back_link = page.select("nav.usa-breadcrumb a")[0]
|
||||
assert back_link is not None
|
||||
|
||||
# The real rendered <a href="..."> attribute
|
||||
@@ -2875,10 +2869,7 @@ def test_send_notification_redirects_to_view_page(
|
||||
)
|
||||
|
||||
|
||||
TRIAL_MODE_MSG = (
|
||||
"Cannot send to this recipient when service is in trial mode – "
|
||||
"see https://www.notifications.service.gov.uk/trial-mode"
|
||||
)
|
||||
TRIAL_MODE_MSG = "Cannot send to this recipient when service is in trial mode"
|
||||
TOO_LONG_MSG = "Text messages cannot be longer than 918 characters. Your message is 954 characters."
|
||||
SERVICE_DAILY_LIMIT_MSG = "Exceeded send limits (1000) for today"
|
||||
|
||||
@@ -3016,12 +3007,12 @@ def test_reply_to_is_previewed_if_chosen(
|
||||
"app.main.views.send.s3download",
|
||||
return_value="""
|
||||
email_address,date,thing
|
||||
notify@digital.cabinet-office.gov.uk,foo,bar
|
||||
notify@example.com,foo,bar
|
||||
""",
|
||||
)
|
||||
|
||||
with client_request.session_transaction() as session:
|
||||
session["recipient"] = "notify@digital.cabinet-office.gov.uk"
|
||||
session["recipient"] = "notify@example.com"
|
||||
session["placeholders"] = {}
|
||||
session["file_uploads"] = {fake_uuid: {"template_id": fake_uuid}}
|
||||
session["sender_id"] = reply_to_address
|
||||
@@ -3096,7 +3087,7 @@ def test_sms_sender_is_previewed(
|
||||
sms_sender_on_page = page.select_one(".sms-message-sender")
|
||||
|
||||
if sms_sender:
|
||||
assert sms_sender_on_page.text.strip() == "From: GOVUK"
|
||||
assert sms_sender_on_page.text.strip() == "From: USGOV"
|
||||
else:
|
||||
assert not sms_sender_on_page
|
||||
|
||||
|
||||
Reference in New Issue
Block a user