mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
Merge pull request #3238 from alphagov/cookies-update
New cookies banner and page
This commit is contained in:
@@ -22,7 +22,7 @@ def test_should_render_email_verification_resend_show_email_address_and_resend_v
|
||||
assert page.h1.string == 'Check your email'
|
||||
expected = "A new confirmation email has been sent to {}".format(api_user_active['email_address'])
|
||||
|
||||
message = page.find_all('p')[1].text
|
||||
message = page.select('main p')[0].text
|
||||
assert message == expected
|
||||
mock_send_verify_email.assert_called_with(api_user_active['id'], api_user_active['email_address'])
|
||||
|
||||
@@ -66,7 +66,7 @@ def test_should_render_correct_resend_template_for_pending_user(
|
||||
assert page.h1.string == 'Check your mobile number'
|
||||
|
||||
expected = 'Check your mobile phone number is correct and then resend the security code.'
|
||||
message = page.find_all('p')[1].text
|
||||
message = page.select('main p')[0].text
|
||||
assert message == expected
|
||||
assert page.find('form').input['value'] == api_user_pending['mobile_number']
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@ def test_should_show_scheduled_job(
|
||||
template_id='5d729fbd-239c-44ab-b498-75a985f3198f',
|
||||
version=1,
|
||||
)
|
||||
assert page.select_one('button[type=submit]').text.strip() == 'Cancel sending'
|
||||
assert page.select_one('main button[type=submit]').text.strip() == 'Cancel sending'
|
||||
|
||||
|
||||
def test_should_cancel_job(
|
||||
|
||||
@@ -1046,7 +1046,7 @@ def test_edit_user_email_page(
|
||||
assert page.find('h1').text == "Change team member’s email address"
|
||||
assert page.select('p[id=user_name]')[0].text == "This will change the email address for {}.".format(user['name'])
|
||||
assert page.select('input[type=email]')[0].attrs["value"] == user['email_address']
|
||||
assert page.select('button[type=submit]')[0].text == "Save"
|
||||
assert page.select('main button[type=submit]')[0].text == "Save"
|
||||
|
||||
|
||||
def test_edit_user_email_page_404_for_non_team_member(
|
||||
@@ -1367,7 +1367,7 @@ def test_edit_user_mobile_number_page(
|
||||
"This will change the mobile number for {}."
|
||||
).format(active_user_with_permissions['name'])
|
||||
assert page.select('input[name=mobile_number]')[0].attrs["value"] == "0770••••762"
|
||||
assert page.select('button[type=submit]')[0].text == "Save"
|
||||
assert page.select('main button[type=submit]')[0].text == "Save"
|
||||
|
||||
|
||||
def test_edit_user_mobile_number_redirects_to_confirmation(
|
||||
|
||||
@@ -1003,7 +1003,7 @@ def test_send_test_doesnt_show_file_contents(
|
||||
assert page.select('h1')[0].text.strip() == 'Preview of ‘Two week reminder’'
|
||||
assert len(page.select('table')) == 0
|
||||
assert len(page.select('.banner-dangerous')) == 0
|
||||
assert page.select_one('button[type=submit]').text.strip() == 'Send 1 text message'
|
||||
assert page.select_one('main button[type=submit]').text.strip() == 'Send 1 text message'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('user, endpoint, template_type, content_has_placeholders, expected_recipient', [
|
||||
@@ -2229,7 +2229,7 @@ def test_letter_can_only_be_sent_now(
|
||||
|
||||
assert 'name="scheduled_for"' not in page
|
||||
assert normalize_spaces(
|
||||
page.select_one('[type=submit]').text
|
||||
page.select_one('main [type=submit]').text
|
||||
) == (
|
||||
'Send 1 letter'
|
||||
)
|
||||
@@ -2259,7 +2259,7 @@ def test_send_button_is_correctly_labelled(
|
||||
)
|
||||
|
||||
assert normalize_spaces(
|
||||
page.select_one('[type=submit]').text
|
||||
page.select_one('main [type=submit]').text
|
||||
) == (
|
||||
'Send 1,000 text messages'
|
||||
)
|
||||
@@ -2891,7 +2891,7 @@ def test_check_messages_does_not_allow_to_send_letter_longer_than_10_pages(
|
||||
assert page.find('h1', {"data-error-type": "letter-too-long"})
|
||||
|
||||
assert len(page.select('.letter img')) == 10 # if letter longer than 10 pages, only 10 first pages are displayed
|
||||
assert not page.select('[type=submit]')
|
||||
assert not page.select('main [type=submit]')
|
||||
|
||||
|
||||
def test_check_messages_shows_data_errors_before_trial_mode_errors_for_letters(
|
||||
@@ -3218,7 +3218,7 @@ def test_send_one_off_letter_errors_in_trial_mode(
|
||||
|
||||
assert len(page.select('.letter img')) == 5
|
||||
|
||||
assert not page.select('[type=submit]')
|
||||
assert not page.select('main [type=submit]')
|
||||
assert page.select_one('.govuk-back-link').text == 'Back'
|
||||
assert page.select_one('a[download]').text == 'Download as a PDF'
|
||||
|
||||
@@ -3259,7 +3259,7 @@ def test_send_one_off_letter_errors_if_letter_longer_than_10_pages(
|
||||
assert page.find('h1', {"data-error-type": "letter-too-long"})
|
||||
assert len(page.select('.letter img')) == 10
|
||||
|
||||
assert not page.select('[type=submit]')
|
||||
assert not page.select('main [type=submit]')
|
||||
|
||||
|
||||
def test_check_messages_shows_over_max_row_error(
|
||||
|
||||
@@ -435,7 +435,7 @@ def test_show_restricted_service(
|
||||
)
|
||||
|
||||
assert page.find('h1').text == 'Settings'
|
||||
assert page.find_all('h2')[0].text == 'Your service is in trial mode'
|
||||
assert page.select('main h2')[0].text == 'Your service is in trial mode'
|
||||
|
||||
request_to_live = page.select('main p')[1]
|
||||
request_to_live_link = request_to_live.select_one('a')
|
||||
@@ -889,7 +889,7 @@ def test_should_not_show_go_live_button_if_checklist_not_complete(
|
||||
page.select_one('[type=submit]').text.strip() == ('Request to go live')
|
||||
else:
|
||||
assert not page.select('form')
|
||||
assert not page.select('[type=submit]')
|
||||
assert not page.select('main [type=submit]')
|
||||
assert len(page.select('main p')) == 1
|
||||
assert normalize_spaces(page.select_one('main p').text) == (
|
||||
'You must complete these steps before you can request to go live.'
|
||||
@@ -1192,8 +1192,8 @@ def test_non_gov_user_is_told_they_cant_go_live(
|
||||
assert normalize_spaces(page.select_one('main p').text) == (
|
||||
'Only team members with a government email address can request to go live.'
|
||||
)
|
||||
assert len(page.select('form')) == 0
|
||||
assert len(page.select('button')) == 1
|
||||
assert len(page.select('main form')) == 0
|
||||
assert len(page.select('main button')) == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize('consent_to_research, displayed_consent', (
|
||||
|
||||
@@ -835,18 +835,18 @@ def test_delete_template_folder_should_request_confirmation(
|
||||
|
||||
assert page.select_one('input[name=name]')['value'] == 'sacrifice'
|
||||
|
||||
assert len(page.select('form')) == 2
|
||||
assert len(page.select('button')) == 3
|
||||
assert len(page.select('main form')) == 2
|
||||
assert len(page.select('main button')) == 2
|
||||
|
||||
assert 'action' not in page.select('form')[0]
|
||||
assert page.select('form button')[0].text == 'Yes, delete'
|
||||
assert 'action' not in page.select('main form')[0]
|
||||
assert page.select('main form button')[0].text == 'Yes, delete'
|
||||
|
||||
assert page.select('form')[1]['action'] == url_for(
|
||||
assert page.select('main form')[1]['action'] == url_for(
|
||||
'main.manage_template_folder',
|
||||
service_id=service_one['id'],
|
||||
template_folder_id=folder_id,
|
||||
)
|
||||
assert page.select('form button')[1].text == 'Save'
|
||||
assert page.select('main form button')[1].text == 'Save'
|
||||
|
||||
|
||||
def test_delete_template_folder_should_detect_non_empty_folder_on_get(
|
||||
|
||||
@@ -103,7 +103,7 @@ def test_post_upload_letter_redirects_for_valid_file(
|
||||
assert not page.find(id='validation-error-message')
|
||||
|
||||
assert page.find('input', {'type': 'hidden', 'name': 'file_id', 'value': fake_uuid})
|
||||
assert page.find('button', {'type': 'submit'}).text == 'Send 1 letter'
|
||||
assert page.select('main button[type=submit]')[0].text == 'Send 1 letter'
|
||||
|
||||
|
||||
def test_post_upload_letter_shows_letter_preview_for_valid_file(
|
||||
@@ -406,7 +406,7 @@ def test_uploaded_letter_preview_does_not_show_send_button_if_service_in_trial_m
|
||||
'Recipient: The Queen'
|
||||
)
|
||||
assert not page.find('form')
|
||||
assert not page.find('button', {'type': 'submit'})
|
||||
assert len(page.select('main button[type=submit]')) == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize('invalid_pages, page_requested, overlay_expected', (
|
||||
|
||||
@@ -22,7 +22,7 @@ def test_should_return_verify_template(
|
||||
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.h1.text == 'Check your phone'
|
||||
message = page.find_all('p')[1].text
|
||||
message = page.select('main p')[0].text
|
||||
assert message == "We’ve sent you a text message with a security code."
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user