Index: suite_leahi/shared/scripts/configuration/application_init.py =================================================================== diff -u -r4f71dc71ca95ab916947fafdc17c9e1e4f74c47e -r36cbf11896e8390abbfa43d3887d88817fee5463 --- suite_leahi/shared/scripts/configuration/application_init.py (.../application_init.py) (revision 4f71dc71ca95ab916947fafdc17c9e1e4f74c47e) +++ suite_leahi/shared/scripts/configuration/application_init.py (.../application_init.py) (revision 36cbf11896e8390abbfa43d3887d88817fee5463) @@ -187,3 +187,41 @@ aut_version = aut_name_and_version.split(" ") aut_version_only = aut_version[1] return aut_version_only + +def reset_system_setting(setting_key): + """ + Resets a specific setting in System.conf to its default value from System.dflt. + """ + base_path = Path.home() / "Public/luis/config/configurations/Settings/" + source_file = base_path / "System.dflt" + target_file = base_path / "System.conf" + + new_value = None + search_pattern = f"{setting_key} =" + + # Read the default value from .dflt + with open(source_file, 'r') as f: + for line in f: + if search_pattern in line: + new_value = line.split("=")[1].strip() + break + + if new_value is None: + print(f"Setting '{setting_key}' not found in {source_file.name}") + return + + # Read the current .conf file + with open(target_file, 'r') as f: + conf_lines = f.readlines() + + # Update the value in memory + updated_lines = [] + for line in conf_lines: + if line.strip().startswith(setting_key): + updated_lines.append(f"{setting_key} = {new_value}\n") + else: + updated_lines.append(line) + + # Write back to .conf + with open(target_file, 'w') as f: + f.writelines(updated_lines) \ No newline at end of file Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -r75e3ab588237239452761d2ec90e8b3aec6a916b -r36cbf11896e8390abbfa43d3887d88817fee5463 --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 75e3ab588237239452761d2ec90e8b3aec6a916b) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 36cbf11896e8390abbfa43d3887d88817fee5463) @@ -85,10 +85,112 @@ ACTIVE = 'Active' RESUME = 'Resume' COMPLETE = 'Complete' -HEPARIN = "Heparin" -CREATERX = "Rx" -VALIDATE = "VALIDATE" -CONFIRM = "CONFIRM" -NEXT ="Next" +HEPARIN = 'Heparin' +CREATERX = 'Rx' +VALIDATE = 'VALIDATE' +CONFIRM = 'CONFIRM' +NEXT = 'Next' +AUTO_LOAD = 'Auto Load' +WATER_SAMPLE = 'Water Sample' +START = 'Start' +AUTO_EJECT = 'Auto Eject' +# Settings Service +DEFAULT_SERVICE_PASSWORD_RAW = "Atal.Matal.22leh" # TODO need to update if we ever change the default +NEW_PASSWORD_RAW = "Test4.Ksah.sk43sa" +MANUFACTURING_SCREEN_TITLE_TEXT = "Manufacturing Setup" +SERVICE_SCREEN_TITLE_TEXT = "Service" +ADVANCED_MODES_SCREEN_TITLE_TEXT = "Advanced Mode" +DATE_AND_TIME_SCREEN_TITLE_TEXT = "Date and Time" +DATE_AND_TIME_PARAMETERS_TEXTS = ["NTP", "(Network Time Protocol)", "Time", "(HH:mm:ss)", "Date", "(MM/dd/yyyy)"] +ENABLE_ROOT_SSH_SCREEN_TITLE_TEXT = "Enable Root SSH" +ENABLE_ROOT_SSH_PARAMETERS_TEXTS = ["Enable SSH Login", "Enable Root Login"] +FACTORY_RESET_SCREEN_TITLE_TEXT = "Factory Reset" +FACTORY_RESET_SCREEN_TEXT = "Do you want to perform the factory reset?" +#Blood Set Auto Load +BLOOD_SET_AUTO_LOAD_REJECTION = "[1] Request is not allowed in the current operating mode" +BLOOD_SET_AUTO_EJECT_REJECTION = "[1] Request is not allowed in the current operating mode" + +#Device Settings Options +DEVICE_SETTINGS = "Device Settings" +ADVANCED_MODE = "Advanced Mode" +DEVICE_INFORMATION = "Device Information" +WI_FI = "Wi-Fi" +DEVICE_CLEANING = "Device Cleaning" +SERVICE = "Service" +EXPORT_LOGS = "Export Logs" +VOLUME_AND_BRIGHTNESS = "Volume And Brightness" +FEATURE_CONFIGURATIONS = "Feature Configurations" +ADVANCED_INSTITUTIONAL_SETTINGS = "Advanced Institutional Settings" +FACTORY_RESET = "Factory Reset" +ENABLE_ROOT_SSH = "Enable Root SSH" +INSTITUTIONAL_CONFIGURATIONS = "Institutional Configurations" +DATE_AND_TIME = "Date and Time" +LANGUAGE = "Language" + +#Menu Bar +PRESCRIPTIONS = "Prescriptions" +TREATMENT = "Treatment" +SETTINGS = "Settings" + +# Pre-Treatment Foundation +CONCENTRATES_PAGE_TITLE = "Connect Acid and Bicarbonate Concentrates" +CONCENTRATES_PAGE_CONTENTS = [ + "Remove acid connector and connect to acid concentrate.", + "Connect dry bicarbonate.", +] +INSTALLATION_STEPPER_1_PAGE_TITLE = "Install Blood Tubing Set" +INSTALL_BLOOD_TUBING_SET_CONTENTS = [ + "Open the blood pump door.", + "Insert blood tubing set and ensure it is secure.", + "Push the blood tube into the blood pump.", + "Close the blood pump door.", +] +INSTALLATION_STEPPER_2_PAGE_TITLE = "Install Bloodlines" +INSTALL_BLOODLINES_CONTENTS = [ + "Insert saline line into the first slot.", + "Insert arterial line into the second slot.", + "Ensure the venous line is placed in the bubble detector.", + "Insert the venous line into the third slot.", + "Connect the arterial and venous bloodlines using the recirculation connector.", +] +INSTALLATION_STEPPER_3_PAGE_TITLE = "Install Pressure Lines and Dialyzer" +INSTALL_PRESSURE_LINES_CONTENTS = [ + "Connect the arterial pressure line to the arterial pressure transducer port.", + "Connect the venous pressure line to the venous pressure transducer port.", + "Insert dialyzer into the holder and connect the dialysate lines.", + "Connect the bloodlines to the dialyzer.", + "Clamp the venous chamber line.", + "Clamp the heparin line.", +] +SELF_TESTS_PAGE_CONTENTS = [ + "Auto-Load Blood Tubing", + "Cartridge Install Checks", + "Pressure Leak Check", +] +SALINE_PAGE_TITLE = "Connect Saline Bag" +SALINE_PAGE_CONTENTS = [ + "Hang saline bag on the hook.", + "Clamp saline line.", + "Use the saline line to spike saline bag.", + "Unclamp saline line.", +] +PRIME_PAGE_CONTENTS = ["Blood Tubing Circuit Priming", "Dialysate Circuit Priming"] +CONNECT_PAGE_TITLE = "Connect Bloodlines to the Patient" +CONNECT_PAGE_CONTENTS = [ + "Clamp arterial and venous bloodlines (2 clamps).", + "Remove recirculation connector from the bloodlines.", + "Connect bloodlines to patient access lines.", + "Unclamp arterial and venous bloodlines (2 clamps).", +] +DISCONNECT_PAGE_TITLE = "Remove Concentrates and Blood Tubing Set" +DISCONNECT_PAGE_CONTENTS = [ + "Remove blood tubing set and dialyzer.", + "Remove acid and bicarbonate concentrates.", +] +INSTALLATION_PAGE_TITLE = "Install Concentrates and Blood Tubing Set" +INSTALLATION_PAGE_CONTENTS = [ + "Install acid and bicarbonate concentrates.", + "Install blood tubing set and dialyzer.", +] \ No newline at end of file Index: suite_leahi/shared/scripts/configuration/navigation.py =================================================================== diff -u -rc7d96b722594bb29a7bbc3689715b90af6e3d616 -r36cbf11896e8390abbfa43d3887d88817fee5463 --- suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision c7d96b722594bb29a7bbc3689715b90af6e3d616) +++ suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision 36cbf11896e8390abbfa43d3887d88817fee5463) @@ -4,36 +4,64 @@ 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() - + def navigate_to_device_settings_screen(): """ - Method to navigate to "Service" screen + Method to navigate to "Device Settings" screen and Compare Device Settings screen title text """ td_simulator.td_operation_mode(TDOpModes.MODE_STAN.value, 0) - settings_menu_object = utility.get_object_from_names( - names.o_Settings_Menu, - error_message="Settings menu object missing", - timeout_ms=1000, - ) - if settings_menu_object is not None: - squish.mouseClick(settings_menu_object) + main_menu_container = squish.waitForObject(names.o_mainMenu_MainMenu, 2000) + squish.mouseClick(utility.findChildByText(main_menu_container, config.SETTINGS)) - device_setting_screen_title_text = utility.get_object_from_names( - names.o_DeviceSettingsTitleText, - error_message="Device Settings Screen title text object missing", - timeout_ms=2000, + headerbar_container = squish.waitForObject(names.o_headerBar_HeaderBar, 2000) + device_setting_screen_headerbar_title_text = utility.findChildByText( + headerbar_container, config.DEVICE_SETTINGS ) - if device_setting_screen_title_text is not None: + if device_setting_screen_headerbar_title_text is not None: test.compare( - device_setting_screen_title_text.text, + device_setting_screen_headerbar_title_text.text, config.DEVICE_SETTINGS_SCREEN_TITLE_TEXT, "{} screen is displayed and Comparison of Device Settings Screen Title text".format( config.DEVICE_SETTINGS_SCREEN_TITLE_TEXT ), ) +def navigate_to_device_settings_using_service_password(): + td_simulator.td_operation_mode(TDOpModes.MODE_STAN.value, 0) + main_menu_container = squish.waitForObject(names.o_mainMenu_MainMenu, 2000) + squish.mouseClick(utility.findChildByText(main_menu_container, config.SETTINGS)) + + td_simulator.td_operation_mode(TDOpModes.MODE_SERV.value, 0) + grid_container = squish.waitForObject(names.o_DeviceSettingsGrid) + squish.mouseClick(utility.findChildByText(grid_container, config.SERVICE)) + + 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 +74,29 @@ """ test.startSection("Method to navigation in the pretreatment page ") stepId = squish.waitForObjectExists(names.o_preTreatmentStack_stepIndicator_StepIndicator) + 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) + 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)); + 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 Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rc7d96b722594bb29a7bbc3689715b90af6e3d616 -r36cbf11896e8390abbfa43d3887d88817fee5463 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision c7d96b722594bb29a7bbc3689715b90af6e3d616) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 36cbf11896e8390abbfa43d3887d88817fee5463) @@ -3,14 +3,67 @@ import object 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 +from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates +from configuration import config, navigation +from leahi_dialin.ui import utils +from builtins import int as pyInt td =TD_Messaging() -from leahi_dialin.ui import utils -from builtins import int as pyInt + +def aut(*args): + """ + Joins the executable name and argument + into a single command string +* Options: + * -h, --help Displays help on commandline options. + * --help-all Displays help including Qt specific + * options. + * -v, --version Displays version information. + * -c, --canOut Show the Can Frame Output + * -m, --msgOut Show the Message Output + * -l, --logOut Show the Logs Output + * -0, --enable-keep-awake Enable send low priority, empty message + * on the CANBus just to keep UI board CAN + * driver awake + * -i, --fake-interval Test fake message interval(ms) + * -f, --fake-message Test fake message data + * will use default sequenced long fake + * message if set to 00(default) + * will used only if correct integer value + * assigned for interval option + * -b, --fake-message-seq-at-begin Test fake message sequence at the + * beginning of the frame + * -u, --disable-unhandled-report Disable unhandled messages report as an + * error in the log + * -d, --disable-dialin-unhandled Disable the Dialin messages logged as + * unhandled + * -q, --disable-timeout Disables communication timeout + * -a, --disable-alarm-no-minimize Disables alarm no minimize + * -S, --disable-sd-card-fail-log-stop disable-sd-card-fail-log-stop + * -C, --disable-cloudsync-fail-stop disable-cloudsync-fail-stop + * -k, --disable-check-in-log Disables Check-In Log + * -K, --disable-acknow-log Disables Acknowledgment Log + * -D, --enable-dry-demo Enables Dry-Demo Mode + * -A, --active-can-bus Sets the Active CANBus [Shall start with + * 'can' or 'vcan] + * -E, --enable-manufacturing Enables the manufacturing mode to + * configure the system for the first time. + * -R, --use-root-home In case the application is not in + * Manufacturing Setup but needs to use root + * home folder for configurations. + * -U, --enable-update-mode Enables the update mode to update only + * necessary files during the update and + * keep the rest. + * -x, --use-log-long-name Use the log long file name format + * _