# -*- coding: utf-8 -*-" # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_In_treatment # date 2020/03/18 # author Amrita Debnath # Sai Chaitanya Ela # Shweta Policepatil import names from configuration import config from configuration import utility from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator from dialin.ui.dg_simulator import DGSimulator from dialin.common.hd_defs import HDOpModes, HDOpSubModes, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestsStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates hd_simulator = HDSimulator() dg_simulator = DGSimulator() PRE_TREATMENT_STEP = 3 NUM_OF_PRETREATMENT_BULLETS = len(config.PRE_TREATMENT_SCREENS) SCREEN_OBJ = names.o_PreTreatmentStack_preTreatmentDisposablesStack_PreTreatmentDisposablesStack CARTRIDGE_INSTALLATION = 1 CARTRIDGE_CONNECTION = 2 HEPARIN_SYRINGE = 3 SALINE_BAG = 4 NUM_OF_CARTRIDGE_INSTALLATION_SCREENS = 4 NUM_OF_CARTRIDGE_CONNECTION_SCREENS = 5 NUM_OF_HEPARIN_SYRINGE_SCREENS = 1 NUM_OF_SALINE_BAG_SCREENS = 2 CARTRIDGE_INSTALLATION_TEXT = "Open the front panel door." CARTRIDGE_CONNECTION_TEXT = "Connect the cartridge blood lines to the dialyzer." HEPARIN_SYRINGE_TEXT = "Fill a syringe with heparin and connect the cartridge heparin tubing line. \nInsert syringe into infusion pump housing." time_interval = "25min" BP_HR_PRE_TREATMENT_STEPS = 6 ven_low = 40 ven_high = 400 art_low = -240 art_high = -20 def verify_disposables_screen(): """ Method to navigate to disposables and verify 'System Self Test' title is displayed """ test.startSection("Navigating to disposables screen and verifying 'System Self Test' title is displayed") hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_PRET.value,PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.STANDBY_WAIT_FOR_DG_FLUSH_CMD_RESPONSE_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=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.compare(waitForObject(names.o_system_test_text).text, config.SYSTEM_SELF_TEST_TITLE, "'{} title should displayed when user is navigated to disposable screen".format(config.SYSTEM_SELF_TEST_TITLE)) utility.verify_page_step_indicator(SCREEN_OBJ, PRE_TREATMENT_STEP, config.PRE_TREATMENT_SCREENS) utility.verify_countdown(config.SYSTEM_SELF_TEST_TITLE, config.TIME_OUT_DURATION_100, hd_simulator, dg_simulator) utility.verify_countdown(config.SYSTEM_SELF_TEST_TITLE, config.TIME_OUT_DURATION_200, hd_simulator, dg_simulator) utility.verify_countdown(config.SYSTEM_SELF_TEST_TITLE, config.TIME_OUT_DURATION_300, hd_simulator, dg_simulator) test.endSection() def verify_right_instruction_navigation(num_of_instruction, screen): """ Method to verify right arrow functionality and verify the status of back, next and confirm button if available @param num_of_instruction - (int) count the number of instructions, @param screen - (int) current screen """ test.startSection("verifying right arrow functionality and verify the status of left, 'BACK', 'NEXT' and 'CONFIRM' button if available") utility.verify_missing_object(names.o_disposable_leftImage_Image) for indicator in range(1, num_of_instruction, 1): verify_bullet_navigation(indicator, num_of_instruction) if screen == SALINE_BAG: verify_confirm_button(config.DISABLED) else: verify_next_button(config.DISABLED) if screen == CARTRIDGE_INSTALLATION: verify_back_button(config.DISABLED) else: verify_back_button(config.ENABLED) if indicator != num_of_instruction: mouseClick(waitForObject(names.o_disposable_rightImage_Image)) utility.verify_missing_object(names.o_disposable_rightImage_Image) if screen == SALINE_BAG: verify_confirm_button(config.ENABLED) else: verify_next_button(config.ENABLED) test.endSection() def verify_left_instruction_navigation(num_of_instruction, screen): """ Method to verify left arrow functionality and verify the status of back, next and confirm button if available @param num_of_instruction - (int) count the number of instructions, @param screen - (int) current screen """ test.startSection("verifying left arrow functionality and verify the status of left, 'BACK', 'NEXT' and 'CONFIRM' button if available") utility.verify_missing_object(names.o_disposable_rightImage_Image) for indicator in range(num_of_instruction, 0, -1): verify_bullet_navigation(indicator, num_of_instruction) if ((indicator == num_of_instruction) and (screen == CARTRIDGE_INSTALLATION or screen == CARTRIDGE_CONNECTION or screen == HEPARIN_SYRINGE)): test.log(str (indicator) ) test.log(str (screen) ) test.log(str (num_of_instruction) ) verify_next_button(config.ENABLED) else: if (indicator == num_of_instruction) and (screen == SALINE_BAG): verify_confirm_button(config.ENABLED) else: verify_confirm_button(config.DISABLED) if(indicator == num_of_instruction) and (screen != SALINE_BAG): verify_next_button(config.DISABLED) if screen == CARTRIDGE_INSTALLATION: verify_back_button(config.DISABLED) else: verify_back_button(config.ENABLED) if indicator != 1: mouseClick(waitForObject(names.o_disposable_leftImage_Image)) utility.verify_missing_object(names.o_disposable_leftImage_Image) test.endSection() def verify_bullet_navigation(num, num_of_instruction): """ Method to verify the status of bullets based on the number of instruction screen @param num - (int) number of indicator @param num_of_instruction- (int) count the number of instructions """ test.startSection("instruction bullet verification for screens") for instruction in range(1, num_of_instruction): bullet_children = object.children(waitForObjectExists(utility.get_bullet_object(SCREEN_OBJ,(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.log(str(instruction) + " Complete bullet") else: test.compare(bullet_circle_color, config.CURRENT_COLOR) test.compare(bullet_border_color, config.INCOMPLETE_COLOR) test.log(str(instruction) + " Incomplete bullet") test.endSection() def verify_next_button(condition): """ Method to verify the status 'NEXT' button @param condition - (bool) True/False """ test.startSection("Verifying the status of 'NEXT' button") test.compare(str(waitForObjectExists(names.o_next_button_text).text), config.NEXT_BUTTON_TEXT, "'NEXT' button text should be {}".format(config.NEXT_BUTTON_TEXT)) if condition: test.compare(waitForObjectExists(names.o_next_button_text).enabled, condition, "'NEXT' button should be enabled") else: test.compare(waitForObjectExists(names.o_next_button_text).enabled, condition, "'NEXT' button should be disabled") test.endSection() def click_on_next_button(): """ Method to click on 'NEXT' button """ mouseClick(findObject(names.o_next_button_text)) def verify_back_button(condition): """ Method to verify the availability of 'BACK' button verify the status of the same @param condition - (bool) True/False """ test.startSection("Verifying the availability of 'BACK' button verify the status of the same") if object.exists(names.o_back_button_text): test.compare(str(waitForObjectExists(names.o_back_button_text).text), config.BACK_BUTTON_TEXT,"'BACK' button text should be {}".format(config.BACK_BUTTON_TEXT)) if condition: test.compare(waitForObjectExists(names.o_back_button_text).enabled , condition, "'BACK' button should be enabled") else: test.compare(waitForObjectExists(names.o_back_button_text).enabled , condition, "'BACK' button should be disabled") else: test.passes("'BACK' Button should not exists") test.endSection() def click_on_back_button(): """ Method to click on 'BACK' button """ mouseClick(waitForObjectExists(names.o_back_button_text)) def verify_cartridge_installation_first_screen_displayed(): """ Method to verify the screen 1 of cartridge_installation of instructions is displayed """ test.startSection("Verifying the screen 1 of 'cartridge installation' of instructions is displayed") expected_screen_text = waitForObject(names.o_cartridge_installation_screen1_text) test.compare(expected_screen_text.text, CARTRIDGE_INSTALLATION_TEXT, "{} Should be displayed when navigated to cartridge_installationcartridge_installation by using 'BACK' button".format(CARTRIDGE_INSTALLATION_TEXT)) test.endSection() def verify_cartridge_connection_first_screen_displayed(): """ Method to verify the screen 1 of cartridge connection of instructions is displayed """ test.startSection("Verifying the screen 1 of 'cartridge connection' of instructions is displayed") expected_screen_text = waitForObject(names.o_cartridge_connection_screen1_text) test.compare(expected_screen_text.text, CARTRIDGE_CONNECTION_TEXT, "{} Should be displayed when navigated to Phase 2 by using BACK button".format(CARTRIDGE_CONNECTION_TEXT)) test.endSection() def verify_heparin_syringe_first_screen_displayed(): """ Method to verify the screen 1 of heparin syringe of instructions is displayed """ test.startSection("Verifying the screen 1 of 'heparin syringe' of instructions is displayed") expected_screen_text = waitForObject(names.o_heparin_syringe_screen1_text) test.compare(expected_screen_text.text, HEPARIN_SYRINGE_TEXT, "{} Should be displayed when navigated to Phase 2 by using BACK button".format(HEPARIN_SYRINGE_TEXT)) test.endSection() def verify_confirm_button(condition): """ Method to verify the status 'CONFIRM' button verify the status of the same @param condition - (bool) True/False """ test.startSection("Verifying the availability 'CONFIRM' button verify the status of the same") if object.exists(names.o_confirm_button_text): test.compare(str(waitForObjectExists(names.o_confirm_button_text).text), config.CONFIRM_BUTTON_TEXT,"'CONFIRM' button text should be {}".format(config.CONFIRM_BUTTON_TEXT)) if condition: test.compare(waitForObjectExists(names.o_confirm_button_text).enabled , condition, "'CONFIRM' button should be enabled") else: test.compare(waitForObjectExists(names.o_confirm_button_text).enabled , condition, "'CONFIRM' button should be disabled") else: test.passes("'CONFIRM' Button should not exists") test.endSection() def verify_functionality_for_cartridge_installation(): """ Method to verify functionality of the cartridge_installation screen's left, right navigation and 'NEXT' button """ test.startSection("Verifying functionality of the cartridge installation screen's left, right navigation and 'NEXT' button") hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_PRET.value, PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.STANDBY_WAIT_FOR_DG_FLUSH_TO_START_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=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) verify_right_instruction_navigation(NUM_OF_CARTRIDGE_INSTALLATION_SCREENS, CARTRIDGE_INSTALLATION) verify_left_instruction_navigation(NUM_OF_CARTRIDGE_INSTALLATION_SCREENS, CARTRIDGE_INSTALLATION) verify_right_instruction_navigation(NUM_OF_CARTRIDGE_INSTALLATION_SCREENS, CARTRIDGE_INSTALLATION) click_on_next_button() test.endSection() def verify_functionality_for_cartridge_connection(): """ Method to verify functionality of the cartridge connection screen's left, right navigation and 'NEXT' button """ test.startSection("Verifying functionality of the cartridge connection screen's left, right navigation, 'BACK'and 'NEXT' button") verify_right_instruction_navigation(NUM_OF_CARTRIDGE_CONNECTION_SCREENS, CARTRIDGE_CONNECTION) verify_left_instruction_navigation(NUM_OF_CARTRIDGE_CONNECTION_SCREENS, CARTRIDGE_CONNECTION) click_on_back_button() verify_cartridge_installation_first_screen_displayed() verify_right_instruction_navigation(NUM_OF_CARTRIDGE_INSTALLATION_SCREENS, CARTRIDGE_INSTALLATION) click_on_next_button() verify_right_instruction_navigation(NUM_OF_CARTRIDGE_CONNECTION_SCREENS, CARTRIDGE_CONNECTION) click_on_back_button() verify_cartridge_installation_first_screen_displayed() verify_right_instruction_navigation(NUM_OF_CARTRIDGE_INSTALLATION_SCREENS, CARTRIDGE_INSTALLATION) click_on_next_button() verify_right_instruction_navigation(NUM_OF_CARTRIDGE_CONNECTION_SCREENS, CARTRIDGE_CONNECTION) click_on_next_button() test.endSection() def verify_functionality_for_heparin_syringe(): """ Method to verify functionality of the heparin syringe screen's left, right navigation and 'NEXT', 'BACK' and 'CONFIRM' button """ test.startSection("Verifying functionality of the heparin syringe") click_on_back_button() verify_cartridge_connection_first_screen_displayed() click_on_back_button() verify_cartridge_installation_first_screen_displayed() verify_right_instruction_navigation(NUM_OF_CARTRIDGE_INSTALLATION_SCREENS, CARTRIDGE_INSTALLATION) click_on_next_button() verify_right_instruction_navigation(NUM_OF_CARTRIDGE_CONNECTION_SCREENS, CARTRIDGE_CONNECTION) click_on_next_button() verify_next_button(config.ENABLED) test.endSection() def verify_functionality_for_saline_bag(): """ Method to verify functionality of the saline bag screen's left, right navigation and 'NEXT', 'BACK' and 'CONFIRM' button """ test.startSection("Verifying functionality of the saline bag") click_on_next_button() verify_right_instruction_navigation(NUM_OF_SALINE_BAG_SCREENS, SALINE_BAG) verify_left_instruction_navigation(NUM_OF_SALINE_BAG_SCREENS, SALINE_BAG) click_on_back_button() verify_heparin_syringe_first_screen_displayed() click_on_back_button() verify_cartridge_connection_first_screen_displayed() click_on_back_button() verify_cartridge_installation_first_screen_displayed() verify_right_instruction_navigation(NUM_OF_CARTRIDGE_INSTALLATION_SCREENS, CARTRIDGE_INSTALLATION) click_on_next_button() verify_right_instruction_navigation(NUM_OF_CARTRIDGE_CONNECTION_SCREENS, CARTRIDGE_CONNECTION) click_on_next_button() verify_right_instruction_navigation(NUM_OF_HEPARIN_SYRINGE_SCREENS, HEPARIN_SYRINGE) click_on_next_button() verify_right_instruction_navigation(NUM_OF_SALINE_BAG_SCREENS, SALINE_BAG) verify_confirm_button(config.ENABLED) mouseClick(waitForObject(names.o_confirm_button_text)) hd_simulator.cmd_send_hd_general_response(message_id=173, accepted=config.ACCEPTED, reason=0) test.endSection() def verify_request_continue_mode(): """ Method to accept treatment response. """ treatment_status = hd_simulator.cmd_send_treatment_parameter_manual_validation_response([ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]) test.compare(treatment_status, True, "custom treatment should be accepted") def verify_create_custom_treatment_parameter(): """ Method to set create custom treatment slider value based on slider buffer """ test.startSection("Method to set create custom treatment slider based on positive slider buffer") test.compare(waitForObject(names.o_PreTreatmentCreate_Create_a_Custom_Treatment_Text).text, config.TREATMENT_TITLE, "Title text should be -> "+str(config.TREATMENT_TITLE)) test.compare(waitForObject(names.o_PreTreatmentCreate_PRESCRIPTION_Text).text, config.PRESCRIPTION_TITLE, "Title text should be -> "+str(config.PRESCRIPTION_TITLE)) #set custom values for parameters test.startSection("verification of blood flow values") test.compare(waitForObject(names.o_PreTreatmentCreate_bloodFlowRate_SliderCreateTreatment).label, config.BLOOD_FLOW_RATE, "Parameter should be -> "+str(config.BLOOD_FLOW_RATE)) test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodFlowRateSlider_Slider, 100, config.CREATE_TREATMENT_SLIDER_VALUES["blood_flow_rate"], config.BLOOD_FLOW_RATE) test.endSection() test.startSection("verification of dialysate flow values") test.compare(waitForObject(names.o_PreTreatmentCreate_dialysateFlowRate_SliderCreateTreatment).label, config.DIALYSATE_FLOW_RATE, "Parameter should be -> "+str(config.DIALYSATE_FLOW_RATE)) test_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateFlowRateSlider_Slider, 250, config.CREATE_TREATMENT_SLIDER_VALUES["dialysate_flow_rate"], config.DIALYSATE_FLOW_RATE) test.endSection() test.startSection("verification of duration values") test.compare(waitForObject(names.o_PreTreatmentCreate_duration_SliderCreateTreatment).label, config.DURATION, "Parameter should be -> "+str(config.DURATION)) test_custom_treatment_slider(names.o_PreTreatmentCreate_durationSlider_Slider, 60, config.CREATE_TREATMENT_SLIDER_VALUES["duration"], config.DURATION) test.endSection() #scroll the screen to the title heparin bolus volume parameter_object = set_parameter_type(text=config.HEPARIN_BOLUS_VOLUME) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of heparin dispensing rate values") test.compare(waitForObject(names.o_PreTreatmentCreate_heparinDispensingRate_SliderCreateTreatment).label, config.HEPARIN_DISPENSING_RATE, "Parameter should be -> "+str(config.HEPARIN_DISPENSING_RATE)) test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinDispensingRateSlider_Slider, 0.8, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_dispensing_rate"], config.HEPARIN_DISPENSING_RATE) test.endSection() test.startSection("verification of heparin bolus volume values") test.compare(waitForObject(names.o_PreTreatmentCreate_heparinBolusVolume_SliderCreateTreatment).label, config.HEPARIN_BOLUS_VOLUME, "Parameter should be -> "+str(config.HEPARIN_BOLUS_VOLUME)) test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinBolusVolumeSlider_Slider, 1.3, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_bolus_volume"], config.HEPARIN_BOLUS_VOLUME) test.endSection() #scroll the screen to the title acid concentrate type parameter_object = set_parameter_type(text=config.HEPARIN_TYPE_TITLE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of heparin stop time values") test.compare(waitForObject(names.o_PreTreatmentCreate_heparinStopTime_SliderCreateTreatment).label, config.HEPARIN_STOP_TIME, "Parameter should be -> "+str(config.HEPARIN_STOP_TIME)) test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinStopTimeSlider_Slider, 230, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_stop_time"], config.HEPARIN_STOP_TIME) test.endSection() test.startSection("verification of saline bolus values") test.compare(waitForObject(names.o_PreTreatmentCreate_salineBolus_SliderCreateTreatment).label, config.SALINE_BOLUS_TITLE, "Parameter should be -> "+str(config.SALINE_BOLUS_TITLE)) test_custom_treatment_slider(names.o_PreTreatmentCreate_salineBolusSlider_Slider, 100, config.CREATE_TREATMENT_SLIDER_VALUES["saline_bolus"], config.SALINE_BOLUS_TITLE) test.endSection() #scroll the screen to the title acid concentrate type parameter_object = set_parameter_type(text=config.ACID_CONCENTRATE_TITLE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of heparin type") test.compare(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect_GridSelection).labels, config.HEPARIN_TYPE, "Parameter should be -> "+str(config.HEPARIN_TYPE)) mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect0_TouchRect)) test.compare(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect0_TouchRect).text.text, config.HEPARIN_TYPE, "heparin text should be :"+ str(config.HEPARIN_TYPE)) test.compare(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect0_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") test.endSection() #scroll the screen to the title dialyste rectangle parameter_object = set_parameter_type(text=config.DIALYZER_TYPE_TITLE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of acid concentrate type") test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect_GridSelection).title, config.ACID_CONCENTRATE_TITLE, "Parameter should be -> "+str(config.ACID_CONCENTRATE_TITLE)) mouseClick(names.o_PreTreatmentCreate_acidConcentrateRect0_TouchRect) test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect0_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect0_TouchRect).text.text, config.ACID_CONCENTRATE[0], "Acid concentrate value should be :"+str(config.ACID_CONCENTRATE[0])) test.endSection() #scroll the screen to the title dialyste rectangle parameter_object = set_parameter_type(text=config.DIALYZER_TYPE_TITLE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of bicarbonate concentrate rectangle") test.compare(waitForObject(names.o_PreTreatmentCreate_bicarbonateConcentrateRect_GridSelection).title, config.BICARBONATE_CONCENTRATE_TITLE, "Parameter should be -> "+str(config.BICARBONATE_CONCENTRATE_TITLE)) mouseClick(names.o_PreTreatmentCreate_bicarbonateConcentrateRect0_TouchRect) test.compare(waitForObject(names.o_PreTreatmentCreate_bicarbonateConcentrateRect0_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") test.compare(waitForObject(names.o_PreTreatmentCreate_bicarbonateConcentrateRect0_TouchRect).text.text, config.BICARBONATE_CONCENTRATE, "Bicarbonate concentrate value should be :"+str(config.ACID_CONCENTRATE[0])) test.endSection() #scroll the screen to the title dialyste temperature value parameter_object = set_parameter_type(text=config.DIALYSATE_TEMPERATURE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of dialysate rectangle") test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect_GridSelection).title, config.DIALYZER_TYPE_TITLE, "Parameter should be -> "+str(config.DIALYZER_TYPE_TITLE)) mouseClick(names.o_PreTreatmentCreate_dialyzerTypeRect0_TouchRect) test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect0_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect0_TouchRect).text.text, config.DIALYZER_TYPE[0], "Dialyzer type value should be :"+str(config.DIALYZER_TYPE[0])) test.endSection() #scroll the screen to the title blood pressure measurement interval parameter_object = set_parameter_type(text=config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) test.startSection("verification of dialysate temperature values") test.compare(waitForObject(names.o_PreTreatmentCreate_dialysateTemperature_SliderCreateTreatment).label, config.DIALYSATE_TEMPERATURE, "Parameter should be -> "+str(config.DIALYSATE_TEMPERATURE)) test_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateTemperatureSlider_Slider, 35, config.CREATE_TREATMENT_SLIDER_VALUES["dialysate_temperature"], config.DIALYSATE_TEMPERATURE) test.endSection() #scroll the screen to the title rinseback flow rate parameter_object = set_parameter_type(text=config.RINSEBACK_FLOW_RATE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) set_arterial_low_and_high() set_venous_low_and_high() test.startSection("verification of blood pressure measurement interval values") test.compare(waitForObject(names.o_PreTreatmentCreate_bloodPressureMeasurementInterval_SliderCreateTreatment).label, config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL, "Parameter should be -> "+str(config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL)) test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodPressureMeasurementIntervalSlider_Slider, 25, config.CREATE_TREATMENT_SLIDER_VALUES["blood_pressure_measurement_interval"], config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) test.endSection() test.startSection("verification of rinseback flow rate values") test.compare(waitForObject(names.o_PreTreatmentCreate_rinsebackFlowRate_SliderCreateTreatment).label, config.RINSEBACK_FLOW_RATE, "Parameter should be -> "+str(config.RINSEBACK_FLOW_RATE)) test_custom_treatment_slider(names.o_PreTreatmentCreate_rinsebackFlowRateSlider_Slider, 50, config.CREATE_TREATMENT_SLIDER_VALUES["rinseback_flow_rate"], config.RINSEBACK_FLOW_RATE) test.endSection() test.endSection() def set_arterial_low_and_high(): """ Method to set the arterial low and high limits using slider """ test.startSection("Set the arterial low and high limits using slider") utility.set_arterial_ranges_max_val(art_high) utility.set_arterial_ranges_min_val(art_low) test.endSection() def set_venous_low_and_high(): """ Method to set the venous low and high limits using slider """ test.startSection("Set the venous low and high limits using slider") utility.set_venous_ranges_min_val(ven_low) utility.set_venous_ranges_max_val(ven_high) test.endSection() def set_parameter_type(text): """ Method to set object property based on text @param text : (string) treatment parameter text """ if isinstance(text, str): names.o_operating_parameters["text"] = text return names.o_operating_parameters else: test.log("Invalid \"text\": " +text+" for object.") names.o_operating_parameters["text"] = None def test_custom_treatment_slider(slider_object, value, slider_parameter, parameter): """ Method to set slider handle based on custom values @param slider_object : (dictionary) object of treatment parameters @param vale : (int)value to be set on slider @param slider_parameter : (list) consist combination of slider minimum value, slider buffer and width buffer @param parameter : (str) parameter name """ minimum_slider_value = slider_parameter[0] slider_buffer = slider_parameter[1] width_buffer = slider_parameter[2] slider_width = ((value - minimum_slider_value)/slider_buffer) * width_buffer utils.waitForGUI(0.3) mouseClick(findObject(slider_object), float(slider_width) , 3, Qt.LeftButton) test.compare(waitForObjectExists(slider_object).value, value, str(parameter)+" slider value should set to"+str(value)) def navigate_to_disposables_screen_from_create_custom_treatment(): """ Method to set all parameters in create custom treatment and navigate to disposables screen to verify heparin syringe screen """ test.startSection("Method to navigate to create custom treatment to set all parameters ") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TPAR.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) mouseClick(waitForObject(names.o_input_patient_id)) type(waitForObject(names.o_input_patient_id), "abcd") mouseClick(waitForObject(names.o_confirm_button)) verify_create_custom_treatment_parameter() verify_request_continue_mode() # navigation for pre-treatment screens hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TPAR.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_PRET.value, PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.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=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) utils.waitForGUI(1) hd_simulator.cmd_initiate_treatment_response(response=1, reason=0) hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_PRET.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) # navigation for pre-treatment disposables screens hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_PRET.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.STANDBY_WAIT_FOR_DG_FLUSH_CMD_RESPONSE_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=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) utility.verify_page_step_indicator(SCREEN_OBJ, PRE_TREATMENT_STEP, config.PRE_TREATMENT_SCREENS) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) verify_disposables_screen() navigate_to_disposables_screen_from_create_custom_treatment() verify_functionality_for_cartridge_installation() utils.waitForGUI(1) verify_functionality_for_cartridge_connection() utils.waitForGUI(1) verify_functionality_for_heparin_syringe() utils.waitForGUI(1) verify_functionality_for_saline_bag() utils.tstDone()