Commit Graph

115 Commits

Author SHA1 Message Date
Beverly Nguyen
fd340ed105 update test 2024-02-23 14:59:25 -08:00
Beverly Nguyen
4eb886d8c0 update test 2024-02-13 18:18:13 -08:00
Beverly Nguyen
c2d7828138 created an alert for confirmation during send flow 2024-02-13 17:48:06 -08:00
Kenneth Kehl
36987e7202 notify-api-861 show eastern time 2023-11-16 12:24:27 -08:00
Carlo Costino
acb70b43cd Reformatted and cleaned up more tests.
Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-10-12 10:24:48 -04:00
Kenneth Kehl
8c9721d8e2 notify-api-412 use black to enforce python coding style 2023-08-25 09:12:23 -07:00
Kenneth Kehl
20a0bd5c99 merge from main 2023-07-05 15:07:38 -07:00
Kenneth Kehl
d2d7a75a5f notify-536: accurately reflect delivery receipts in UI (#551) 2023-06-27 11:20:58 -04:00
Kenneth Kehl
7168309fbb fix all tests 2023-06-26 14:07:28 -07:00
Carlo Costino
92d25f5a69 Convert frontend display to be just UTC (#540)
This changeset converts the display of dates and times to be just UTC to match the recent changes in the backend.  This unwinds a bit of work that was done previously and allows us to start with a clean slate in how we want to approach displaying dates and times going forward. It also adds a bit of explanatory text to help users.

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
Co-authored-by: stvnrlly <steven.reilly@gsa.gov>
2023-06-12 15:49:48 -04:00
Jonathan Bobel
e0d2d74067 Update dashboard and template flow (#514)
* Updated header and footer
* Moved files around and updated gulpfile to correct the build process when it goes to production
* Updated fonts
* Adjusted grid templating
* Adding images to assets
* Updated account pages, dashboard, and pages in message sending flow
* Updated the styling for the landing pages in the account section once logged in
2023-06-08 13:12:00 -04:00
Ryan Ahearn
2ad21a6f4f Replace UK phone numbers in tests with US numbers 2023-01-06 11:19:56 -05:00
stvnrlly
944715ac46 big commit with letters removal 2022-12-05 15:33:44 -05:00
stvnrlly
006e7b5d0a post-human test fixes 2022-11-30 11:24:13 -05:00
stvnrlly
e12e780a05 code cleanup 2022-11-28 15:53:56 -05:00
stvnrlly
9689aaf89b more test fixes & letter trimming 2022-11-28 11:15:41 -05:00
stvnrlly
a2b58c926e more test fixes & letter trimming 2022-11-22 22:50:47 -05:00
stvnrlly
ca1897973a test time fixes and bonus letter removal 2022-11-22 17:03:42 -05:00
Ben Thorner
ee3d2d1804 Bump utils to version 56.0.0
The only impactful change is the major version itself, where I've
fixed the breaking changes due to the upgrade of PyPDF2 [^1] and
checked there are no deprecation warnings when I run the tests.

[^1]: https://github.com/alphagov/notifications-utils/pull/973
2022-06-01 13:29:54 +01:00
Rebecca Law
453a1a699f Merge pull request #4107 from alphagov/mark-letter-invalid-if-over-10-sheets-169209742
Show validation-failed status for templated letters over 10 pages
2022-02-02 07:58:34 +00:00
Chris Hill-Scott
8b93a977a0 Remove temporary raw_response argument
We added a new argument to `client_request.get` and
`client_request.post` to specify that it should return a raw `Response`
object rather than an instance of `BeautifulSoup`.

This is useful because sometimes we need to look at stuff like the
response headers.

However it turns out we already have a separate method for this, so
rather than invent something new I think it’s better to stick with the
thing we already have.
2022-01-10 14:39:45 +00:00
Chris Hill-Scott
0706664be4 Stop using logged_in_client fixture
We have a `client_request` fixture which does a bunch of useful stuff
like:
- checking the status code of the response
- returning a `BeautifulSoup` object

Lots of our tests still use an older fixture called `logged_in_client`.
This is not as good because:
- it returns a raw `Response` object
- doesn’t do the additional checks
- means our tests contain a lot of repetetive boilerplate like `page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')`

This commit converts all the tests using `logged_in_client` to:
use `client_request` instead.
2022-01-10 14:39:44 +00:00
Rebecca Law
fc8c536fa7 Show validation error message for a templated letter over 10 pages
If a letters that has been posted via the API has more than 10 pages it would not get a validation-failed status. This also happens for letters in a CSV upload, only the first row has been validated for having too many pages, because you need to created the pdf before getting an accurate page count.

The API has been updated to mark these letters as invalid and move the
letter to the invalid s3 bucket, the meta data is also set with the
error message and page count.

This PR updates the notification page to display the validation error.

https://www.pivotaltracker.com/story/show/169209742
2022-01-04 12:42:35 +00:00
Pea Tyczynska
e1420e7ff7 Catch cancel_letter errors from API
When we catch such error, if the message is recognised,
show the message and redirect user to view_notification page.
2021-07-28 12:55:06 +01:00
Rebecca Law
aedf875110 Improve permenant failure message.
Update delivery status document page.
2021-06-10 16:34:00 +01:00
Rebecca Law
498092f9ac When a letters has passed our validation but is not the postal provider
is unable to print the letter we need to mark the letter as failed.
If we mark the letter as a technical-failure, we say that we will fix
the issue, which is wrong because we can not fix the issue.
If we mark the letter as validation-failed, the letter is in wrong
bucket so the letter is not viewable/downloadable by the client.

This PR updates the message for a letter marked as permanent-failure to
better reflect what has actually happened.
2021-06-10 08:56:14 +01:00
Leo Hemsted
087f908968 allow caseworkers to view letter previews
they can already view notifications page, but the png and pdf letter
previews just 403 for them currently.
2021-02-23 16:08:03 +00:00
Ben Thorner
933d5bf68e Show 'From' / 'Reply To' if set for notification
Previously when a service had multiple "reply to" entries setup for
email or SMS, we would show the one that was selected on all screens
[1][2] except the final one, where the notification is actually sent.
This fixes that, with the caveat that it will also show for services
with only one "reply to" entry (see notes below) - we will look at
making this consistent on the previous screens in the next commit.

Here's a bit more detail on how this works:

- If a service has multiple "reply to" entries, the journey to send a
  one-off message starts with a screen to select the "sender_id", which
  is otherwise "None" [3].

- The "sender_id" is subsequently resolved to an actual email / phone
  number by calling an API [4] and plucking it out of the response JSON.

- The email / phone number then get rendered as part of the preview
  template [5][6].

- Unfortunately the "sender_id" is removed from the session by the time
  we get to the "view_notification" view [7].

- However, we can get back the equivalent text from the notification
  JSON, which is set by the API when the notification is created [8],
  give or take a bit of validation code [9][10].

- But the "reply_to_text" field is also set by the API when the service
  only has one "reply to" entry, so it will show then as well.

We could add look at the number of "reply to" entries for the service,
in order to consistently only show it when there is more the one. But
it seems more useful to show it on previous screens, since it provides
more information than is currently show (esp. for emails).

[1]: 93226ec5d6/app/main/views/send.py (L441-L442)
[2]: 93226ec5d6/app/main/views/send.py (L966-L967)
[3]: 93226ec5d6/app/main/views/send.py (L247)
[4]: 93226ec5d6/app/main/views/send.py (L1071-L1082)
[5]: 93226ec5d6/app/templates/views/notifications/notification.html (L80)
[6]: https://github.com/alphagov/notifications-utils/blob/master/notifications_utils/jinja_templates/sms_preview_template.jinja2
[7]: 93226ec5d6/app/main/views/send.py (L1059)
[8]: f8b4c9151c/app/service/send_notification.py (L87-L93)
[9]: f8b4c9151c/app/models.py (L653)
[10]: https://github.com/alphagov/notifications-utils/blob/master/notifications_utils/recipients.py#L482
2021-02-10 10:43:27 +00:00
Katie Smith
a67ea9a623 Fix the display of sms statuses 2020-09-18 16:26:08 +01:00
karlchillmaid
0df3d2d323 Update error message content 2020-06-05 17:37:16 +01:00
Chris Hill-Scott
d828c1c481 Bump utils to 39.4.0
Adds delivery estimates for letters posted to Europe or the rest of the
world.
2020-05-26 13:37:03 +01:00
Chris Hill-Scott
9306bc3197 Merge pull request #3437 from alphagov/group-uploaded-letters
Group uploaded letters by printing date
2020-05-19 09:49:04 +01:00
Chris Hill-Scott
a3b690fde6 Test notification page shows international postage
Just to make sure we’re passing the right postage argument through to
the `LetterPreviewTemplate` constructor.
2020-05-15 15:38:58 +01:00
Chris Hill-Scott
a9998958b7 Link back to uploaded letters page
If you’ve come to look at a notification via the uploaded letters page
then the ‘< back’ link should take you back there, not to the usual
activity page.
2020-05-11 14:30:14 +01:00
Katie Smith
6b055071f4 Specify mimetype for PDF letters to be downloaded
We had a report that when clicking on the 'Download this letter' link on
the notification page the file was not being downloaded as a PDF file
but was given a `.htm` file extension instead. We should be able to stop
that happening by using Flask's `send_file` function with the right mimetype.
This change updates the `view_letter_notification_as_preview` to use
`send_file` and splits out code to get the file data into a separate
function.

Mocks in the tests have been updated and some unused mocks removed.
2020-04-09 10:35:30 +01:00
Chris Hill-Scott
b236df523c Don’t show the postage when validation has failed
The postage covers up some of the letter, so it can hide the problem. It
also implies that the letter has been put in an envelope, which will
never happen if it fails validation.

This matches what we do for uploaded letters.
2020-03-03 12:57:43 +00:00
Chris Hill-Scott
46e16c64fc Say ‘Uploaded’ for one-off precompiled letters
This calls back to what the user has actively done. _Provided as a PDF_
is more passive and suitable for PDF letters sent using the API.
2020-02-19 17:18:03 +00:00
Chris Hill-Scott
904007201f Make date of sending relative
This is a friendlier and better way of showing dates anywhere except in
a report which might be archived and referred back to later.

Bit trickier to implement here because a dat requires ‘on’ beforehand,
but we don’t say ‘on today’ in English.
2020-02-19 17:11:31 +00:00
Chris Hill-Scott
78ac345148 Put day of week on
This helps people understand how delivery dates fit into the week,
because if sending a letter spans the weekend it will take a bit longer.

We can remove `|string` now because `utc_string_to_aware_gmt_datetime`
now accepts datetimes.
2020-02-17 13:01:37 +00:00
Chris Hill-Scott
540945539b Add some summaries of letter validation errors
We show letter validation errors in two places:

1. In response to a user uploading a PDF
   Here we use the error banner pattern because the problem is as a
   direct consequence of a user’s action, and is blocking them from
   continuing.

2. Once a PDF provided through the API has been validated
   We use a less prominent pattern of red text with no border because
   the message is reporting on something that’s already happened, and
   which wasn’t a direct consequence of the user clicking something

Because the context and patterns used are different we need slightly
different content in each of these situations. Previously we tried to
reuse the same content to make the code cleaner and less repetitive. But
ultimately a clear interface trumps clear code.
2020-01-14 13:34:18 +00:00
Chris Hill-Scott
e3670de6c4 Remove the title from the short errors
This undoes some of the temporary work we did previously in order to
ship the new ‘address is empty’ error message.
2020-01-14 13:30:31 +00:00
Rebecca Law
70276cb526 Added a new error message when the letter is mising an address block.
Before deploying a change to template-preview to return a validation error for letters that are missing the address block, we need to add the new erorr message to admin.

Some content changes have been made to other messages.
The format of the message has changed.
2020-01-10 14:42:56 +00:00
Katie Smith
3e83638193 Stop calling mock_get_notification fixture as a function
Instead of using `mock_get_notification` to create a notification then
mock it in the tests, a new function, `create_notification`, can be used
to create a custom notification to be mocked. Using this in the
`test_notifications.py` file makes it Pytest 5 compatible.
2019-12-20 15:48:25 +00:00
Katie Smith
e4134072d9 Reduce the errors related to user fixtures
We were using user fixtures in a lot of parameterized tests, but this is
no longer allowed in Pytest 5. To avoid having to split up the parametrized
tests (which would make the test files a lot longer and slightly more
difficult to read) this commit creates functions which return various types
of user json so that we can use these as the test parameters instead.
2019-12-19 16:59:07 +00:00
Tom Byers
2ded09a8b9 Fix tests broken by GOV.UK Frontend template
Fix test broken by removal of GOV.UK logo image
- tests/app/main/views/test_notifications.py

Fix tests that ref GOV.UK template CSS files
- tests/app/main/views/test_index.py

Fix test broken by govuk-visually-hidden
- tests/app/main/views/test_send.py

Fix tests broken by header menu link -> button
- tests/app/main/views/test_service_settings.py
- tests/app/main/views/test_template_folders.py

Fix tests broken by removing div#content
- tests/app/main/views/accounts/test_choose_accounts.py
- tests/app/test_navigation.py

Remove references to GOV.UK CSS
- tests/app/main/views/test_index.py

Fix tests querying the header navigation
- tests/app/test_navigation.py
2019-11-27 14:15:32 +00:00
Tom Byers
e09d510ab8 Revert "Replace govuk template with govuk frontend components - rewrite" 2019-11-26 12:14:09 +00:00
Tom Byers
9ac9c6d7d6 Fix tests broken by GOV.UK Frontend template
Fix test broken by removal of GOV.UK logo image
- tests/app/main/views/test_notifications.py

Fix tests that ref GOV.UK template CSS files
- tests/app/main/views/test_index.py

Fix test broken by govuk-visually-hidden
- tests/app/main/views/test_send.py

Fix tests broken by header menu link -> button
- tests/app/main/views/test_service_settings.py
- tests/app/main/views/test_template_folders.py

Fix tests broken by removing div#content
- tests/app/main/views/accounts/test_choose_accounts.py
- tests/app/test_navigation.py

Remove references to GOV.UK CSS
- tests/app/main/views/test_index.py

Fix tests querying the header navigation
- tests/app/test_navigation.py
2019-11-25 11:43:30 +00:00
Tom Byers
e02f94f238 Revert "Replace govuk template with govuk frontend components" 2019-11-25 10:37:35 +00:00
Tom Byers
73f7292840 Fix tests broken by GOV.UK Frontend template
Fix test broken by removal of GOV.UK logo image
- tests/app/main/views/test_notifications.py

Fix tests that ref GOV.UK template CSS files
- tests/app/main/views/test_index.py

Fix test broken by govuk-visually-hidden
- tests/app/main/views/test_send.py

Fix tests broken by header menu link -> button
- tests/app/main/views/test_service_settings.py
- tests/app/main/views/test_template_folders.py

Fix tests broken by removing div#content
- tests/app/main/views/accounts/test_choose_accounts.py
- tests/app/test_navigation.py

Remove references to GOV.UK CSS
- tests/app/main/views/test_index.py

Fix tests querying the header navigation
- tests/app/test_navigation.py
2019-11-22 17:45:45 +00:00
Pea Tyczynska
678e0bed81 Show users more detailed validation failed mesage on notification page
Show valdiation failed messages on letter notifications in red text,
not in the banner like we do on Uploads and Validation checker pages.
This is because it is a different step in the journey: the user
has already sent the notification and styling needs to be in line
with other places where user is checking the notification she already
has sent.
2019-11-07 11:10:27 +00:00