Fix unit tests for changes to the pill component.

This commit is contained in:
Rebecca Law
2020-09-04 14:32:07 +01:00
committed by Tom Byers
parent 452e253e2c
commit 7cae303104
7 changed files with 21 additions and 20 deletions

View File

@@ -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
)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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)