# file tst__pre_treatment_water_sample # date 2022/03/14 # author Akshay Rajaram Dhawan # author Ajina S M # author Amol Shinde # NOTE: # This test contradicts verification of Filter Flush Progress, Screen Titles, Page Step Indicators, Screen navigations, and buttons. import names from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator from dialin.ui.dg_simulator import DGSimulator from configuration import config from configuration import utility from dialin.common.hd_defs import HDOpModes, HDStandbyStates, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates hd_simulator = HDSimulator() dg_simulator = DGSimulator() PRE_TREATMENT_STEP = 1 def verify_pretreatment_filter_flush_screen(): """ Method to navigate to sub mode under pre-treatment screen Navigating to Filter Flush screen """ test.startSection("Verify the Filter Flush screen") hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_PRET.value,PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDStandbyStates.STANDBY_WAIT_FOR_TREATMENT_STATE.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value,consumables_self_test_state=PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_INSTALL_STATE.value, no_cartridge_self_test_state=PreTreatmentNoCartSelfTestStates.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) utility.verify_page_step_indicator(names.o_preTreatmentWaterSampleStack_PreTreatmentBase_TreatmentFlowBase, PRE_TREATMENT_STEP, config.PRE_TREATMENT_SCREENS) utility.verify_countdown(config.FILTER_FLUSH_TITLE, config.TIME_OUT_DURATION_100, hd_simulator, dg_simulator) utility.verify_countdown(config.FILTER_FLUSH_TITLE, config.TIME_OUT_DURATION_200, hd_simulator, dg_simulator) utility.verify_countdown(config.FILTER_FLUSH_TITLE, config.TIME_OUT_DURATION_300, hd_simulator, dg_simulator) test.endSection() def verify_sample_water_state_screens(): """ Method to verify the text and current state of the buttons and verify navigation within screen """ test.startSection("Verify the water sample main screen") hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_PRET.value,PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDStandbyStates.STANDBY_WAIT_FOR_TREATMENT_STATE.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_STATE.value,consumables_self_test_state=PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_INSTALL_STATE.value, no_cartridge_self_test_state=PreTreatmentNoCartSelfTestStates.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) utility.verify_page_step_indicator(names.o_preTreatmentWaterSampleStack_PreTreatmentBase_TreatmentFlowBase,PRE_TREATMENT_STEP, config.PRE_TREATMENT_SCREENS) test.compare(str(waitForObjectExists(names.o_water_sample_button).text), config.WATER_SAMPLE_BUTTON_TEXT,"Water Sample button text should be {}".format(config.WATER_SAMPLE_BUTTON_TEXT)) test.compare(waitForObjectExists(names.o_water_sample_button).enabled , True, "Water Sample button should be enabled") mouseClick(waitForObject(names.o_water_sample_button)) test.compare(waitForObjectExists(names.o_stephead_indicator).enabled, True,"Water Sample indicator should be enabled") test.endSection() test.startSection("Verify the water sample result screen") test.compare(str(waitForObjectExists(names.o_next_button).text), config.NEXT_BUTTON_TEXT, "Next Button text should be {}".format(config.NEXT_BUTTON_TEXT)) test.compare(waitForObjectExists(names.o_next_button).enabled , True,"Next button should be enabled") mouseClick(waitForObject(names.o_next_button_MouseArea)) mouseClick(waitForObject(names.o_next_button)) utility.verify_page_step_indicator(names.o_preTreatmentWaterSampleStack_PreTreatmentBase_TreatmentFlowBase,PRE_TREATMENT_STEP, config.PRE_TREATMENT_SCREENS) test.compare(str(waitForObjectExists(names.o_pass_button).text), config.PASS_TEXT,"Pass button text should be {}".format(config.PASS_TEXT)) test.compare(waitForObjectExists(names.o_pass_button).enabled , True, "Pass button should be enabled") mouseClick(waitForObject(names.o_pass_button)) test.compare(waitForObjectExists(names.o_stephead_indicator).enabled, True,"Verifying Water Sample result indicator should be enabled") test.endSection() test.startSection("Verify the water sample screen for verification of BACK Button and NEXT Button") test.compare(str(waitForObjectExists(names.o_water_sample_back_button).text), config.BACK_BUTTON_TEXT,"Back button text should be {}".format(config.BACK_BUTTON_TEXT)) test.compare(waitForObjectExists(names.o_water_sample_back_button).enabled , True, "Back button should be enabled") mouseClick(waitForObject(names.o_water_sample_back_button)) test.compare(str(waitForObjectExists(names.o_next_button).text), config.NEXT_BUTTON_TEXT, "Next Button text should be {}".format(config.NEXT_BUTTON_TEXT)) test.compare(waitForObjectExists(names.o_next_button).enabled , True,"Next button should be enabled") mouseClick(waitForObject(names.o_next_button_MouseArea)) mouseClick(waitForObject(names.o_next_button)) test.endSection() test.startSection("Verify the water sample result failed screen") test.compare(str(waitForObjectExists(names.o_fail_button).text), config.FAIL_TEXT,"Fail button text should be {}".format(config.FAIL_TEXT)) test.compare(waitForObjectExists(names.o_fail_button).enabled , True, "Fail button should be enabled") mouseClick(waitForObject(names.o_fail_button)) utility.verify_page_step_indicator(names.o_preTreatmentWaterSampleStack_PreTreatmentBase_TreatmentFlowBase,PRE_TREATMENT_STEP, config.PRE_TREATMENT_SCREENS) test.compare(str(waitForObjectExists(names.o_ok_button).text), config.OK_TEXT,"OK button text should be {}".format(config.OK_TEXT)) test.compare(waitForObjectExists(names.o_ok_button).enabled , True, "OK button should be enabled") mouseClick(waitForObject(names.o_ok_button)) test.compare(waitForObjectExists(names.o_stephead_indicator).enabled, True,"Verifying Water result failed indicator should be enabled") hd_simulator.cmd_send_pre_treatment_water_sample_response(accepted=config.ACCEPTED, reason=0) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) verify_pretreatment_filter_flush_screen() verify_sample_water_state_screens() utils.tstDone()