Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rc5d3c9cf7ca5e576425f3babefc803a50fd33cf4 -rb6a0252c08f0ca9244add4d9f15d1ec98212f9f9 --- shared/scripts/configuration/utility.py (.../utility.py) (revision c5d3c9cf7ca5e576425f3babefc803a50fd33cf4) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision b6a0252c08f0ca9244add4d9f15d1ec98212f9f9) @@ -6,8 +6,7 @@ # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file utils.py -# -# @author (last) LTTS +# @author (last) LTTS # @date (last) 15-Jan-2022 # ############################################################################ @@ -25,11 +24,11 @@ from datetime import datetime from dialin.common.hd_defs import HDOpModes from dialin.ui.hd_simulator import HDSimulator +from dialin.ui.dg_simulator import DGSimulator - hd_simulator = HDSimulator() +dg_simulator = DGSimulator() - def color_verification(exp_val = "Red", act_val = "#c53b33"): """ Function to verify item color verification @@ -528,7 +527,6 @@ installation_state=0, dry_self_test_state=0, prime_state=0, recirculate_state=0, patient_connection_state=0) - def convert_seconds_into_min_and_sec(seconds): min_and_sec = time.strftime("%M:%S", time.gmtime(seconds)) return min_and_sec @@ -572,6 +570,24 @@ hd_simulator.cmd_send_pre_treatment_self_test_no_cartridge_progress_data(300, count_down) else: dg_simulator.cmd_send_dg_pre_treatment_filter_flush_progress_data(300, count_down) + + +def verify_countdown(screen_title): + """ + Method to verify the count down + time in application + @param screen_title - (str) current title of the screen + """ + test.startSection("Verify the count down time in application") + for count_down in range(config.COUNT_DOWN_TIME_100, config.MINIMUM_COUNTDOWN_TIME-1, -1): + if screen_title == config.BEGIN_PRIME_TITLE: + hd_simulator.cmd_send_pre_treatment_self_test_dry_progress_data(total=300, countdown=count_down) + elif screen_title == config.PRIMING_TITLE: + hd_simulator.cmd_send_pre_treatment_disposables_prime_progress_data(timeout=300, countdown=count_down) + elif screen_title == config.SYSTEM_SELF_TEST_TITLE: + hd_simulator.cmd_send_pre_treatment_self_test_no_cartridge_progress_data(total=300, countdown=count_down) + else: + dg_simulator.cmd_send_dg_pre_treatment_filter_flush_progress_data(total=300, countdown=count_down) actual_time = get_time(screen_title) expected_time = convert_seconds_into_min_and_sec(count_down) test.compare(actual_time, expected_time, "Actual count down time: {} should be equal to expected count down time {}".format(actual_time, expected_time)) @@ -581,9 +597,8 @@ def verify_the_progress(count_down, screen_title): """ - Method to verify the current progress - @param count_down - (int) current count down time, - @param screen_title - (str) current title of the screen + Method to verify the current progress + @param count_down - (int) current count down time, screen_title: (str) current title of the screen """ test.startSection("Verifying the current progress") if screen_title == config.BEGIN_PRIME_TITLE or screen_title == config.PRIMING_TITLE: @@ -596,43 +611,42 @@ expected_progress = config.MAXIMUM_COUNTDOWN_TIME - count_down test.compare(current_progress, expected_progress, "{} should be the current progress".format(expected_progress)) test.endSection() + def verify_page_step_indicator(screen_obj, pre_treatment_step): """ Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] @param pre_treatment_step : indicates the Current pre-treatment step - """ - test.startSection("verification of page step indicators") + """ + for page in range(len(config.PRE_TREATMENT_SCREENS)): bullet_children = object.children(squish.waitForObjectExists(get_bullet_object(screen_obj, page))) bullet_circle_color = bullet_children[0].color.name bullet_border_color = bullet_children[0].border.color.name step_title = squish.waitForObjectExists(get_text_object(screen_obj, config.PRE_TREATMENT_SCREENS[page])) + #To verify the step indicators of the completed pre treatment screens if page < pre_treatment_step: - test.log("To verify the step indicator of the completed pre-treatment screen " + config.PRE_TREATMENT_SCREENS[page]) test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) - test.compare(bullet_circle_color, config.COMPLETE_COLOR, " the bullet color must be " + str(config.COMPLETE_COLOR)) - test.compare(bullet_border_color, config.COMPLETE_COLOR," the bullet border color must be " + str(config.COMPLETE_COLOR)) - test.compare(step_title.color.name, config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) - + test.compare(bullet_circle_color, config.COMPLETE_COLOR) + test.compare(bullet_border_color, config.COMPLETE_COLOR) + test.compare(step_title.color.name, config.ENABLED_COLOR) + #To verify the step indicators of the current pre treatment screen elif page == pre_treatment_step: - test.log("To verify the step indicators of the current pre-treatment screen " + config.PRE_TREATMENT_SCREENS[page]) - test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) + test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) - test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) - test.compare(bullet_border_color,config.COMPLETE_COLOR, " the bullet border color must be " + str(config.COMPLETE_COLOR)) - test.compare(step_title.color.name,config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) - test.verify(step_title.font.bold, " the current text must be in bold") - + test.compare(bullet_circle_color, config.CURRENT_COLOR) + test.compare(bullet_border_color, config.COMPLETE_COLOR) + test.compare(step_title.color.name, config.ENABLED_COLOR) + test.verify(step_title.font.bold) + #To verify the step indicators of the remaining pre-treatment screens else: - test.log("To verify the step indicators of the remaining pre-treatment screen " + config.PRE_TREATMENT_SCREENS[page]) test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete,) - test.compare(step_title.color.name,config.INCOMPLETE_COLOR, " the text color must be " + str(config.INCOMPLETE_COLOR)) - test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) - test.compare(bullet_border_color,config.INCOMPLETE_COLOR, " the bullet border color must be " + str(config.INCOMPLETE_COLOR)) - test.endSection() + test.compare(step_title.color.name, config.INCOMPLETE_COLOR) + test.compare(bullet_circle_color, config.CURRENT_COLOR) + test.compare(bullet_border_color, config.INCOMPLETE_COLOR) + def verify_missing_object(object_to_check): """ @@ -647,13 +661,8 @@ test.passes("object is not present as expected") squish.testSettings.objectNotFoundDebugging = True - + def get_text_object(screen_obj, txt): - """ - Method to return the text object - @param screen_obj: the screen object ,txt: text of the object - @param return the text object - """ names.o_text_object["container"] = screen_obj names.o_text_object["text"] = txt return names.o_text_object @@ -680,14 +689,4 @@ children_obj = object.children(parent_obj) indicator_parent = children_obj[2] indicators = object.children(indicator_parent) - return indicators - -def get_bullet_object(screen_obj, num): - """ - Method to return the bullet object - @param screen_obj: the screen object ,num: the number of bullet occurrence - @param return the bullet object - """ - names.o_bullet_object["container"] = screen_obj - names.o_bullet_object["occurrence"] = num + 1 - return names.o_bullet_object + return indicators \ No newline at end of file