Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r4186205d9358e813dd06d8c892860b74df67ac87 -r6a95bfa0ed2eb2c3358631768e936cef69d648bc --- shared/scripts/configuration/utility.py (.../utility.py) (revision 4186205d9358e813dd06d8c892860b74df67ac87) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 6a95bfa0ed2eb2c3358631768e936cef69d648bc) @@ -21,51 +21,7 @@ from configuration import config from builtins import int as pyInt from configuration.config import * -from dialin.ui.hd_simulator import HDSimulator -from dialin.ui.dg_simulator import DGSimulator - -hd_simulator = HDSimulator() -dg_simulator = DGSimulator() - - -def start_application(app_name): - """ - Function to start application and verify application status [running] - If application does not start or running status is false, test stops - Argument: - @param app_name : (str) - Name of the application - @param app_executable : (str) - Actual application - @return: handle for the application if the application is in running state, - or error (exist the application) - """ - counter = 0 - while True: - try: - counter += 1 - test.log("Starting {}".format(app_name)) - squish.startApplication(app_name) - if counter == 1: - test.log("Application launched at the "+str(counter)+" st try.") - elif counter == 2: - test.log("Application launched at the "+str(counter)+" nd try.") - elif counter == 3: - test.log("Application launched at the "+str(counter)+" rd try.") - else: - test.log("Application launched at the "+str(counter)+" th try.") - break - except RuntimeError: - if counter == 1: - test.log("Application failed to launch after "+str(counter)+" try - Please refer logs") - elif counter == 20: - test.log("Exiting after "+str(counter)+ " tries..") - sys.exit(1) - else: - test.log("Application failed to launch after "+str(counter)+ " tries - Please refer logs") - except: - logErrorDetails("Failed to start the application") - sys.exit(1) - - + def check_if_object_is_within_the_container(obj=None, container=None): """ check if an object is inside a container @@ -145,7 +101,7 @@ time_text = progress_circle_children[1] return time_text.time -def verify_countdown(screen_title): +def verify_countdown(screen_title, hd_simulator , dg_simulator): """ Method to verify the count down time in application @@ -232,20 +188,5 @@ names.o_bullet_object["occurrence"] = num + 1 return names.o_bullet_object - - -def navigate_to_pretreatment_screen(mode): - """ - Method to navigate to sub mode under pre-treatment screen - @param mode - (int) pre treatment state - """ - hd_simulator.cmd_set_hd_operation_mode_data(5,0) - hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=mode, water_sample_state=0,consumables_self_test_state=0, - no_cartridge_self_test_state=0,installation_state=0, dry_self_test_state=0, - prime_state=0,recirculate_state=0, patient_connection_state=0) - - - - Index: tst_pre_treatment_water_sample/test.py =================================================================== diff -u -rf43f15f8f6d0268b93bcf63c00c3dce3e60dcfae -r6a95bfa0ed2eb2c3358631768e936cef69d648bc --- tst_pre_treatment_water_sample/test.py (.../test.py) (revision f43f15f8f6d0268b93bcf63c00c3dce3e60dcfae) +++ tst_pre_treatment_water_sample/test.py (.../test.py) (revision 6a95bfa0ed2eb2c3358631768e936cef69d648bc) @@ -9,53 +9,67 @@ 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,PreTreatmentSampleWaterStates,PreTreatmentSubModes +from dialin.common.hd_defs import HDOpModes, HDOpSubModes, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestsStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates - hd_simulator = HDSimulator() -PRE_TREATMENT_STEP= 1 +dg_simulator = DGSimulator() -def verify_sample_water_state_screens(): +PRE_TREATMENT_STEP = 1 + +def verify_pretreatment_filter_flush_screen(): """ - Method to verify the text and current state of the buttons and verify navigation within screen + Method to navigate to sub mode under pre-treatment screen + Navigating to Filter Flush screen """ hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_PRET.value,PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value) - - test.log("Navigating to water sample main screen for verification") - hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=1, water_sample_state=1,consumables_self_test_state=0, - no_cartridge_self_test_state=0,installation_state=0, dry_self_test_state=0, - prime_state=0,recirculate_state=0, patient_connection_state=0) + hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_TREATMENT.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=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.startSection("Verify the Filter Flush screen") + utility.verify_page_step_indicator(names.o_preTreatmentWaterSampleStack_PreTreatmentBase_TreatmentFlowBase_2,PRE_TREATMENT_STEP) + utility.verify_countdown(config.FILTER_FLUSH_TITLE,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 + """ + 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=HDOpSubModes.SUBMODE_WAIT_FOR_TREATMENT.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=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.startSection("Verify the water sample main screen") utility.verify_page_step_indicator(names.o_preTreatmentWaterSampleStack_PreTreatmentBase_TreatmentFlowBase_2,PRE_TREATMENT_STEP) 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.log("Navigating to water sample result screen") + 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)) - + mouseClick(waitForObject(names.o_next_button)) utility.verify_page_step_indicator(names.o_preTreatmentWaterSampleStack_PreTreatmentBase_TreatmentFlowBase_2,PRE_TREATMENT_STEP) 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.log("Navigating to water sample screen for verification of back button") + test.endSection() + + test.startSection("Verify the water sample screen for verification of BACK Button and NEXT Button") test.compare(str(waitForObjectExists(names.o_back_button).text), config.BACK_BUTTON_TEXT,"Back button text should be {}".format(config.BACK_BUTTON_TEXT)) test.compare(waitForObjectExists(names.o_back_button).enabled , True, "Back button should be enabled") mouseClick(waitForObject(names.o_back_button)) - - test.log("Navigating to 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)) + test.endSection() - test.log("Navigating to water sample result failed screen") + 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)) @@ -65,15 +79,13 @@ 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") - + test.endSection() + def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) - test.log("Navigating to Filter Flush screen") - utility.navigate_to_pretreatment_screen(PreTreatmentSubModes.HD_PRE_TREATMENT_WATER_SAMPLE_STATE.value) - utility.verify_page_step_indicator(names.o_preTreatmentWaterSampleStack_PreTreatmentBase_TreatmentFlowBase_2,PRE_TREATMENT_STEP) - utility.verify_countdown(config.FILTER_FLUSH_TITLE) + verify_pretreatment_filter_flush_screen() verify_sample_water_state_screens() utils.tstDone()