Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r4c7da7b76580595a20681353543bc99573f94f69 -r2a19cd281aed2c1f5ff192e1d147a35ba571ccc6 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 4c7da7b76580595a20681353543bc99573f94f69) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 2a19cd281aed2c1f5ff192e1d147a35ba571ccc6) @@ -18,6 +18,7 @@ import test import squish from configuration.config import * +from configuration import config from builtins import int as pyInt from dialin.ui.hd_simulator import HDSimulator @@ -167,56 +168,70 @@ @param pre_treatment_step : indicates the Current pre-treatment step """ - for page in range(len(PRE_TREATMENT_SCREENS)): + 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, PRE_TREATMENT_SCREENS[page])) - #To verify the step indicators of the completed pre treatment screens + step_title = squish.waitForObjectExists(get_text_object(screen_obj, config.PRE_TREATMENT_SCREENS[page])) + 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, COMPLETE_COLOR) - test.compare(bullet_border_color, COMPLETE_COLOR) - test.compare(step_title.color.name, ENABLED_COLOR) - #To verify the step indicators of the current pre treatment screen + 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)) + elif page == pre_treatment_step: - test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) + 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(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) - test.compare(bullet_circle_color, CURRENT_COLOR) - test.compare(bullet_border_color, COMPLETE_COLOR) - test.compare(step_title.color.name, ENABLED_COLOR) - test.verify(step_title.font.bold) - #To verify the step indicators of the remaining pre-treatment screens + 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") + 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, INCOMPLETE_COLOR) - test.compare(bullet_circle_color, CURRENT_COLOR) - test.compare(bullet_border_color, INCOMPLETE_COLOR) - - -def verification_of_missing_object(object_to_check): - """ To verify the given object is invisible or is not present on the screen - @param object_to_check: the object whose invisbility must be verified - """ - try: - squish.testSettings.objectNotFoundDebugging = False - squish.waitForObject(object_to_check,3000) - test.fail("Given object should not be present initially") - except LookupError as _: - test.passes("object is not present as expected") - - squish.testSettings.objectNotFoundDebugging = True + 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() - def get_text_object(screen_obj, txt): + """ + To obtain a text object based on text provided + @param screen_obj: provides the container on which the txt must be present + @returns a real name object + """ names.o_text_object["container"] = screen_obj names.o_text_object["text"] = txt return names.o_text_object -def get_bullet_object(screen_obj, num): +def get_bullet_object(screen_obj, num): + """ + To obtain a bullet object based on occurrence provided. + @param screen_obj: provides the container on which the bullet must be present + @param num: provides the occurrence value + @returns a real name object + """ names.o_bullet_object["container"] = screen_obj names.o_bullet_object["occurrence"] = num + 1 return names.o_bullet_object + +def get_indicators(screen_obj, txt): + """ + Verifying the busy indicators for BiCarb Pump Check and Acid Pump Check. + indicator object of expected txt + @param step - (str) expected txt + @return indicators - (obj) list of busy and check indicator + """ + parent_obj = object.parent(squish.waitForObjectExists(get_text_object(screen_obj,txt))) + children_obj = object.children(parent_obj) + indicator_parent = children_obj[2] + indicators = object.children(indicator_parent) + return indicators Index: tst_pre_treatment_priming/test.py =================================================================== diff -u -r356c41ba814b3e3ea96707c21a7eb2dd0136ac18 -r2a19cd281aed2c1f5ff192e1d147a35ba571ccc6 --- tst_pre_treatment_priming/test.py (.../test.py) (revision 356c41ba814b3e3ea96707c21a7eb2dd0136ac18) +++ tst_pre_treatment_priming/test.py (.../test.py) (revision 2a19cd281aed2c1f5ff192e1d147a35ba571ccc6) @@ -16,10 +16,12 @@ import names -from configuration.config import * -from configuration.utility import * +from configuration import config, utility from dialin.ui import utils +from dialin.ui.hd_simulator import HDSimulator +hd_simulator = HDSimulator() + PRE_TREATMENT_STEP = 4 SELF_TEST_DRY_STATES = {"DRY_SELF_TESTS_STATE" : 0, "DRY_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE" : 1, @@ -47,10 +49,10 @@ is displayed """ test.startSection("Navigating to self test dry screen and verify the 'Begin Prime' title is displayed") - navigate_to_pretreatment_screen(5) - title = (waitForObjectExists(self_test_dry_check_list_text(BEGIN_PRIME_TITLE))).text - test.compare(title, BEGIN_PRIME_TITLE, "{} title should be displayed when user is navigating to self test dry screen".format(BEGIN_PRIME_TITLE)) - page_step_indicator_verification(names.o_PreTreatmentStack_PreTreatmentPrimeStack_PreTreatmentPrimeStack, PRE_TREATMENT_STEP) + utility.navigate_to_pretreatment_screen(5) + title = (waitForObjectExists(utility.self_test_dry_check_list_text(config.BEGIN_PRIME_TITLE))).text + test.compare(title, config.BEGIN_PRIME_TITLE, "{} title should be displayed when user is navigating to self test dry screen".format(config.BEGIN_PRIME_TITLE)) + utility.page_step_indicator_verification(names.o_PreTreatmentStack_PreTreatmentPrimeStack_PreTreatmentPrimeStack, PRE_TREATMENT_STEP) test.endSection() @@ -61,10 +63,10 @@ is displayed """ test.startSection("Navigating to priming screen and verify the begin 'Priming' title is displayed") - navigate_to_pretreatment_screen(6) - title = (waitForObject(self_test_dry_check_list_text(PRIMING_TITLE))).text - test.compare(title, PRIMING_TITLE, "{} title should be displayed when user is navigating to 'Priming' screen".format(PRIMING_TITLE)) - page_step_indicator_verification(names.o_PreTreatmentStack_PreTreatmentPrimeStack_PreTreatmentPrimeStack, PRE_TREATMENT_STEP) + utility.navigate_to_pretreatment_screen(6) + title = (waitForObject(utility.self_test_dry_check_list_text(config.PRIMING_TITLE))).text + test.compare(title, config.PRIMING_TITLE, "{} title should be displayed when user is navigating to 'Priming' screen".format(config.PRIMING_TITLE)) + utility.page_step_indicator_verification(names.o_PreTreatmentStack_PreTreatmentPrimeStack_PreTreatmentPrimeStack, PRE_TREATMENT_STEP) test.endSection() @@ -84,30 +86,30 @@ if (state == "DRY_SELF_TESTS_STATE") or (state == "DRY_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE"): verify_the_indicators(None, TEST_DRY_STEPS) elif state == "DRY_SELF_TESTS_USED_CARTIDGE_CHECK_STATE": - verify_the_indicators(BUSY, "Used Cartridge Check") + verify_the_indicators(config.BUSY, "Used Cartridge Check") elif state == "DRY_SELF_TESTS_OCCLUSION_SENSORS_STATE": - verify_the_indicators(CHECK, "Used Cartridge Check") - verify_the_indicators(BUSY, "Occlusion Sensors Check") + verify_the_indicators(config.CHECK, "Used Cartridge Check") + verify_the_indicators(config.BUSY, "Occlusion Sensors Check") elif (state == "DRY_SELF_TESTS_PRESSURE_SENSORS_SETUP_STATE") or (state == "DRY_SELF_TESTS_PRESSURE_SENSORS_STATE") or (state == "DRY_SELF_TESTS_PRESSURE_SENSORS_NORMAL_STATE"): - verify_the_indicators(CHECK, "Used Cartridge Check") - verify_the_indicators(CHECK, "Occlusion Sensors Check") - verify_the_indicators(BUSY, "Pressure Sensors Check") + verify_the_indicators(config.CHECK, "Used Cartridge Check") + verify_the_indicators(config.CHECK, "Occlusion Sensors Check") + verify_the_indicators(config.BUSY, "Pressure Sensors Check") elif state == "DRY_SELF_TESTS_SYRINGE_PUMP_PRIME_STATE": - verify_the_indicators(CHECK, "Used Cartridge Check") - verify_the_indicators(CHECK, "Occlusion Sensors Check") - verify_the_indicators(CHECK, "Pressure Sensors Check") - verify_the_indicators(BUSY, "Syringe Pump Check") + verify_the_indicators(config.CHECK, "Used Cartridge Check") + verify_the_indicators(config.CHECK, "Occlusion Sensors Check") + verify_the_indicators(config.CHECK, "Pressure Sensors Check") + verify_the_indicators(config.BUSY, "Syringe Pump Check") elif state == "DRY_SELF_TESTS_STOPPED_STATE": - verify_the_indicators(CHECK, "Used Cartridge Check") - verify_the_indicators(CHECK, "Occlusion Sensors Check") - verify_the_indicators(CHECK, "Pressure Sensors Check") - verify_the_indicators(CHECK, "Syringe Pump Check") + verify_the_indicators(config.CHECK, "Used Cartridge Check") + verify_the_indicators(config.CHECK, "Occlusion Sensors Check") + verify_the_indicators(config.CHECK, "Pressure Sensors Check") + verify_the_indicators(config.CHECK, "Syringe Pump Check") verify_completion_message_and_indicator(False, SELF_TEST_COMPLETION_MSG) else: - verify_the_indicators(CHECK, "Used Cartridge Check") - verify_the_indicators(CHECK, "Occlusion Sensors Check") - verify_the_indicators(CHECK, "Pressure Sensors Check") - verify_the_indicators(BUSY, "Syringe Pump Check") + verify_the_indicators(config.CHECK, "Used Cartridge Check") + verify_the_indicators(config.CHECK, "Occlusion Sensors Check") + verify_the_indicators(config.CHECK, "Pressure Sensors Check") + verify_the_indicators(config.BUSY, "Syringe Pump Check") verify_completion_message_and_indicator(True, SELF_TEST_COMPLETION_MSG) test.endSection() test.endSection() @@ -126,11 +128,11 @@ consumables_self_test_state=0, no_cartridge_self_test_state=0, installation_state=0, dry_self_test_state=0, prime_state=0, recirculate_state=index, patient_connection_state=0) - verify_the_indicators(CHECK, "Blood Circuit Priming") - verify_the_indicators(CHECK, "Dialysate Circuit Priming") - verify_the_indicators(BUSY, "Wet Self Tests") + verify_the_indicators(config.CHECK, "Blood Circuit Priming") + verify_the_indicators(config.CHECK, "Dialysate Circuit Priming") + verify_the_indicators(config.BUSY, "Wet Self Tests") verify_completion_message_and_indicator(True, PRIMING_COMPLETE_MSG) - verify_the_continue_button(ENABLED) + verify_the_continue_button(config.ENABLED) test.endSection() test.endSection() @@ -148,33 +150,33 @@ installation_state=0, dry_self_test_state=0, prime_state=index, recirculate_state=0, patient_connection_state=0) if (state == "HD_PRIME_START_STATE") or (state == "HD_PRIME_WAIT_FOR_USER_START_STATE") or (state == "HD_PRIME_SALINE_SETUP_STATE") or (state == "HD_PRIME_SALINE_PURGE_AIR_STATE"): - verify_the_indicators(indicator=None, steps=PRIMING_STEPS) + verify_the_indicators(None, PRIMING_STEPS) if state == "HD_PRIME_WAIT_FOR_USER_START_STATE": - verify_the_start_priming_button(ENABLED) + verify_the_start_priming_button(config.ENABLED) else: - verify_the_start_priming_button(DISABLED) - verify_the_continue_button(DISABLED) + verify_the_start_priming_button(config.DISABLED) + verify_the_continue_button(config.DISABLED) elif (state == "HD_PRIME_SALINE_CIRC_BLOOD_CIRCUIT_STATE") or (state == "HD_PRIME_RESERVOIR_ONE_FILL_COMPLETE_STATE") or (state == "HD_PRIME_DIALYSATE_DIALYSER_STATE"): - verify_the_indicators(BUSY, "Blood Circuit Priming") - verify_the_start_priming_button(DISABLED) - verify_the_continue_button(DISABLED) + verify_the_indicators(config.BUSY, "Blood Circuit Priming") + verify_the_start_priming_button(config.DISABLED) + verify_the_continue_button(config.DISABLED) elif (state == "HD_PRIME_RESERVOIR_TWO_FILL_COMPLETE_STATE") or (state == "HD_PRIME_DIALYSATE_BYPASS_STATE"): - verify_the_indicators(CHECK, "Blood Circuit Priming") - verify_the_indicators(BUSY, "Dialysate Circuit Priming") - verify_the_start_priming_button(DISABLED) - verify_the_continue_button(DISABLED) + verify_the_indicators(config.CHECK, "Blood Circuit Priming") + verify_the_indicators(config.BUSY, "Dialysate Circuit Priming") + verify_the_start_priming_button(config.DISABLED) + verify_the_continue_button(config.DISABLED) elif (state == "HD_PRIME_WET_SELF_TESTS_STATE") or (state == "HD_PRIME_PAUSE"): - verify_the_indicators(CHECK, "Blood Circuit Priming") - verify_the_indicators(CHECK, "Dialysate Circuit Priming") - verify_the_start_priming_button(DISABLED) - verify_the_continue_button(DISABLED) + verify_the_indicators(config.CHECK, "Blood Circuit Priming") + verify_the_indicators(config.CHECK, "Dialysate Circuit Priming") + verify_the_start_priming_button(config.DISABLED) + verify_the_continue_button(config.DISABLED) else: - verify_the_indicators(CHECK, "Blood Circuit Priming") - verify_the_indicators(CHECK, "Dialysate Circuit Priming") - verify_the_indicators(BUSY, "Wet Self Tests") - verify_the_start_priming_button(DISABLED) + verify_the_indicators(config.CHECK, "Blood Circuit Priming") + verify_the_indicators(config.CHECK, "Dialysate Circuit Priming") + verify_the_indicators(config.BUSY, "Wet Self Tests") + verify_the_start_priming_button(config.DISABLED) verify_completion_message_and_indicator(False, PRIMING_COMPLETE_MSG) - verify_the_continue_button(DISABLED) + verify_the_continue_button(config.DISABLED) test.endSection() test.endSection() @@ -186,7 +188,7 @@ @param step - (str) expected step @return indicators - (obj) list of busy and check indicator """ - parent_obj = object.parent(waitForObjectExists(self_test_dry_check_list_text(step))) + parent_obj = object.parent(waitForObjectExists(utility.self_test_dry_check_list_text(step))) children_obj = object.children(parent_obj) indicator_parent = children_obj[2] indicators = object.children(indicator_parent) @@ -203,15 +205,15 @@ test.startSection("Verify indicator is displayed for {}".format(steps)) if indicator != None: busy_indicator, check_indicator = get_indicators(steps) - if indicator is BUSY: - test.compare(busy_indicator.visible, VISIBLE, "{} indicator should display next to the {}".format(indicator, steps)) - elif indicator is CHECK: - test.compare(check_indicator.visible, VISIBLE, "{} indicator should display next to the {}".format(indicator, steps)) + if indicator is config.BUSY: + test.compare(busy_indicator.visible, config.VISIBLE, "{} indicator should display next to the {}".format(indicator, steps)) + elif indicator is config.CHECK: + test.compare(check_indicator.visible, config.VISIBLE, "{} indicator should display next to the {}".format(indicator, steps)) else: for step in steps: busy_indicator, check_indicator = get_indicators(step) - test.compare(busy_indicator.visible, NOT_VISIBLE, "No indicator should display next to the {}".format(step)) - test.compare(check_indicator.visible, NOT_VISIBLE, "No indicator should display next to the {}".format(step)) + test.compare(busy_indicator.visible, config.NOT_VISIBLE, "No indicator should display next to the {}".format(step)) + test.compare(check_indicator.visible, config.NOT_VISIBLE, "No indicator should display next to the {}".format(step)) test.endSection() @@ -227,13 +229,13 @@ check_indicator = object.children(findObject(names.o_self_test_dry_progress_circle)) check_indicator = objectMap.realName(check_indicator[2]) if completed: - completion_msg = waitForObjectExists(self_test_dry_check_list_text(msg)) - test.compare(completion_msg.visible, VISIBLE, "{} message should be displayed".format(msg)) + completion_msg = waitForObjectExists(utility.self_test_dry_check_list_text(msg)) + test.compare(completion_msg.visible, config.VISIBLE, "{} message should be displayed".format(msg)) test.compare(completion_msg.text, msg, "Completion message should be {}".format(msg)) if object.exists(check_indicator): test.passes("Check indicator should display on progress circle upon completion") else: - if object.exists(self_test_dry_check_list_text(msg)) is False: + if object.exists(utility.self_test_dry_check_list_text(msg)) is False: test.passes("{} message should not display".format(msg)) test.endSection() @@ -247,9 +249,9 @@ test.startSection("Verifying the 'Start Prime' button is enabled or disabled") start_prime_btn = waitForObjectExists(names.o_start_prime_btn) if expected_state: - test.compare(start_prime_btn.enabled, ENABLED, "'Start Prime' should be enabled") + test.compare(start_prime_btn.enabled, config.ENABLED, "'Start Prime' should be enabled") else: - test.compare(start_prime_btn.enabled, DISABLED, "'Start Prime' should be disabled") + test.compare(start_prime_btn.enabled, config.DISABLED, "'Start Prime' should be disabled") test.endSection() @@ -262,26 +264,26 @@ test.startSection("Verifying the 'Continue' button is enabled or disabled") continue_btn = waitForObjectExists(names.o_continue_btn) if expected_state: - test.compare(continue_btn.enabled, ENABLED, "'Continue' should be enabled") + test.compare(continue_btn.enabled, config.ENABLED, "'Continue' should be enabled") else: - test.compare(continue_btn.enabled, DISABLED, "'Continue' should be disabled") + test.compare(continue_btn.enabled, config.DISABLED, "'Continue' should be disabled") test.endSection() def main(): utils.tstStart(__file__) - startApplication(AUT_NAME) + startApplication(config.AUT_NAME) test.startSection("Verifying 'Self Dry Test' screen") navigate_self_test_dry_screen() - verify_the_countdown(BEGIN_PRIME_TITLE) + utility.verify_the_countdown(config.BEGIN_PRIME_TITLE) verify_dry_states() test.endSection() test.startSection("Verifying 'Priming' screen") navigate_to_priming_screen() - verify_the_countdown(PRIMING_TITLE) + utility.verify_the_countdown(config.PRIMING_TITLE) verify_priming_states() verify_priming_recirculate_states() test.endSection()