Index: tst_pre_treatment_consumables/test.py =================================================================== diff -u -refab64294d8971b8a8b2d5729995cb4dc54e8379 -r8599e463aedf05d6a36824ca4eba62d914a5db5c --- tst_pre_treatment_consumables/test.py (.../test.py) (revision efab64294d8971b8a8b2d5729995cb4dc54e8379) +++ tst_pre_treatment_consumables/test.py (.../test.py) (revision 8599e463aedf05d6a36824ca4eba62d914a5db5c) @@ -21,14 +21,15 @@ import names from dialin.ui import utils -from configuration import config, utility +from configuration import config, utility, strings from dialin.ui.hd_simulator import HDSimulator from dialin.ui.utils import waitForGUI -from dialin.common.hd_defs import PreTreatmentSubModes, PreTreatmentConsumableSelfTestStates, HDOpModes, HDOpSubModes, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestsStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates +from dialin.common.hd_defs import PreTreatmentSubModes, PreTreatmentConsumableSelfTestStates, HDOpModes, HDOpSubModes, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestsStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates,\ + PreTreatmentModeStates hd_simulator = HDSimulator() -PRE_TREATMENT_STEP= 2 +PRE_TREATMENT_STEP = PreTreatmentModeStates.HD_PRE_TREATMENT_SELF_TEST_CONSUMABLE_STATE.value num_of_instructions = 0 SCREEN_OBJ= names.o_PreTreatmentStack_preTreatmentConsumablesStack_PreTreatmentConsumablesStack @@ -48,59 +49,59 @@ """ The method is used to verify the functionality of the right arrow in the instruction navigation, as well as the visibility of the two arrows """ - test.startSection(" rightward instruction navigation") - test.verify(not object.exists(names.o_PreTreatmentBase_leftImage_Image), " The left arrow must be missing") + test.startSection("Rightward instruction navigation") + test.verify(not object.exists(names.o_PreTreatmentBase_leftImage_Image), "The left navigation arrow should not be present on the first screen of instruction") for indicator in range(1,num_of_instructions + 1): verify_bullet_navigation(indicator) if indicator != num_of_instructions: mouseClick(waitForObject(names.o_PreTreatmentBase_rightImage_Image)) - test.verify(not object.exists(names.o_PreTreatmentBase_rightImage_Image), " The right arrow must be missing") + test.verify(not object.exists(names.o_PreTreatmentBase_rightImage_Image), "The right navigation arrow should not be present on the last screen of instruction") test.endSection() def verify_left_instruction_navigation(): """ The method is used to verify the functionality of the left arrow in the instruction navigation, as well as the visibility of the two arrows """ - test.startSection(" leftward instruction navigation") - test.verify(not object.exists(names.o_PreTreatmentBase_rightImage_Image), " The right arrow must be missing") + test.startSection("Leftward instruction navigation") + test.verify(not object.exists(names.o_PreTreatmentBase_rightImage_Image), "The right navigation arrow should not be present on the last screen of instruction") for indicator in range(num_of_instructions, 0, -1): verify_bullet_navigation(indicator) if indicator != 1: mouseClick(waitForObject(names.o_PreTreatmentBase_leftImage_Image)) - test.verify(not object.exists(names.o_PreTreatmentBase_leftImage_Image), " The left arrow must be missing") + test.verify(not object.exists(names.o_PreTreatmentBase_leftImage_Image), "The left navigation arrow should not be present on the first screen of instruction") test.endSection() def verify_bullet_navigation(num): """ This method verifies the properties of the bullets present in the instruction navigation screen """ - test.startSection(" instruction bullet verification for screens " + str(num)) + test.startSection("Instruction bullet verification for screens " + str(num)) for instruction in range(1,num_of_instructions + 1): bullet_children = object.children(waitForObjectExists(utility.get_bullet_object(SCREEN_OBJ,(config.NUM_OF_PRETREATMENT_BULLETS + instruction) - 1))) bullet_circle_color = bullet_children[0].color.name bullet_border_color = bullet_children[0].border.color.name if instruction <= num: - test.compare(bullet_circle_color, config.COMPLETE_COLOR) - test.compare(bullet_border_color,config.COMPLETE_COLOR) + test.compare(bullet_circle_color, strings.COMPLETE_COLOR) + test.compare(bullet_border_color,strings.COMPLETE_COLOR) test.log("The bullet " + str(instruction) + " must be a complete bullet") else: - test.compare(bullet_circle_color, config.CURRENT_COLOR) - test.compare(bullet_border_color,config.INCOMPLETE_COLOR) + test.compare(bullet_circle_color, strings.CURRENT_COLOR) + test.compare(bullet_border_color,strings.INCOMPLETE_COLOR) test.log("The bullet " + str(instruction) + " must be a incomplete bullet") test.endSection() def verify_consumable_states_text(): """ Method is to verify the Consumables Self test states' text. """ - test.compare(waitForObjectExists(names.o_PreTreatmentBase_Consumables_Self_Test_Text).text ,config.CONSUMABLE_SELF_TEST_TEXT," text must be " + config.CONSUMABLE_SELF_TEST_TEXT) - test.compare(waitForObjectExists(names.o_PreTreatmentBase_BiCarb_Pump_Check_Text).text, config.BICARB_PUMP_CHECK_TEXT," text must be " + config.BICARB_PUMP_CHECK_TEXT) - test.compare(waitForObjectExists(names.o_PreTreatmentBase_Acid_Pump_Check_Text).text,config.ACID_PUMP_CHECK_TEXT, " text must be from" + config.ACID_PUMP_CHECK_TEXT) - test.compare(waitForObjectExists(names.o_PreTreatmentBase_Self_Test_Complete_Text).text,config.SELF_TEST_COMPLETE_TEXT," must be " + config.SELF_TEST_COMPLETE_TEXT ) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_Consumables_Self_Test_Text).text ,strings.CONSUMABLE_SELF_TEST_TEXT," text must be " + strings.CONSUMABLE_SELF_TEST_TEXT) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_BiCarb_Pump_Check_Text).text, strings.BICARB_PUMP_CHECK_TEXT," text must be " + strings.BICARB_PUMP_CHECK_TEXT) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_Acid_Pump_Check_Text).text,strings.ACID_PUMP_CHECK_TEXT, " text must be from" + strings.ACID_PUMP_CHECK_TEXT) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_Self_Test_Complete_Text).text,strings.SELF_TEST_COMPLETE_TEXT," must be " + strings.SELF_TEST_COMPLETE_TEXT ) def verify_consumables_states(): """ @@ -109,14 +110,14 @@ Acid Pump Check Self Test Complete. """ - test.startSection("Check and busy indicator shouldn't be present") - for states in range (config.CONSUMABLE_SELF_TEST_BICARB_PUMP_CHECK_STATE): - test.startSection(" consumable self test state = " + str(states)) + test.startSection("Check and busy indicator shouldn't be present initially") + for states in range (PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_ACID_PUMP_CHECK_STATE.value): + test.startSection(" consumable self test state = " + PreTreatmentConsumableSelfTestStates(states).name) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value,consumables_self_test_state=PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_BICARB_PUMP_CHECK_STATE.value, no_cartridge_self_test_state=PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value,installation_state=PreTreatmentCartridgeInstallStates.CARTRIDGE_INSTALL_STATE.value, dry_self_test_state=PreTreatmentDrySelfTestsStates.DRY_SELF_TESTS_START_STATE.value, prime_state=PreTreatmentPrimeStates.HD_PRIME_START_STATE.value,recirculate_state=PreTreatmentRecircStates.PRE_TREATMENT_RECIRC_STATE.value, patient_connection_state=PreTreatmentPatientConnectionStates.PATIENT_CONNECTION_STATE.value) - bicarb_indicator=utility.get_indicators(SCREEN_OBJ,config.BICARB_PUMP_CHECK_TEXT) - acid_indicator=utility.get_indicators(SCREEN_OBJ,config.ACID_PUMP_CHECK_TEXT) + bicarb_indicator=utility.get_indicators(SCREEN_OBJ,strings.BICARB_PUMP_CHECK_TEXT) + acid_indicator=utility.get_indicators(SCREEN_OBJ,strings.ACID_PUMP_CHECK_TEXT) test.verify(not bicarb_indicator[0].visible, " busy indicator for bicarb pump must not be present") test.verify(not bicarb_indicator[1].visible, " check indicator for bicarb pump must not be present") test.verify(not acid_indicator[0].visible , " busy indicator for acid pump must not be present") @@ -125,40 +126,40 @@ test.endSection() test.startSection("Verification of Check and busy indicators") - test.log(" consumable self test state = 3") + test.log(" consumable self test state = " + PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_ACID_PUMP_CHECK_STATE.name) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value,consumables_self_test_state=PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_ACID_PUMP_CHECK_STATE.value, no_cartridge_self_test_state=PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value,installation_state=PreTreatmentCartridgeInstallStates.CARTRIDGE_INSTALL_STATE.value, dry_self_test_state=PreTreatmentDrySelfTestsStates.DRY_SELF_TESTS_START_STATE.value, prime_state=PreTreatmentPrimeStates.HD_PRIME_START_STATE.value,recirculate_state=PreTreatmentRecircStates.PRE_TREATMENT_RECIRC_STATE.value, patient_connection_state=PreTreatmentPatientConnectionStates.PATIENT_CONNECTION_STATE.value) - bicarb_indicator=utility.get_indicators(SCREEN_OBJ,config.BICARB_PUMP_CHECK_TEXT) - acid_indicator=utility.get_indicators(SCREEN_OBJ,config.ACID_PUMP_CHECK_TEXT) + bicarb_indicator=utility.get_indicators(SCREEN_OBJ,strings.BICARB_PUMP_CHECK_TEXT) + acid_indicator=utility.get_indicators(SCREEN_OBJ,strings.ACID_PUMP_CHECK_TEXT) test.verify(waitForObject(bicarb_indicator[0]).visible,"The Busy indicator for BiCarb Pump must be visible") test.verify(not acid_indicator[0].visible," busy indicator for acid pump must not be present") test.verify(not acid_indicator[1].visible," check indicator for acid pump must not be present") - test.log(" consumable self test state = 4") + test.log(" consumable self test state = " + PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_COMPLETE_STATE.name) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value,consumables_self_test_state=PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_COMPLETE_STATE.value, no_cartridge_self_test_state=PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value,installation_state=PreTreatmentCartridgeInstallStates.CARTRIDGE_INSTALL_STATE.value, dry_self_test_state=PreTreatmentDrySelfTestsStates.DRY_SELF_TESTS_START_STATE.value, prime_state=PreTreatmentPrimeStates.HD_PRIME_START_STATE.value,recirculate_state=PreTreatmentRecircStates.PRE_TREATMENT_RECIRC_STATE.value, patient_connection_state=PreTreatmentPatientConnectionStates.PATIENT_CONNECTION_STATE.value) - bicarb_indicator=utility.get_indicators(SCREEN_OBJ,config.BICARB_PUMP_CHECK_TEXT) - acid_indicator=utility.get_indicators(SCREEN_OBJ,config.ACID_PUMP_CHECK_TEXT) + bicarb_indicator=utility.get_indicators(SCREEN_OBJ,strings.BICARB_PUMP_CHECK_TEXT) + acid_indicator=utility.get_indicators(SCREEN_OBJ,strings.ACID_PUMP_CHECK_TEXT) test.verify(waitForObject(bicarb_indicator[1]).visible,"The check indicator for Bicarb Pump must be visible") test.log("BiCarb Pump Check is completed") test.verify(waitForObject(acid_indicator[0]).visible,"The Busy indicator for Acid Pump must be visible") - test.log(" consumable self test state = 5") + test.log(" consumable self test state = " + PreTreatmentConsumableSelfTestStates.NUM_OF_CONSUMABLE_SELF_TESTS_STATES.name) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value,consumables_self_test_state=PreTreatmentConsumableSelfTestStates.NUM_OF_CONSUMABLE_SELF_TESTS_STATES.value, no_cartridge_self_test_state=PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value,installation_state=PreTreatmentCartridgeInstallStates.CARTRIDGE_INSTALL_STATE.value, dry_self_test_state=PreTreatmentDrySelfTestsStates.DRY_SELF_TESTS_START_STATE.value, prime_state=PreTreatmentPrimeStates.HD_PRIME_START_STATE.value,recirculate_state=PreTreatmentRecircStates.PRE_TREATMENT_RECIRC_STATE.value, patient_connection_state=PreTreatmentPatientConnectionStates.PATIENT_CONNECTION_STATE.value) test.log("Verification for Acid Pump check is done") - bicarb_indicator=utility.get_indicators(SCREEN_OBJ,config.BICARB_PUMP_CHECK_TEXT) - acid_indicator=utility.get_indicators(SCREEN_OBJ,config.ACID_PUMP_CHECK_TEXT) + bicarb_indicator=utility.get_indicators(SCREEN_OBJ,strings.BICARB_PUMP_CHECK_TEXT) + acid_indicator=utility.get_indicators(SCREEN_OBJ,strings.ACID_PUMP_CHECK_TEXT) test.verify(bicarb_indicator[1].visible) test. verify(acid_indicator[1].visible) test.verify(waitForObjectExists(names.o_PreTreatmentBase_Self_Test_Complete_Text).visible) test.log("Self test complete for consumables is done") - test.compare(waitForObjectExists(names.o_PreTreatmentBase_Self_Test_Complete_Text).text,config.SELF_TEST_COMPLETE_TEXT," text must be " + config.SELF_TEST_COMPLETE_TEXT ) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_Self_Test_Complete_Text).text,strings.SELF_TEST_COMPLETE_TEXT," text must be " + strings.SELF_TEST_COMPLETE_TEXT ) test.endSection() def main(): @@ -183,7 +184,7 @@ test.endSection() test.startSection("verification of consumable self test ") - test.verify(not object.exists(names.o_PreTreatmentBase_Self_Test_Complete_Text),config.SELF_TEST_COMPLETE_TEXT + " must not be present ") + test.verify(not object.exists(names.o_PreTreatmentBase_Self_Test_Complete_Text),strings.SELF_TEST_COMPLETE_TEXT + " must not be present ") verify_consumables_states() verify_consumable_states_text() test.endSection()