Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -rf6d23e89ccf01b57313b0e920f013dc1027706d4 -rfb27385d1c510f6d3b433ace7e2f2e7d5dda4012 --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision fb27385d1c510f6d3b433ace7e2f2e7d5dda4012) @@ -45,3 +45,32 @@ WIFI_PARAMETERS_TEXTS = ["SSID", "IP Address", "Gateway", "Subnet Mask", "DNS"] WIFI_SCREEN_SCAN_BUTTON_TEXT = "SCAN" DISABLED = False + +#Create Rx +ACID_CONCENTRATE = ["1.0 K, 2.50 Ca, 1 Mg","2.0 K, 2.50 Ca, 1 Mg","3.0 K, 2.50 Ca, 1 Mg"] +DIALYZER_TYPE = ["Diacap Pro 13H","Diacap Pro 16H", "Diacap Pro 19H", "Optiflux F160NRe", "Optiflux F180NRe", "Optiflux F200NRe","Optiflux F250NRe"] +VITALS = ["OFF","5","10","15","20","30","60"] +BICARBONATE = ["Sodium Bicarbonate"] + +#Heparin +heparin_off = { "Heparin Type" :"OFF", + "Dispensing Rate" :"OFF", + "Bolus Volume" :"OFF", + "Stop Time" :"OFF"} + +heparin_values = { "Heparin Type" :"Unfractionated 1,000", + "Dispensing Rate" :"0.5", + "Bolus Volume" :"0.4", + "Stop Time" :"60"} + +PAUSE = 'Pause' +ACTIVE = 'Active' +RESUME = 'Resume' +COMPLETE = 'Complete' +HEPARIN = "Heparin" +CREATERX = "Rx" +VALIDATE = "VALIDATE" +CONFIRM = "CONFIRM" +NEXT ="Next" + + Index: suite_leahi/shared/scripts/configuration/navigation.py =================================================================== diff -u -r4e2b2a08fb10fb528e782a505eaab19f63874cc4 -rfb27385d1c510f6d3b433ace7e2f2e7d5dda4012 --- suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision 4e2b2a08fb10fb528e782a505eaab19f63874cc4) +++ suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision fb27385d1c510f6d3b433ace7e2f2e7d5dda4012) @@ -32,4 +32,29 @@ "{} screen is displayed and Comparison of Device Settings Screen Title text".format( config.DEVICE_SETTINGS_SCREEN_TITLE_TEXT ), - ) \ No newline at end of file + ) + +def navigation_pageIndicator_step(vStep_name): + """ + Navigate to the specified page using the step indicator component. + + This method selects the given step from the page step indicator + Args: + vStep_name (str): The name of the step to navigate to as displayed + in the step indicator. + + """ + test.startSection("Method to navigation in the pretreatment page ") + stepId = squish.waitForObjectExists(names.o_preTreatmentStack_stepIndicator_StepIndicator) + values = utility.findAllObjectsById(stepId, "_text") + for index, input_field in enumerate(values[2:]): + test.log(str(index)); + test.log(str(input_field.text)) + if str(input_field.text) == vStep_name: + test.log("Reached the target step") + break + else: + Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) + squish.mouseClick(Nextbutton) + test.endSection() + \ No newline at end of file Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r7a928840e1bf52ae1af839a48dce76a0320c35e7 -rfb27385d1c510f6d3b433ace7e2f2e7d5dda4012 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 7a928840e1bf52ae1af839a48dce76a0320c35e7) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision fb27385d1c510f6d3b433ace7e2f2e7d5dda4012) @@ -1,18 +1,12 @@ import squish import test import object -from squish import * import names from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates +from configuration import config, navigation td =TD_Messaging() - - -ACID_CONCENTRATE = ["1.0 K, 2.50 Ca, 1 Mg","2.0 K, 2.50 Ca, 1 Mg","3.0 K, 2.50 Ca, 1 Mg"] -DIALYZER_TYPE = ["Diacap Pro 13H","Diacap Pro 16H", "Diacap Pro 19H", "Optiflux F160NRe", "Optiflux F180NRe", "Optiflux F200NRe","Optiflux F250NRe"] -VITALS = ["OFF","5","10","15","20","30","60"] -BICARBONATE = ["Sodium Bicarbonate"] def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): """ @@ -75,29 +69,28 @@ right_arrow =findObjectById(parent_obj, "_rightArrow") # Read current value (supports invisible text too) - try: - current_value = round(float(findObject(obj).value),1) - except LookupError: - current_value = float(findObject(obj).property("value")) - + + current_value = round(float(squish.findObject(obj).value),1) + # Determine direction while current_value != float(target_value): if current_value < float(target_value): squish.mouseClick(squish.waitForObject(right_arrow)) elif current_value > float(target_value): squish.mouseClick(squish.waitForObject(left_arrow)) - # Update current value after click - try: - current_value = round(float(findObject(obj).value),1) - except Exception: - current_value = float(findObject(obj).property("value")) - + + current_value = round(float(squish.findObject(obj).value),1) + test.log(f"Updated value: {current_value}") test.log(f"✅ Target value reached: {current_value}") def select_different_dropdown(object,type,whichTypeIndex): + """ + Selects a value from a dropdown using a doc string. + + """ type_combo_box = get_object_from_names(object, error_message="Combo box object is missing") if type_combo_box is not None: squish.mouseClick(squish.waitForObjectExists(object)) @@ -110,23 +103,23 @@ def verify_create_treatment_parameters(): test.startSection("Pre treatment parameters") - navigation_titleBar("Rx") - squish.mouseClick(waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry)) + navigation.navigation_pageIndicator_step(config.CREATERX) + squish.mouseClick(squish.waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry)) squish.waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry).text ="abcd" set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 60) set_value_based_on_target(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster, 75) set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 75) set_value_based_on_target(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, 0.4) set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, 0.5) set_value_based_on_target(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster, 60) - select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,2) + select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,config.ACID_CONCENTRATE,2) set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,37.0) - select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,2) + select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,config.DIALYZER_TYPE,2) set_value_based_on_target(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster, 200) - select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,VITALS,1) - select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,BICARBONATE,0) - Validatebutton = setObjectText(names.o_preTreatmentStack_Text, "VALIDATE") - squish.mouseClick(waitForObject(Validatebutton)) + select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,config.VITALS,1) + select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,config.BICARBONATE,0) + Validatebutton = setObjectText(names.o_preTreatmentStack_Text, config.VALIDATE) + squish.mouseClick(squish.waitForObject(Validatebutton)) td.td_Treatment_Parameters_Validation( vAccepted = 1, vBloodFlowRateRejectReason = 0, vDialysateFlowRateRejectReason = 0, @@ -149,9 +142,8 @@ vHeparinBolusVolumeRejectReason = 0 ) - confirmButton = setObjectText(names.o_preTreatmentStack_Text, "CONFIRM") - squish.mouseClick(waitForObject(confirmButton)) - # td.td_operation_mode(TDOpModes.MODE_PRET.value, 0) + confirmButton = setObjectText(names.o_preTreatmentStack_Text,config.CONFIRM ) + squish.mouseClick(squish.waitForObject(confirmButton)) test.endSection() def findAllObjectsById(parent, target_id): @@ -171,20 +163,6 @@ return results -def navigation_titleBar(targetStep): - test.startSection("Method to navigation in the pretreatment page ") - stepId = waitForObjectExists(names.o_preTreatmentStack_stepIndicator_StepIndicator) - values = findAllObjectsById(stepId, "_text") - for index, input_field in enumerate(values[2:]): - test.log(str(index)); - test.log(str(input_field.text)) - if str(input_field.text) == targetStep: - test.log("Reached the target step") - break - else: - Nextbutton = setObjectText(names.o_preTreatmentStack_Text, "Next") - squish.mouseClick(Nextbutton) - test.endSection() - + Index: suite_leahi/tst_heparin/test.py =================================================================== diff -u -r01e0f75ccca2d523d85d1898b3356bfebe2e8415 -rfb27385d1c510f6d3b433ace7e2f2e7d5dda4012 --- suite_leahi/tst_heparin/test.py (.../test.py) (revision 01e0f75ccca2d523d85d1898b3356bfebe2e8415) +++ suite_leahi/tst_heparin/test.py (.../test.py) (revision fb27385d1c510f6d3b433ace7e2f2e7d5dda4012) @@ -14,30 +14,14 @@ import names from leahi_dialin.ui import utils -from configuration import utility +from configuration import utility,config,navigation from configuration import config from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.ui_defs import TXStates from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates td =TD_Messaging() -heparin_off = { "Heparin Type" :"OFF", - "Dispensing Rate" :"OFF", - "Bolus Volume" :"OFF", - "Stop Time" :"OFF"} - -heparin_values = { "Heparin Type" :"Unfractionated 1,000", - "Dispensing Rate" :"0.5", - "Bolus Volume" :"0.4", - "Stop Time" :"60"} - -PAUSE = 'Pause' -ACTIVE = 'Active' -RESUME = 'Resume' -COMPLETE = 'Complete' -HEPARIN = "Heparin" - def verify_heparin_precription_parameters(heparin_value): test.startSection("Verify prescription rx parameters in heparin page") column = waitForObject(names.o_treatmentHeparin_Prescription_Column) @@ -94,7 +78,7 @@ def verify_create_treatment_parameters_Heparin_OFF(): test.startSection("Pre treatment parameters") - utility.navigation_titleBar("Rx") + navigation.navigation_pageIndicator_step(config.CREATERX) mouseClick(waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry)) waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry).text ="abcd" utility.set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 50) @@ -104,11 +88,11 @@ mouseClick(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster) utility.set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,37.5) utility.set_value_based_on_target(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster, 100) - utility.select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,utility.ACID_CONCENTRATE,2) - utility.select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,utility.DIALYZER_TYPE,2) - utility.select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,utility.VITALS,1) - utility.select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,utility.BICARBONATE,0) - Validatebutton = utility.setObjectText(names.o_preTreatmentStack_Text, "VALIDATE") + 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_PreTreatment_vitalsCombobox_BaseCombobox,config.VITALS,1) + utility.select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,config.BICARBONATE,0) + Validatebutton = utility.setObjectText(names.o_preTreatmentStack_Text, config.VALIDATE) mouseClick(waitForObject(Validatebutton)) td.td_Treatment_Parameters_Validation( vAccepted = 1, vBloodFlowRateRejectReason = 0, @@ -126,13 +110,13 @@ vArterialPressureLimitWindowRejectReason = 0, vVenousPressureLimitWindowRejectReason = 0, vVenousPressureLimitAsymtrcRejectReason = 0, - vTransmembranePressureLimitWindowRejectReason = 0, + vTransmembranePressureLimitWindowRejectReason= 0, vDialysateTempRejectReason = 0, vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 ) - confirmButton = utility.setObjectText(names.o_preTreatmentStack_Text, "CONFIRM") + confirmButton = utility.setObjectText(names.o_preTreatmentStack_Text, config.CONFIRM) mouseClick(waitForObject(confirmButton)) test.endSection() @@ -148,10 +132,10 @@ verify_create_treatment_parameters_Heparin_OFF() change_treatmentstates(TDTreatmentStates.TREATMENT_PAUSED_STATE.value) change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) - waitForObject(names.o_listView_Item) - heparin = utility.setObjectText(text=HEPARIN, obj=names.o_listView_Item) + waitForObject(names.o_listView_Item,1000) + heparin = utility.setObjectText(text=config.HEPARIN, obj=names.o_listView_Item) mouseClick(waitForObject(heparin)) - verify_heparin_precription_parameters(heparin_off) + verify_heparin_precription_parameters(config.heparin_off) test.endSection() test.startSection("Verify prescription rx parameters in heparin page") @@ -162,10 +146,10 @@ utility.verify_create_treatment_parameters() change_treatmentstates(TDTreatmentStates.TREATMENT_PAUSED_STATE.value) change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) - waitForObject(names.o_listView_Item) - heparin = utility.setObjectText(text=HEPARIN, obj=names.o_listView_Item) + waitForObject(names.o_listView_Item,1000) + heparin = utility.setObjectText(text=config.HEPARIN, obj=names.o_listView_Item) mouseClick(waitForObject(heparin)) - verify_heparin_precription_parameters(heparin_values) + verify_heparin_precription_parameters(config.heparin_values) test.endSection() test.startSection("Verify the Heparin states") @@ -174,13 +158,13 @@ time_remaining = 2646 ) - verify_status_heparinStates(4,PAUSE,ACTIVE) + verify_status_heparinStates(4,config.PAUSE,config.ACTIVE) pauseButton = waitForObject(names.o_treatmentHeparin_heparinButton_TouchRect) pauseText = utility.findObjectById(pauseButton, "_text") mouseClick(pauseText) - verify_status_heparinStates(2,RESUME,PAUSE) + verify_status_heparinStates(2,config.RESUME,config.PAUSE) td.td_tx_state(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, 0 , @@ -195,7 +179,7 @@ ) status = waitForObject(names.o_treatmentHeparin_status_Rectangle) statustext = utility.findObjectById(status,'_statusText') - test.compare(COMPLETE, statustext.text,"Status text should be ->"+str(COMPLETE)) + test.compare(config.COMPLETE, statustext.text,"Status text should be ->"+str(config.COMPLETE)) test.endSection() utils.tstDone()