Index: suite_leahi/shared/scripts/configuration/navigation.py =================================================================== diff -u -r279e768763ca90eadc690f1c922889f8969e5e6f -rea332e15d3df5245676b6e5fb6f1a235e990c860 --- suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision 279e768763ca90eadc690f1c922889f8969e5e6f) +++ suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision ea332e15d3df5245676b6e5fb6f1a235e990c860) @@ -4,24 +4,22 @@ 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) - headerbar_container = squish.waitForObject(names.o_mainMenu_MainMenu, 2000) - settings_menu_object = utility.findChildByText( - headerbar_container, "Settings" - ) - 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)) headerbar_container = squish.waitForObject(names.o_headerBar_HeaderBar, 2000) device_setting_screen_headerbar_title_text = utility.findChildByText( - headerbar_container, "Device Settings" + headerbar_container, config.DEVICE_SETTINGS ) if device_setting_screen_headerbar_title_text is not None: test.compare( @@ -33,31 +31,37 @@ ) 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) - service_option = utility.findChildByText(grid_container, "Service") + squish.mouseClick(utility.findChildByText(grid_container, config.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. @@ -69,35 +73,30 @@ """ test.startSection("Method to navigation in the pretreatment page ") - stepcount = squish.waitForObjectExists(names.o_preTreatmentStack_repeater_Repeater) - Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) - squish.mouseClick(squish.waitForObject(Nextbutton)) + 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") - if stepcount.count == 9: - for input_field in values[3:]: - 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: - break - else: - Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) - squish.mouseClick(Nextbutton) - else: - for input_field in values[3:]: - test.log(str(input_field.text)) - if str(input_field.text) == "Water Sample": - squish.mouseClick(waitForObject(names.o_PreTreatmentSampleStack_button_TouchRect)) + 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: - break - else: - Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) - squish.mouseClick(Nextbutton) + if str(input_field.text) == vStep_name: + break + else: + Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) + squish.mouseClick(Nextbutton) - test.endSection() + test.endSection() \ No newline at end of file