Commit Graph

2864 Commits

Author SHA1 Message Date
Tom Byers
7d31431cef Fix test description 2020-01-08 17:48:37 +00:00
Tom Byers
f156fe2e95 Hide cookie banner if no-js
Decided in discussions with @quis and @yahoopete
that users without JS available cannot
accept/reject analytics cookies so the banner has
no use.
2020-01-08 10:23:52 +00:00
Tom Byers
900aa19bd3 Add JS tests for analytics & cookies JS
Includes:
- tests for the analytics interface ported from
  GOVUK Frontend Toolkit
- tests for the cookie banner that appears on all
  pages except the cookies page
- tests for the cookies page JS
- tests for the hasConsentFor function
- adding a deleteCookie helper to remove
  cookies during tests
- polyfill for insertAdjacentText

The last one is because JSDOM doesn't support
insertAdjacentText but our target browsers
do. This polyfill also includes one for
insertAdjacentHTML.
2020-01-06 13:38:34 +00:00
Tom Byers
beeb273d6c Fix python tests broken by cookie banner 2020-01-03 17:28:33 +00:00
Chris Hill-Scott
d11305741f Merge pull request #3237 from alphagov/returned-pdf-letters
Handle precompiled letters in returned letters list
2020-01-03 10:04:17 +00:00
Tom Byers
54a5f1d22c Merge pull request #3181 from alphagov/update-footer-links
Update footer links
2020-01-02 15:15:37 +00:00
Chris Hill-Scott
5ea02119f4 Handle precompiled via in returned letters list
Precompiled letters sent via the API don’t have:
- a template
- a filename

Which means in the list of returned letters we just show ‘None’. This
commit changes this to ‘Provided as PDF’, which is how we talk about
precompiled letters elsewhere (for example in the template statistics on
the dashboard).
2020-01-02 11:30:51 +00:00
Chris Hill-Scott
f0fe532b46 Pass uploaded file name into test data 2020-01-02 11:29:01 +00:00
Chris Hill-Scott
227fca6263 Make appearance of ‘empty’ table rows even
Our table rows take up 65px vertical space.

We also have things that look like rows that say:
- there are no rows
- there are more rows than can be shown on screen

This commit makes them appear the same height.
2019-12-31 14:40:17 +00:00
Chris Hill-Scott
3b7dc05dd6 Add a page for each report
It’s useful to get some kind of preview of the report before you
download it.

And if there’s only a few letters in there then you might not even need
to download it at all.

For teams with lots of letters we don’t want the page to load too slowly
so let’s cap the number of displayed items to 50, same as previewing
a spreadsheet.
2019-12-31 14:39:12 +00:00
Chris Hill-Scott
8bcfb2fcde Use file list pattern for list of files
This means the page has the same appearance as other lists of stuff like
the notifications page.
2019-12-31 14:37:19 +00:00
Tom Byers
59e40d4c3c Make dashboard test more specific
It was picking up the 'Get started' text from the
new link in the footer.
2019-12-31 10:29:56 +00:00
Rebecca Law
03fe7674bf Add a url_converter to check the date format. 2019-12-30 16:53:32 +00:00
Rebecca Law
41be4c054b Add test for url and pluralisation 2019-12-30 14:06:15 +00:00
Rebecca Law
401828d1e0 Remove POST where not needed.
Use  plural method to display letter or letters
Remove unused params from list_table method.
2019-12-30 08:39:39 +00:00
Rebecca Law
a4fed667e4 Updated to reflect change in API key in json result. 2019-12-27 12:40:12 +00:00
Rebecca Law
4c72efd08a Added tests 2019-12-24 14:33:52 +00:00
Rebecca Law
0273eea0cc Add email address and uploaded_letter 2019-12-24 11:22:12 +00:00
Tom Byers
869bd16536 Merge pull request #3225 from alphagov/fix-details
Add GOV.UK Frontend details component - second attempt
2019-12-23 09:47: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
6bc4f1898f Fix mock_get_organisation_by_domain and mock_get_service_organisation
This commits stops the `mock_get_organisation_by_domain` and
`mock_get_service_organisation` fixtures from being called like
functions.
2019-12-20 15:02:47 +00:00
Katie Smith
41d33b2995 Stop reply_to address fixtures from being called like functions
This stops most instances of the fixtures which return sms senders,
email reply to addresses or letter contact blocks from being called as
if they were functions in the tests by replacing them with functions
which return the same results.

