Skip to content

Commit 2a357e2

Browse files
committed
fix regression test
1 parent 633be16 commit 2a357e2

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

mavis/test/pages/sessions.py

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def __init__(
118118
self.update_results_button = self.page.get_by_role(
119119
"button", name="Update results"
120120
)
121-
self.year_10_checkbox = self.page.get_by_role("checkbox", name="Year 10")
122121
self.confirm_button = self.page.get_by_role("button", name="Confirm")
123122
self.search_textbox = self.page.get_by_role("textbox", name="Search")
124123
self.search_button = self.page.get_by_role("button", name="Search")
@@ -182,6 +181,10 @@ def __init__(
182181
vaccinations_card = page.get_by_role("table", name="Vaccinations")
183182
self.vaccinations_card_row = vaccinations_card.get_by_role("row")
184183
self.sessions_link = page.get_by_role("link", name="Sessions", exact=True).first
184+
self.advanced_filters_link = page.get_by_text("Advanced filters")
185+
self.missing_nhs_no_checkbox = self.page.get_by_role(
186+
"checkbox", name="Children missing an NHS number"
187+
)
185188

186189
def __get_display_formatted_date(self, date_to_format: str) -> str:
187190
_parsed_date = datetime.strptime(date_to_format, "%Y%m%d")
@@ -247,6 +250,7 @@ def click_session_for_programme_group(self, location: str, programme_group: str)
247250

248251
self.search_textbox.fill(str(location))
249252
self.search_button.click()
253+
250254
self.page.get_by_role("link", name=str(location)).click()
251255

252256
expect(self.page.locator("h1", has_text=str(location))).to_be_visible(
@@ -394,17 +398,25 @@ def click_confirm_button(self):
394398

395399
@step("Check box for year {1}")
396400
def check_year_checkbox(self, year: str):
397-
self.page.get_by_role("checkbox", name=f"Year {year}").check()
401+
if year == "0":
402+
self.page.get_by_role("checkbox", name="Reception").check()
403+
else:
404+
self.page.get_by_role("checkbox", name=f"Year {year}").check()
398405

399406
@step("Uncheck box for year {1}")
400407
def uncheck_year_checkbox(self, year: str):
401-
self.page.get_by_role("checkbox", name=f"Year {year}").uncheck()
408+
if year == "0":
409+
self.page.get_by_role("checkbox", name="Reception").uncheck()
410+
else:
411+
self.page.get_by_role("checkbox", name=f"Year {year}").uncheck()
402412

403-
@step("Check box for year {1}")
404-
def check_box_for_year_other_than(self, year: str):
405-
self.page.get_by_role("checkbox", name="Year ").filter(
406-
has_not_text=year
407-
).first.check()
413+
@step("Click Advanced filters")
414+
def click_advanced_filters(self):
415+
self.advanced_filters_link.click()
416+
417+
@step("Check Children missing an NHS number")
418+
def check_missing_nhs_no_checkbox(self):
419+
self.missing_nhs_no_checkbox.check()
408420

409421
@step("Click on Record vaccinations")
410422
def click_record_vaccinations_tab(self):
@@ -680,22 +692,6 @@ def get_online_consent_url(self, *programmes: list[Programme]) -> str:
680692
link_text = f"View the {' and '.join(str(programme) for programme in programmes)} online consent form"
681693
return str(self.page.get_by_role("link", name=link_text).get_attribute("href"))
682694

683-
def verify_attendance_filters(self):
684-
self.click_register_tab()
685-
686-
search_summary = self.page.get_by_text("Showing 1 to")
687-
688-
expect(search_summary).not_to_have_text("Showing 1 to 1 of 1 children")
689-
self.year_10_checkbox.check()
690-
self.click_on_update_results()
691-
692-
expect(search_summary).to_have_text("Showing 1 to 1 of 1 children")
693-
694-
self.year_10_checkbox.uncheck()
695-
self.click_on_update_results()
696-
697-
expect(search_summary).not_to_have_text("Showing 1 to 1 of 1 children")
698-
699695
def register_child_as_attending(self, child: Child):
700696
self.click_register_tab()
701697
self.search_for(str(child))

tests/test_sessions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ def test_verify_attendance_filters(setup_mavis_1822, sessions_page, year_groups)
100100
expect(search_summary).to_have_text("Showing 1 to 5 of 5 children")
101101

102102
sessions_page.uncheck_year_checkbox(year_group)
103-
sessions_page.check_box_for_year_other_than(year_group)
103+
sessions_page.click_advanced_filters()
104+
sessions_page.check_missing_nhs_no_checkbox()
104105
sessions_page.click_on_update_results()
105106

106-
expect(search_summary).not_to_have_text("Showing 1 to 1 of 1 children")
107+
expect(search_summary).not_to_be_visible()
107108

108109

109110
@issue("MAV-1018")

0 commit comments

Comments
 (0)