From d98ec79a9dc57d4f1079cfd5d3e9ed11d5ee026f Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Sat, 10 Nov 2018 16:37:29 +0000 Subject: [PATCH] Add more thorough tests for the template search It would be quite easy to dissociate the search box from the things its supposed to be searching. This commit adds assertions to make sure that the things the search box is targeting are on the page --- tests/app/main/views/test_templates.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index f2757366a..71b7d57f2 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -173,8 +173,12 @@ def test_should_show_live_search_if_list_of_templates_taller_than_screen( 'main.choose_template', service_id=SERVICE_ONE_ID, ) + search = page.select_one('.live-search') - assert page.select('.live-search') + assert search['data-module'] == 'live-search' + assert search['data-targets'] == '#template-list .column-whole' + + assert len(page.select(search['data-targets'])) == len(page.select('.message-name')) == 14 def test_should_show_page_for_one_template(