33from libs import CurrentExecution , testdata_ops
44from libs .generic_constants import actions , escape_characters , properties , wait_time
55from libs .playwright_ops import PlaywrightOperations
6- from libs .mavis_constants import mavis_file_types , record_limit
6+ from libs .mavis_constants import mavis_file_types , test_data_values
77from libs .wrappers import get_link_formatted_date_time
88
99from .children import ChildrenPage
@@ -39,6 +39,14 @@ def __init__(self, playwright_operations: PlaywrightOperations):
3939 self .vaccines_page = VaccinesPage (playwright_operations )
4040 self .upload_time = ""
4141
42+ @property
43+ def alert_success (self ):
44+ return self .ce .page .get_by_text ("Import processing started" )
45+
46+ def is_processing_in_background (self ):
47+ self .ce .page .wait_for_load_state ()
48+ return self .alert_success .is_visible ()
49+
4250 def import_child_records (
4351 self , file_paths : str , verify_on_children_page : bool = False
4452 ):
@@ -62,9 +70,11 @@ def import_child_records(
6270 )
6371 self .po .act (locator = self .BTN_CONTINUE , action = actions .CLICK_BUTTON )
6472 self ._record_upload_time ()
65- self .po .act (locator = None , action = actions .WAIT , value = wait_time .MED )
66- if self .ce .get_file_record_count () > record_limit .FILE_RECORD_MAX_THRESHOLD :
73+
74+ if self .is_processing_in_background ():
75+ self .po .act (locator = None , action = actions .WAIT , value = wait_time .MED )
6776 self ._click_uploaded_file_datetime (truncated = True )
77+
6878 self ._verify_upload_output (file_path = _output_file_path )
6979 if verify_on_children_page :
7080 self .children_page .verify_child_has_been_uploaded (child_list = _cl )
@@ -94,7 +104,7 @@ def import_class_list_records(
94104 self .po .act (
95105 locator = self .LBL_SCHOOL_NAME ,
96106 action = actions .SELECT_FROM_LIST ,
97- value = self . sessions_page . LNK_SCHOOL_1 ,
107+ value = test_data_values . SCHOOL_1_NAME ,
98108 )
99109 self .po .act (locator = self .BTN_CONTINUE , action = actions .CLICK_BUTTON )
100110 self ._select_year_groups (* year_groups )
@@ -105,9 +115,11 @@ def import_class_list_records(
105115 )
106116 self .po .act (locator = self .BTN_CONTINUE , action = actions .CLICK_BUTTON )
107117 self ._record_upload_time ()
108- self .po .act (locator = None , action = actions .WAIT , value = wait_time .MED )
109- if self .ce .get_file_record_count () > record_limit .FILE_RECORD_MAX_THRESHOLD :
118+
119+ if self .is_processing_in_background ():
120+ self .po .act (locator = None , action = actions .WAIT , value = wait_time .MED )
110121 self ._click_uploaded_file_datetime (truncated = True )
122+
111123 self ._verify_upload_output (file_path = _output_file_path )
112124 if verify_on_children_page :
113125 self .children_page .verify_child_has_been_uploaded (child_list = _cl )
@@ -127,9 +139,11 @@ def import_class_list_records_from_school_session(self, file_paths: str):
127139 )
128140 self .po .act (locator = self .BTN_CONTINUE , action = actions .CLICK_BUTTON )
129141 self ._record_upload_time ()
130- self .po .act (locator = None , action = actions .WAIT , value = wait_time .MED )
131- if self .ce .get_file_record_count () > record_limit .FILE_RECORD_MAX_THRESHOLD :
142+
143+ if self .is_processing_in_background ():
144+ self .po .act (locator = None , action = actions .WAIT , value = wait_time .MED )
132145 self ._click_uploaded_file_datetime (truncated = True )
146+
133147 self ._verify_upload_output (file_path = _output_file_path )
134148
135149 def import_vaccination_records (
@@ -158,9 +172,11 @@ def import_vaccination_records(
158172 )
159173 self .po .act (locator = self .BTN_CONTINUE , action = actions .CLICK_BUTTON )
160174 self ._record_upload_time ()
161- self .po .act (locator = None , action = actions .WAIT , value = wait_time .MAX )
162- if self .ce .get_file_record_count () > record_limit .FILE_RECORD_MAX_THRESHOLD :
175+
176+ if self .is_processing_in_background ():
177+ self .po .act (locator = None , action = actions .WAIT , value = wait_time .MAX )
163178 self ._click_uploaded_file_datetime (truncated = True )
179+
164180 self ._verify_upload_output (file_path = _output_file_path )
165181 if verify_on_children_page :
166182 self .children_page .verify_child_has_been_uploaded (child_list = _cl )
@@ -213,5 +229,5 @@ def verify_mav_855(self):
213229 self .po .verify (
214230 locator = self .LBL_MAIN ,
215231 property = properties .TEXT ,
216- expected_value = self . sessions_page . LNK_SCHOOL_1 ,
232+ expected_value = test_data_values . SCHOOL_1_NAME ,
217233 )
0 commit comments