This change allows a couple of fixtures which are now longer used to be
deleted.
2019-12-20 14:59:44 +00:00
Katie Smith
ccd245b287 Merge pull request #3229 from alphagov/pytest-5
Increase the number of tests that are Pytest 5 compliant
2019-12-20 10:55:13 +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
Katie Smith
b62018a8e4 Make a few more test files Pytest 5 compliant 2019-12-19 14:24:25 +00:00
Katie Smith
c6779e6f92 Stop the user fixtures being called as a functions from conftest
Stopped fixtures in conftest.py from calling the fixtures which return
user json as if they were functions. Deleted two fixtures that are now no
longer needed as a result of the changes to conftest.py.
2019-12-19 14:24:25 +00:00
Katie Smith
02253d32c5 Update user_json test function
Since we can't call the `api_user_active` fixture as a function with
Pytest 5, the `user_json` function can be used instead. This updates
the function to
- Stop returning `max_failed_login_count` since this is not a field that
gets returned from the api
- Return fields as strings, not UUIDS, to match the format that api
returns the data in
- Provide a way to use this function to return a user with no
permissions
2019-12-19 14:24:25 +00:00
Katie Smith
aec3ccff3a Fix navigation tests to not call app_() directly 2019-12-19 14:24:25 +00:00
Chris Hill-Scott
eb87548632 Serve video from a domain that doesn’t set cookies
Then it’s one less cookie we have to get users to opt in to. We don’t
derive any value from Youtube setting cookies.

`youtube-nocookie.com` is a domain provided by Google for this purpose.
2019-12-19 13:43:44 +00:00
Tom Byers
146d5cc07a Fix test broken by HTML changes on API page
I moved the meta for each message into the
`<h3>` in each `<summary>` to make the heading
unique. This broke the test.
2019-12-17 10:27:10 +00:00
Chris Hill-Scott
4da9c44919 Tell users that they can search by reference
Users who have an API integration (and therefore have a way of passing
in a reference for each notification) can now search by that reference
(see https://github.com/alphagov/notifications-api/pull/2682)

This commit changes the label on the search box to tell these users that
this is possible, without changing the label for users without an API
integration, who might get confused by what ‘reference’ means.

It also makes the label consistently say ‘email address or phone number’
(ie email address is first) because this is our content style.
2019-12-17 10:19:19 +00:00
Tom Byers
de6281bc0e Revert "Add GOVUK Frontend details component" 2019-12-16 16:20:03 +00:00
Tom Byers
60fe9d3400 Merge pull request #3209 from alphagov/add-govuk-frontend-details
Add GOVUK Frontend details component
2019-12-16 15:22:15 +00:00
Chris Hill-Scott
581296b95e Fix off-by-one dates on provider history
We chunk history entries by their YYYY-MM-DD date representation to
display them day-by-day.

However trying to convert a YYYY-MM-DD string into a timestamp is
unpredictable, and was causing our dates to be one day out (probably
because of midnight/daylight savings/general datetime horrors).

This commit changes the code to do the same thing as the history page,
which is look at the `updated_at` field on the first entry to get a
datetime object and from that the formatted date we show in the headings
on the page.
2019-12-13 13:20:56 +00:00
Chris Hill-Scott
1bd27b97f6 Remove change link from international SMS provider
We don’t want to set it independently from the other SMS providers.
2019-12-12 14:34:04 +00:00
Chris Hill-Scott
57a602c2ab Add temporary link to change priority page
Lets you get to the new page without having to think about the design
of the existing index page.
2019-12-11 10:17:48 +00:00
Chris Hill-Scott
8122fa1d5d Simplify and add tests
Makes these assumptions:
- we don’t care about history before 29th November 2019 at 11am (this
  is when priority started to mean a proportion rather than a ranking)
- the priority of the second provider will always be the inverse of
  the first provider

Which means the code is a lot simpler/actually does what you’d expect.
2019-12-11 10:17:46 +00:00
Tom Byers
d0a492988d Remove mistakenly added .swp file 2019-12-09 16:24:48 +00:00
Rebecca Law
673a0d64d0 Refactor mock_get_uploads to return more realistic data. 2019-12-06 13:22:25 +00:00
Rebecca Law
f9e01e0b45 Fix unit tests and put the antivirus check back in 2019-12-06 10:22:23 +00:00
Tom Byers
db3bcee236 Fix test broken by HTML changes on API page
I moved the meta for each message into the
`<h3>` in each `<summary>` to make the heading
unique. This broke the test.
2019-12-06 08:20:49 +00:00
karlchillmaid
cb7d0e3813 Merge pull request #3215 from alphagov/add-contraction-to-errors
Update error messages
2019-12-04 12:34:04 +00:00
karlchillmaid
7717d5131e Fix test content 2019-12-04 12:03:07 +00:00
karlchillmaid
bdde0daeec Fix test content 2019-12-04 12:01:26 +00:00
Leo Hemsted
3be9150dcf change letter previews to be in the no_cookies blueprint
this blueprint should be applied to every endpoint that is loaded async
(as in via a src tag on an img, iframe, etc)
2019-12-03 17:06:15 +00:00
Pea M. Tyczynska
0d8824c3e9 Merge pull request #3193 from alphagov/validate-against-empty-messages
Validate CSVs against rows with empty messages
2019-12-03 14:12:04 +00:00
Pea Tyczynska
9e0c8167ee Content changes to error messages 2019-12-03 13:36:54 +00:00
Pea Tyczynska
64b35ba337 Add addtional test cases for row errors 2019-12-03 13:36:53 +00:00
Pea Tyczynska
f265dde8ab Validate CSVs against rows with empty messages 2019-12-03 13:36:41 +00:00
Leo Hemsted
6ad9ec8d21 flake8 2019-11-29 15:25:37 +00:00