mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-24 01:49:15 -04:00
Fix unit tests for changes to the pill component.
This commit is contained in:
@@ -503,7 +503,7 @@ def test_organisation_services_filters_by_financial_year(
|
||||
'2019 to 2020 financial year '
|
||||
'2018 to 2019 financial year'
|
||||
)
|
||||
assert normalize_spaces(page.select_one('.pill-selected-item').text) == (
|
||||
assert normalize_spaces(page.select_one('.pill-item--selected').text) == (
|
||||
expected_selected
|
||||
)
|
||||
|
||||
|
||||
@@ -692,7 +692,7 @@ def test_redacts_templates_that_should_be_redacted(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"message_type, tablist_visible", [
|
||||
"message_type, nav_visible", [
|
||||
('email', True),
|
||||
('sms', True),
|
||||
('letter', False)
|
||||
@@ -707,7 +707,7 @@ def test_big_numbers_dont_show_for_letters(
|
||||
mock_get_service_data_retention,
|
||||
mock_get_no_api_keys,
|
||||
message_type,
|
||||
tablist_visible,
|
||||
nav_visible,
|
||||
):
|
||||
page = client_request.get(
|
||||
'main.view_notifications',
|
||||
@@ -717,7 +717,7 @@ def test_big_numbers_dont_show_for_letters(
|
||||
page=1,
|
||||
)
|
||||
|
||||
assert (len(page.select("[role=tablist]")) > 0) == tablist_visible
|
||||
assert (len(page.select(".pill")) > 0) == nav_visible
|
||||
assert (len(page.select("[type=search]")) > 0) is True
|
||||
|
||||
|
||||
|
||||
@@ -950,12 +950,12 @@ def test_usage_page(
|
||||
mock_get_free_sms_fragment_limit.assert_called_with(SERVICE_ONE_ID, 2011)
|
||||
|
||||
cols = page.find_all('div', {'class': 'govuk-grid-column-one-third'})
|
||||
nav = page.find('ul', {'class': 'pill', 'role': 'tablist'})
|
||||
nav_links = nav.find_all('a')
|
||||
nav = page.find('ul', {'class': 'pill'})
|
||||
unselected_nav_links = nav.select('a:not(.pill-item--selected)')
|
||||
|
||||
assert normalize_spaces(nav.find('li', {'aria-selected': 'true'}).text) == '2011 to 2012 financial year'
|
||||
assert normalize_spaces(nav_links[0].text) == '2010 to 2011 financial year'
|
||||
assert normalize_spaces(nav_links[1].text) == '2009 to 2010 financial year'
|
||||
assert normalize_spaces(nav.find('a', {'aria-current': 'page'}).text) == '2011 to 2012 financial year'
|
||||
assert normalize_spaces(unselected_nav_links[0].text) == '2010 to 2011 financial year'
|
||||
assert normalize_spaces(unselected_nav_links[1].text) == '2009 to 2010 financial year'
|
||||
assert '252,190' in cols[1].text
|
||||
assert 'Text messages' in cols[1].text
|
||||
|
||||
@@ -992,12 +992,12 @@ def test_usage_page_with_letters(
|
||||
mock_get_free_sms_fragment_limit.assert_called_with(SERVICE_ONE_ID, 2011)
|
||||
|
||||
cols = page.find_all('div', {'class': 'govuk-grid-column-one-third'})
|
||||
nav = page.find('ul', {'class': 'pill', 'role': 'tablist'})
|
||||
nav_links = nav.find_all('a')
|
||||
nav = page.find('ul', {'class': 'pill'})
|
||||
unselected_nav_links = nav.select('a:not(.pill-item--selected)')
|
||||
|
||||
assert normalize_spaces(nav.find('li', {'aria-selected': 'true'}).text) == '2011 to 2012 financial year'
|
||||
assert normalize_spaces(nav_links[0].text) == '2010 to 2011 financial year'
|
||||
assert normalize_spaces(nav_links[1].text) == '2009 to 2010 financial year'
|
||||
assert normalize_spaces(nav.find('a', {'aria-current': 'page'}).text) == '2011 to 2012 financial year'
|
||||
assert normalize_spaces(unselected_nav_links[0].text) == '2010 to 2011 financial year'
|
||||
assert normalize_spaces(unselected_nav_links[1].text) == '2009 to 2010 financial year'
|
||||
assert '252,190' in cols[1].text
|
||||
assert 'Text messages' in cols[1].text
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ def test_should_show_job_in_progress(
|
||||
)
|
||||
assert [
|
||||
normalize_spaces(link.text)
|
||||
for link in page.select('.pill a')
|
||||
for link in page.select('.pill a:not(.pill-item--selected)')
|
||||
] == [
|
||||
'10 sending', '0 delivered', '0 failed'
|
||||
]
|
||||
@@ -213,7 +213,7 @@ def test_should_show_job_without_notifications(
|
||||
)
|
||||
assert [
|
||||
normalize_spaces(link.text)
|
||||
for link in page.select('.pill a')
|
||||
for link in page.select('.pill a:not(.pill-item--selected)')
|
||||
] == [
|
||||
'10 sending', '0 delivered', '0 failed'
|
||||
]
|
||||
@@ -279,7 +279,7 @@ def test_should_show_old_job(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
job_id=fake_uuid,
|
||||
)
|
||||
assert not page.select('.pill a')
|
||||
assert not page.select('.pill')
|
||||
assert not page.select('p.hint')
|
||||
assert not page.select('a[download]')
|
||||
assert page.select_one('tbody').text.strip() == expected_message
|
||||
|
||||
@@ -429,7 +429,7 @@ def test_should_show_templates_folder_page(
|
||||
**expected_parent_link_args[index]
|
||||
)
|
||||
|
||||
links_in_page = page.select('.pill a')
|
||||
links_in_page = page.select('.pill a:not(.pill-item--selected)')
|
||||
|
||||
assert len(links_in_page) == len(expected_nav_links)
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ def test_should_show_page_for_choosing_a_template(
|
||||
|
||||
assert normalize_spaces(page.select_one('h1').text) == expected_page_title
|
||||
|
||||
links_in_page = page.select('.pill a')
|
||||
links_in_page = page.select('.pill a:not(.pill-item--selected)')
|
||||
|
||||
assert len(links_in_page) == len(expected_nav_links)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user