Index: suite_leahi/tst_pre_treatment_foundation/test.py =================================================================== diff -u -r80c156369f3fe3fee359b0ad651db28ee18137e5 -r1e3869b12486cff17bef668c69a6cb36cafff4a8 --- suite_leahi/tst_pre_treatment_foundation/test.py (.../test.py) (revision 80c156369f3fe3fee359b0ad651db28ee18137e5) +++ suite_leahi/tst_pre_treatment_foundation/test.py (.../test.py) (revision 1e3869b12486cff17bef668c69a6cb36cafff4a8) @@ -13,13 +13,13 @@ import names import re -from configuration import config, utility, navigation, application_init -from leahi_dialin.ui import utils -from leahi_dialin.ui.td_messaging import TD_Messaging -from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates -from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions -from leahi_dialin.protocols import CAN -from leahi_dialin.utils import conversions +from configuration import config, utility, navigation, application_init +from leahi_dialin.ui import utils +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.protocols import CAN +from leahi_dialin.utils import conversions td_simulator = TD_Messaging() can_interface = td_simulator.can_interface @@ -46,7 +46,7 @@ payload += conversions.integer_to_bytearray(vRejectionReason) message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + channel_id=CAN.CanChannels.td_to_ui_ch_id, message_id=MsgIds.MSG_ID_TD_ADJUST_START_TREATMENT_RESPONSE.value, payload=payload, ) @@ -86,52 +86,42 @@ ) -def set_treatment_params(blood, dial, dur, hep_vol, hep_rate, hep_stop, - acid_idx, temp, dialyzer_idx, saline, bp, bicarb_idx): - utility.set_value_based_on_target( - names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, blood - ) - utility.set_value_based_on_target( - names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster, dial - ) - utility.set_value_based_on_target( - names.o_PreTreatmentCreate_durationControl_ValueAdjuster, dur - ) - utility.set_value_based_on_target( - names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, hep_vol - ) - utility.set_value_based_on_target( - names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, hep_rate - ) - utility.set_value_based_on_target( - names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster, hep_stop - ) - utility.select_different_dropdown( - names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox, - config.ACID_CONCENTRATE, - acid_idx, - ) - utility.set_value_based_on_target( - names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster, temp - ) - utility.select_different_dropdown( - names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox, - config.DIALYZER_TYPE, - dialyzer_idx, - ) - utility.set_value_based_on_target( - names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster, saline - ) - utility.set_value_based_on_target( - names.o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjusterCustom, bp - ) - utility.select_different_dropdown( - names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox, - config.BICARBONATE, - bicarb_idx, - ) +def set_treatment_params(patient_id, blood_flow, dialysate_flow, duration_value, ultrafiltration_volume_value): + mouseClick(waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry)) + waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry).text = patient_id + parent_obj = waitForObject(names.o_PreTreatmentCreate_leftColumn_Column, 3000) + blood_flow_rate = utility.findObjectById(parent_obj, "_bloodFlowRate") + utility.set_value_based_on_target(blood_flow_rate, blood_flow) + dialysate_flow_rate = utility.findObjectById(parent_obj, "_dialysateFlowRate") + utility.set_value_based_on_target(dialysate_flow_rate, dialysate_flow) + duration = utility.findObjectById(parent_obj,"_duration") + utility.set_value_based_on_target(duration, duration_value) + right_obj = waitForObject(names.o_PreTreatmentCreate_rightColumn_Column) + ultrafiltration_volume = utility.findObjectById(right_obj,"_ufVolume") + utility.set_value_based_on_target(ultrafiltration_volume,ultrafiltration_volume_value) + heparin_rx = utility.findObjectById(right_obj,"_heparinRx") + heparin_right_arrow = utility.findObjectById(heparin_rx, "_rightArrow") + mouseClick(heparin_right_arrow) + heparin_obj = waitForObject(names.o_LabelUnitValueAdjuster_LabelUnitValueAdjuster) + heparin_bolus = utility.findObjectById(heparin_obj,"_heparinBolusVolume") + utility.set_value_based_on_target(heparin_bolus, 0.2) + utility.set_value_based_on_target(names.o_heparinDispensingRate_LabelUnitValueAdjuster,0.3) + utility.set_value_based_on_target(names.o_heparinDeliveryDuration_LabelUnitValueAdjuster, 75) + mouseClick(waitForObject(names.o_confirmButton_ConfirmButton)) + utility.select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,config.ACID_CONCENTRATE,2) + utility.select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,config.DIALYZER_TYPE,2) + utility.select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,config.BICARBONATE,0) + Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) + mouseClick(waitForObject(Nextbutton)) + utility.set_value_based_on_target(names.o_PreTreatmentCreate_sodium_LabelUnitValueAdjuster, 139) + utility.set_value_based_on_target(names.o_PreTreatmentCreate_bicarbonate_LabelUnitValueAdjuster, 35) + utility.set_value_based_on_target(names.o_PreTreatmentCreate_fluidBolusVolume_LabelUnitValueAdjuster,300) + utility.set_value_based_on_target(names.o_PreTreatmentCreate_primeRinsebackVolume_LabelUnitValueAdjuster,310) + confirm_button = waitForObjectExists(names.o_preTreatmentStack_confirmButton_ConfirmButton) + mouseClick(confirm_button) + td_simulator.td_Treatment_Parameters_Validation(vAccepted= 1) + - def verify_start_treatment_request(): click_text(None, config.START) test.verify( @@ -145,66 +135,86 @@ # handle startTreatment sent messages from UI if can_interface is not None: - channel_id = CAN.DenaliChannels.ui_to_td_ch_id + channel_id = CAN.CanChannels.ui_to_td_ch_id message_id = MsgIds.MSG_ID_UI_ADJUST_START_TREATMENT_REQUEST.value can_interface.register_receiving_publication_function( channel_id, message_id, handle_start_treatment_request ) - + application_init.reset_system_setting("AdvancedMode") startApplication(utility.aut("-q")) - + # --- Flow 1: Full Pre-Treatment --- td_simulator.td_operation_mode(TDOpModes.MODE_STAN.value) - mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect, 3000)) td_simulator.td_operation_mode(TDOpModes.MODE_PRET.value) - + # Concentrates waitForObjectExists(names.o_preTreatmentStack_PreTreatmentStack, 3000) test.compare( waitForObjectExists( names.o_PreTreatmentBase_instructionView_InstructionView, 3000 ).title, - config.CONCENTRATES_PAGE_TITLE, + application_init.get_instructions_title('[Concentrates]'), "Comparison of Concentrates Page Title Text", ) - click_text( - waitForObjectExists( - names.o_PreTreatmentBase_instructionView_InstructionView, 3000 - ), - config.CONCENTRATES_PAGE_CONTENTS[1], - ) + + play_button_obj = waitForObject(names.o_PreTreatmentBase_autoStepController_AutoStepController) + play_button = utility.findObjectById(play_button_obj, "_button") + mouseClick(play_button) + mouseClick(play_button) + utils.waitForGUI(5) + content_column = waitForObject(names.o_PreTreatmentBase_instructionView_InstructionView, 3000) + values = utility.findAllObjectsById(content_column, "_message") + mouseClick(values[1]) + test.compare(values[1].color.name, config.BLUE_COLOR, "Test step changes to another index") click_next() - + # Installation Stepper wait_compare_text( names.o_preTreatmentStack_Text, - config.INSTALLATION_STEPPER_1_PAGE_TITLE, + application_init.get_instructions_title('[Installation^Blood Tubing Set]'), "Installation Page Stepper 1", ) - for content in config.INSTALL_BLOOD_TUBING_SET_CONTENTS[1:4]: - click_text(None, content) - + content_column = waitForObjectExists(names.o_PreTreatmentBase_contentColumn_Column) + values = utility.findAllObjectsById(content_column, "_message") + for content in values[1:4]: + mouseClick(content) + click_auto_load() td_simulator.td_blood_set_auto_load_response(0) - + wait_compare_text( names.o_preTreatmentStack_Text, - config.INSTALLATION_STEPPER_2_PAGE_TITLE, + application_init.get_instructions_title('[Installation^Bloodlines]'), "Installation Page Stepper 2", ) - for content in config.INSTALL_BLOODLINES_CONTENTS[1:5]: - click_text(None, content) + content_column = waitForObjectExists(names.o_PreTreatmentBase_contentColumn_Column) + values = utility.findAllObjectsById(content_column, "_message") + for content in values[1:5]: + mouseClick(content) click_next() - + wait_compare_text( names.o_preTreatmentStack_Text, - config.INSTALLATION_STEPPER_3_PAGE_TITLE, + application_init.get_instructions_title('[Installation^Pressure Lines and Dialyzer]'), "Installation Page Stepper 3", ) - for content in config.INSTALL_PRESSURE_LINES_CONTENTS[1:7]: - click_text(None, content) + content_column = waitForObjectExists(names.o_PreTreatmentBase_contentColumn_Column) + values = utility.findAllObjectsById(content_column, "_message") + for content in values[1:6]: + mouseClick(content) click_next() + + wait_compare_text( + names.o_preTreatmentStack_Text, + application_init.get_instructions_title('[Installation^Saline]'), + "Installation Page Stepper 4", + ) + content_column = waitForObjectExists(names.o_PreTreatmentBase_contentColumn_Column) + values = utility.findAllObjectsById(content_column, "_message") + for content in values[1:3]: + mouseClick(content) + click_next() # Self Tests for content in config.SELF_TESTS_PAGE_CONTENTS: @@ -215,44 +225,30 @@ obj.text, content, f"Comparison of Self Tests Page Contents: {content}" ) click_next() - - # Saline - wait_compare_text( - names.o_preTreatmentStack_Text, - config.SALINE_PAGE_TITLE, - "Saline Page Title Text", - ) - for content in config.SALINE_PAGE_CONTENTS[1:5]: - mouseClick(utility.setObjectText(names.o_preTreatmentStack_Text, content)) - click_next() - + # Prime for content in config.PRIME_PAGE_CONTENTS: obj = waitForObjectExists( utility.setObjectText(names.o_preTreatmentStack_Text, content) ) test.compare(obj.text, content, f"Comparison of Prime Page Contents: {content}") click_next() - + # Create Rx Flow 1 - set_treatment_params(50, 50, 60, "0.2", "0.2", 60, 2, 37.0, 2, 100, 6.0, 0) - mouseClick( - waitForObjectExists(names.o_preTreatmentStack_confirmButton_ConfirmButton, 3000) - ) - td_simulator.td_Treatment_Parameters_Validation(vAccepted=1) - mouseClick( - waitForObjectExists(names.o_preTreatmentStack_confirmButton_ConfirmButton, 3000) - ) - + set_treatment_params('1234', 60, 75, 75, 0.10) + # Connect + wait_compare_text( names.o_preTreatmentStack_Text, - config.CONNECT_PAGE_TITLE, + application_init.get_instructions_title('[Connect]'), "Connect Page Title Text", ) - for content in config.CONNECT_PAGE_CONTENTS[1:5]: - click_text(None, content) - + content_column = waitForObjectExists(names.o_PreTreatmentBase_contentColumn_Column_2) + values = utility.findAllObjectsById(content_column, "_message") + for content in values[1:4]: + mouseClick(content) + verify_start_treatment_request() td_simulator.td_operation_mode(TDOpModes.MODE_INIT.value, 0) @@ -278,15 +274,16 @@ ) mouseClick(treatment_menu) - mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect, 3000)) td_simulator.td_operation_mode(TDOpModes.MODE_PRET.value) wait_compare_text( names.o_preTreatmentStack_Text, - config.INSTALLATION_PAGE_TITLE, + application_init.get_instructions_title('[@Installation]'), "Installation Page Title Text", ) - click_text(None, config.INSTALLATION_PAGE_CONTENTS[1]) + content_column = waitForObjectExists(names.o_PreTreatmentBase_contentColumn_Column) + values = utility.findAllObjectsById(content_column, "_message") + mouseClick(values[1]) click_text(None, config.AUTO_LOAD) td_simulator.td_blood_set_auto_load_response(0) @@ -300,14 +297,6 @@ ) click_next() - # Saline - wait_compare_text( - names.o_preTreatmentStack_Text, - config.SALINE_PAGE_TITLE, - "Saline Page Title Text", - ) - click_next() - # Prime for content in config.PRIME_PAGE_CONTENTS: obj = waitForObjectExists( @@ -317,18 +306,11 @@ click_next() # Create Rx Flow 2 - set_treatment_params(60, 75, 75, "0.3", "0.3", 60, 2, 38.0, 2, 200, 3.0, 0) - mouseClick( - waitForObjectExists(names.o_preTreatmentStack_confirmButton_ConfirmButton, 3000) - ) - td_simulator.td_Treatment_Parameters_Validation(vAccepted=1) - mouseClick( - waitForObjectExists(names.o_preTreatmentStack_confirmButton_ConfirmButton, 3000) - ) + set_treatment_params('123', 80, 100, 90, 0.20) wait_compare_text( names.o_preTreatmentStack_Text, - config.CONNECT_PAGE_TITLE, + application_init.get_instructions_title('[Connect]'), "Connect Page Title Text", )