Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -r75e3ab588237239452761d2ec90e8b3aec6a916b -rb29968830a0ad7bfb6b1711404ece8e3f6b656eb --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 75e3ab588237239452761d2ec90e8b3aec6a916b) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision b29968830a0ad7bfb6b1711404ece8e3f6b656eb) @@ -87,8 +87,8 @@ COMPLETE = 'Complete' HEPARIN = "Heparin" CREATERX = "Rx" -VALIDATE = "VALIDATE" -CONFIRM = "CONFIRM" +VALIDATE = "Validate" +CONFIRM = "Confirm" NEXT ="Next" Index: suite_leahi/shared/scripts/configuration/navigation.py =================================================================== diff -u -rc7d96b722594bb29a7bbc3689715b90af6e3d616 -rb29968830a0ad7bfb6b1711404ece8e3f6b656eb --- suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision c7d96b722594bb29a7bbc3689715b90af6e3d616) +++ suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision b29968830a0ad7bfb6b1711404ece8e3f6b656eb) @@ -1,9 +1,11 @@ import names -import test import squish +import test from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes, TDStandbyStates from configuration import config, utility +from configparser import ConfigParser +from pathlib import Path td_simulator = TD_Messaging() @@ -34,6 +36,49 @@ ), ) +def navigate_to_device_settings_using_service_password(): + td_simulator.td_operation_mode(TDOpModes.MODE_SERV.value, 0) + grid_container = squish.waitForObject(names.o_DeviceSettingsGrid) + service_option = utility.findChildByText(grid_container, "Service") + + if service_option is not None: + squish.mouseClick(service_option) + + headerbar_container = squish.waitForObject(names.o_headerBar_HeaderBar) + service_screen_headerbar_title_text = utility.findChildByText( + headerbar_container, "Service" + ) + if service_screen_headerbar_title_text is not None: + test.compare( + service_screen_headerbar_title_text.text, + config.SERVICE_SCREEN_TITLE_TEXT, + "{} screen is displayed and Comparison of Device Settings Screen Title text".format( + config.SERVICE_SCREEN_TITLE_TEXT + ), + ) + input_field = squish.waitForObject(names.o_userConfirmation_TextInput, 1000) + + squish.type(input_field, config.DEFAULT_SERVICE_PASSWORD_RAW) + confirm_button = squish.waitForObject(names.o_userConfirmation_ConfirmButton, 1000) + squish.mouseClick(confirm_button) + +def get_ini_value(conf_path: str , section: str, key: str): + """ + Method to get the advanced option from the System.conf file + """ + path = Path(conf_path) + if not path.exists(): + raise FileNotFoundError(f"Not found: {path}") + parser = ConfigParser() + # Preserve case if needed: + # parser.optionxform = str + parser.read(path, encoding="utf-8") + if not parser.has_section(section): + raise KeyError(f"Section [{section}] not found in {path}") + if not parser.has_option(section, key): + raise KeyError(f"Key '{key}' not found in section [{section}]") + return parser.get(section, key) + def navigation_pageIndicator_step(vStep_name): """ Navigate to the specified page using the step indicator component. @@ -46,15 +91,26 @@ """ 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)); + stepnames = utility.findAllObjectsById(stepId, "_text") + value = get_ini_value("/home/denali/Public/luis/config/configurations/Settings/System.conf", section ="AdvancedMode", key ="AdvancedMode") + standard = stepnames[1:] + if value == "0": + standard = stepnames[3:] + Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) + squish.mouseClick(squish.waitForObject(Nextbutton)) + + autoLoadbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text ="Auto Load") + squish.mouseClick(squish.waitForObject(autoLoadbutton)) + td_simulator.td_blood_set_auto_load_response(vRejectionReason = 0) + for input_field in standard: test.log(str(input_field.text)) + if str(input_field.text) == "Water Sample": + squish.mouseClick(squish.waitForObject(names.o_PreTreatmentSampleStack_button_TouchRect)) + 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 + + test.endSection() \ No newline at end of file Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rc7d96b722594bb29a7bbc3689715b90af6e3d616 -rb29968830a0ad7bfb6b1711404ece8e3f6b656eb --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision c7d96b722594bb29a7bbc3689715b90af6e3d616) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision b29968830a0ad7bfb6b1711404ece8e3f6b656eb) @@ -2,14 +2,14 @@ import test import object import names +from squish import * +from leahi_dialin.ui import utils +from datetime import datetime 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() -from leahi_dialin.ui import utils -from builtins import int as pyInt - + def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): """ To get an object with try..except catching to prevent script errors when the object is not found on the GUI @@ -136,14 +136,16 @@ 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) + heparinValue =navigation.get_ini_value("/home/denali/Public/luis/config/configurations/Settings/System.conf", section ="Feature Configurations", key ="HeparinSyringePump") + if heparinValue == "1": + 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,config.ACID_CONCENTRATE,2) set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,37.0) 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,config.VITALS,1) + set_value_based_on_target(names.o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjusterCustom,1) select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,config.BICARBONATE,0) Validatebutton = setObjectText(obj = names.o_preTreatmentStack_Text, text =config.VALIDATE) squish.mouseClick(squish.waitForObject(Validatebutton)) @@ -167,10 +169,9 @@ vDialysateTempRejectReason = 0, vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 - ) - - confirmButton = setObjectText(obj = names.o_preTreatmentStack_Text,text = config.CONFIRM ) - squish.mouseClick(squish.waitForObject(confirmButton)) + ) + confirm = squish.waitForObjectExists(names.o_preTreatmentStack_confirmButton_ConfirmButton, 3000) + squish.mouseClick(confirm) test.endSection() def findAllObjectsById(parent, target_id): @@ -189,11 +190,7 @@ results.extend(findAllObjectsById(child, target_id)) return results - - - - def set_value_with_slider(value_field_obj, slider_obj,parameter): """ Opens the slider and moves it gradually to the target value (step of 10). @@ -220,13 +217,15 @@ final_value = waitForObject(value_field_obj).value test.verify(final_value!= value, f"{parameter} slider adjusted correctly to {final_value}") squish.mouseRelease(slider, squish.Qt.LeftButton) - if object.exists(slider_obj): test.log(f"Waiting for {parameter} slider to close...") - waitFor(lambda: not object.exists(slider_obj), 1000) except LookupError as e: test.fail(f"{parameter}: LookupError - {e}") + +def get_current_date_and_time(date_format='%Y/%b/%d - %H:%M'): + date = datetime.now() + return str(date.strftime(date_format)) def click_left_until_off(object_name): """ Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -r0e16f6d7e1f8349a7ccf945c666f6fdab7752d16 -rb29968830a0ad7bfb6b1711404ece8e3f6b656eb --- suite_leahi/shared/scripts/names.py (.../names.py) (revision 0e16f6d7e1f8349a7ccf945c666f6fdab7752d16) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision b29968830a0ad7bfb6b1711404ece8e3f6b656eb) @@ -223,4 +223,26 @@ o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_pretreatmentPatientIDEntry", "type": "TextEntry", "unnamed": 1 } o_preTreatmentStack_Text = {"container": o_preTreatmentStack_PreTreatmentStack, "type": "Text", "unnamed": 1 } o_preTreatmentStack_stepIndicator_StepIndicator = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_stepIndicator", "type": "StepIndicator", "unnamed": 1 } - +o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjusterCustom= {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_bpMeasurementIntervalControl", "type": "ValueAdjusterCustom", "unnamed": 1 } +# _preTreatmentStack_confirmButton_ConfirmButton = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_confirmButton", "type": "ConfirmButton" } +o_preTreatmentStack_confirmButton_ConfirmButton = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_confirmButton", "type": "ConfirmButton", "visible": True } +o_waterSample_IconButton = {"container": o_Gui_MainView, "id": "_waterSample", "type": "IconButton", "unnamed": 1} +o_menu_MainMenu = {"container": o_Overlay, "id": "_menu", "type": "MainMenu", "unnamed": 1} +o_Column = {"container": o_Overlay, "type": "Column", "unnamed": 1} +o_confirmButton_ConfirmButton_2 = {"container": o_Overlay, "objectName": "_confirmButton", "type": "ConfirmButton"} +o_instructionContainer_Item = {"container": o_Overlay, "id": "_instructionContainer", "type": "Item", "unnamed": 1} +# o_listView_ListView_2 = {"container": o_Overlay, "id": "_listView", "type": "ListView", "unnamed": 1} +o_touchRect1_TouchRect = {"container": o_Overlay, "objectName": "_touchRect1", "type": "TouchRect"} +o_acidConcentrateContainer_LabelUnitContainer = {"container": o_Overlay, "objectName": "_acidConcentrateContainer", "type": "LabelUnitContainer"} +o_bicarbonateCartrideSizeContainer_LabelUnitContainer = {"container": o_Overlay, "objectName": "_bicarbonateCartrideSizeContainer", "type": "LabelUnitContainer"} +o_sodiumContainer_LabelUnitContainer = {"container": o_Overlay, "objectName": "_sodiumContainer", "type": "LabelUnitContainer"} +o_bicarbonateContainer_LabelUnitContainer = {"container": o_Overlay, "objectName": "_bicarbonateContainer", "type": "LabelUnitContainer"} +o_theoriticalCondictivityContainer_LabelUnitContainer = {"container": o_Overlay, "objectName": "_theoriticalCondictivityContainer", "type": "LabelUnitContainer"} +o_independentConductivityReadingContainer1_LabelUnitContainer = {"container": o_Overlay, "objectName": "_independentConductivityReadingContainer1", "type": "LabelUnitContainer"} +o_independentConductivityReadingContainer2_LabelUnitContainer = {"container": o_Overlay, "objectName": "_independentConductivityReadingContainer2", "type": "LabelUnitContainer"} +o_dialsateTemperatureContainer_LabelUnitContainer = {"container": o_Overlay, "objectName": "_dialsateTemperatureContainer", "type": "LabelUnitContainer"} +o_actualRORejectionPercentageContainer_LabelUnitContainer = {"container": o_Overlay, "objectName": "_actualRORejectionPercentageContainer", "type": "LabelUnitContainer"} + + + + Index: suite_leahi/tst_water_dialysate_blood_sampling/test.py =================================================================== diff -u -rc39b460f6f4585f23938b67f74bb60e58862baef -rb29968830a0ad7bfb6b1711404ece8e3f6b656eb --- suite_leahi/tst_water_dialysate_blood_sampling/test.py (.../test.py) (revision c39b460f6f4585f23938b67f74bb60e58862baef) +++ suite_leahi/tst_water_dialysate_blood_sampling/test.py (.../test.py) (revision b29968830a0ad7bfb6b1711404ece8e3f6b656eb) @@ -13,23 +13,105 @@ # Completed state import names +import can from leahi_dialin.ui import utils 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 +from leahi_dialin.protocols import CAN +from leahi_dialin.utils import conversions +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions + td =TD_Messaging() +watersample = None + +# handler for messages from UI to FW +def handle_water_sample_request( message, timestamp = 0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + state,index = conversions.bytearray_to_integer( message, index) + global watersample + watersample = state + +def set_acid_concentrate(): + test.startSection("Set acid concentrate") + navigation.navigation_pageIndicator_step(config.CREATERX) + mouseClick(waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry)) + waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry).text ="abcd" + utility.select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,config.ACID_CONCENTRATE,2) + utility.set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,37.0) + test.endSection() + def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) - + can_interface = td.can_interface + global watersample + + # handle sent messages from UI + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_WATER_SAMPLE_RESULT_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_water_sample_request) + test.startSection("Navigate to the create Rx page and set the acid concentrate option") td.td_operation_mode(TDOpModes.MODE_STAN.value) mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect)) td.td_operation_mode(TDOpModes.MODE_PRET.value) td.td_blood_set_auto_load_response(vRejectionReason = 0) - utility.verify_create_treatment_parameters() - test.endSection() \ No newline at end of file + set_acid_concentrate() + #open water sample dialog + mouseClick(waitForObject(names.o_waterSample_IconButton)) + #Check the dialog is opened + water_sample = waitForObject(names.o_menu_MainMenu) + test.compare(water_sample.visible,True ,"Water sample dialog is visible") + chlorine_level = waitForObject(names.o_Column) + fail_chlorine = utility.findObjectById(chlorine_level, "_failContainer") + mouseClick(waitForObject(fail_chlorine)) + mouseClick(waitForObject(names.o_confirmButton_ConfirmButton_2)) + test.verify(waitFor( lambda: watersample == 0, 3000), "Testing FW received Chlorine level > 0.1 mg/L Value") + pass_chlorine = utility.findObjectById(chlorine_level, "_passContainer") + mouseClick(waitForObject(pass_chlorine)) + mouseClick(waitForObject(names.o_confirmButton_ConfirmButton_2,2000)) + test.verify(waitFor( lambda: watersample == 1, 3000), "Testing FW received Chlorine level ≤ 0.1 mg/L Value") + dialysate_checks = waitForObject(names.o_touchRect1_TouchRect) + dialysate_checks_text =utility.findChildByText(dialysate_checks, "Dialysate Checks") + mouseClick(waitForObject(dialysate_checks_text)) + acid_concentrate = waitForObject(names.o_acidConcentrateContainer_LabelUnitContainer) + acid_concentrate_text = utility.findObjectById(acid_concentrate,"_acidConcentrateText") + test.log(str(acid_concentrate_text.text)) + bicarbonate_cartridge = waitForObject(names.o_bicarbonateCartrideSizeContainer_LabelUnitContainer) + bicarbonate_cartridge_text = utility.findObjectById(bicarbonate_cartridge,"_bicarbonateCartrideSizeText") + test.log(str(bicarbonate_cartridge_text.text)) + sodium = waitForObject(names.o_sodiumContainer_LabelUnitContainer) + sodium_text = utility.findObjectById(sodium,"_sodiumText") + test.log(str(sodium_text.text)) + bicarbonate = waitForObject(names.o_bicarbonateContainer_LabelUnitContainer) + bicarbonate_text = utility.findObjectById(bicarbonate,"_bicarbonateText") + test.log(str(bicarbonate_text.text)) + theoritical_Condictivity = waitForObject(names.o_theoriticalCondictivityContainer_LabelUnitContainer) + theoritical_Condictivity_text =utility.findObjectById(theoritical_Condictivity,"_theoriticalCondictivityText") + test.log(str(theoritical_Condictivity_text.text)) + independent_Conductivity_Reading1 = waitForObject(names.o_independentConductivityReadingContainer1_LabelUnitContainer) + independent_Conductivity_Reading1_text = utility.findObjectById(independent_Conductivity_Reading1,"_independentConductivityReading1Text") + test.log(str(independent_Conductivity_Reading1_text.text)) + independent_Conductivity_Reading2 =waitForObject(names.o_independentConductivityReadingContainer2_LabelUnitContainer) + independent_Conductivity_Reading2_text = utility.findObjectById(independent_Conductivity_Reading2,"_independentConductivityReading2Text") + test.log(str(independent_Conductivity_Reading2_text.text)) + dialsate_Temperature = waitForObject(names.o_dialsateTemperatureContainer_LabelUnitContainer) + dialsate_Temperature_text = utility.findObjectById(dialsate_Temperature, "_dialsateTemperatureText") + test.log(str(dialsate_Temperature_text.text)) + actualRO_RejectionPercentage = waitForObject(names.o_actualRORejectionPercentageContainer_LabelUnitContainer) + actualRO_RejectionPercentage_text = utility.findObjectById(actualRO_RejectionPercentage,"_actualRORejectionPercentageText") + test.log(str(actualRO_RejectionPercentage_text.text)) + test.endSection() Index: suite_leahi/tst_water_dialysate_blood_sampling/verificationPoints/VP1 =================================================================== diff -u --- suite_leahi/tst_water_dialysate_blood_sampling/verificationPoints/VP1 (revision 0) +++ suite_leahi/tst_water_dialysate_blood_sampling/verificationPoints/VP1 (revision b29968830a0ad7bfb6b1711404ece8e3f6b656eb) @@ -0,0 +1,4 @@ + + + +