Skip to content

Commit 1ebc8aa

Browse files
authored
Merge pull request #439 from NHSDigital/wait-for-note-to-get-written
Wait for navigation after saving notes
2 parents 544f1b8 + ed6197a commit 1ebc8aa

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

mavis/test/pages/children.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pathlib import Path
22
from playwright.sync_api import Page, expect
3+
import time
34

45
from ..data import TestData
56
from ..models import School
@@ -44,6 +45,10 @@ def __init__(self, page: Page, test_data: TestData):
4445
)
4546
self.vaccinations_card_row = vaccinations_card.get_by_role("row")
4647

48+
self.manually_matched_card = self.page.get_by_text(
49+
"Consent response manually matched with child record"
50+
)
51+
4752
def verify_headers(self):
4853
expect(self.children_heading).to_be_visible()
4954
for header in self.children_table_headers:
@@ -118,6 +123,21 @@ def expect_text_in_main(self, text: str) -> None:
118123
def expect_text_in_heading(self, text: str) -> None:
119124
expect(self.page.get_by_role("heading")).to_contain_text(text)
120125

126+
def check_log_updates_with_match(self):
127+
self.page.wait_for_load_state()
128+
129+
# Wait up to 10 seconds for activity log to update
130+
131+
for i in range(20):
132+
if self.manually_matched_card.is_visible():
133+
break
134+
135+
time.sleep(0.5)
136+
137+
self.page.reload()
138+
139+
expect(self.manually_matched_card).to_be_visible()
140+
121141
def verify_activity_log_for_created_or_matched_child(
122142
self, child_name: str, location: str
123143
):
@@ -128,7 +148,7 @@ def verify_activity_log_for_created_or_matched_child(
128148
self.expect_text_in_main(f"Invited to the session at {location}")
129149

130150
# FIXME: Update this text when MAVIS-1896/MAV-253 is closed
131-
self.expect_text_in_main("Consent response manually matched with child record")
151+
self.check_log_updates_with_match()
132152

133153
def remove_child_from_cohort(self, child_name: str):
134154
self.search_for_a_child(child_name)

mavis/test/pages/sessions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,8 @@ def check_note_appears_in_search(self, child: str, note: str):
445445
def add_note(self, note: str):
446446
self.click_add_a_note()
447447
self.fill_note_textbox(note)
448-
self.click_save_note()
448+
with self.page.expect_navigation():
449+
self.click_save_note()
449450
expect(self.success_alert).to_contain_text("Note added")
450451
self.check_notes_appear_in_order([note])
451452

0 commit comments

Comments
 (0)