import names import test import squish from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes, TDStandbyStates from configuration import config, utility td_simulator = TD_Messaging() def navigate_to_device_settings_screen(): """ Method to navigate to "Service" screen """ 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) headerbar_container = squish.waitForObject(names.o_headerBar_HeaderBar, 2000) device_setting_screen_headerbar_title_text = utility.findChildByText( headerbar_container, "Device Settings" ) if device_setting_screen_headerbar_title_text is not None: test.compare( 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_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 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[1:]): 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() 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()