# Subject/Title: Service - SW - 02 - Feature Configurations - Q&R # # Functionalities: Testing items of Service Feature Configurations feature # # Steps: # 1 Start Leahi Application and simulate TD standby mode and navigate to the Device Settings screen # and Navigate to Service screen, Enter Password and Click confirm Then Navigate to # Feature Configurations Screen and compare Title Bar text, Verify the parameter under Feature Configurations screen # Log Initial Integrated BP Cuff switch state: Unchecked and Enable it and Verify Enabled state then Click Back Button # Navigate to Main Treatment Screen using navigate_to_main_treatment_screen_from_settings Function # In Main Treatment Screen and Click Vitals Button and Verify that Measure Vitals button Enabled state in Vitals popup # Close the Vitals popup and Navigate back to Feature Configurations Screen and Log Integrated BP Cuff switch state and # Disable it and Verify Disable state then Click Back Button Navigate to Main Treatment Screen # In Main Treatment Screen and Click Vitals Button and Verify that Measure Vitals button Enabled state in Vitals popup # 2 Navigate back to Feature Configurations Screen and Log Initial Heparin Syringe Pump switch state: Unchecked # Enable Switch and Verify Enabled state then Click Back Button and Navigate to Main Treatment Screen # In Main Treatment Screen In HeaderBar Heparin is displayed and Navigate back to Feature Configurations Screen # And Log Heparin Syringe Pump switch state and Disable it and Verify Disable state then Click Back Button # Navigate to Main Treatment Screen In HeaderBar Heparin tab is not displayed import names from configuration import config, utility, navigation from leahi_dialin.ui import utils from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates td_simulator = TD_Messaging() def verify_integrated_bp_cuff_button_state(expected_state, message): """Helper function to verify the enabled/disabled state using test.compare.""" overlay_container = waitForObject(names.o_Overlay, 2000) integrated_bp_cuff_button = utility.findChildByText( overlay_container, "Measure Vitals" ) current_state = integrated_bp_cuff_button.enabled test.compare(current_state, expected_state, message) def navigate_to_main_treatment_screen_from_settings(): """Helper function to Navigate to Main Treatment screen from Device Settings""" main_menu_container = waitForObject(names.o_mainMenu_MainMenu, 2000) settings_menu_object = utility.findChildByText(main_menu_container, "Treatment") if settings_menu_object is not None: mouseClick(settings_menu_object) mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect, 3000)) td_simulator.td_operation_mode(TDOpModes.MODE_STAN.value, 0) td_simulator.td_operation_mode(TDOpModes.MODE_TREA.value, 0) td_simulator.td_tx_state( TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) blood_priming_screen = utility.findChildByText(headerbar_container, "Blood Priming") if blood_priming_screen.visible: td_simulator.td_tx_state( TDTreatmentStates.TREATMENT_BLOOD_PRIME_STATE.value,0,0,0,0,0,0,0,0,0, ) td_simulator.td_tx_state( TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) def feature_configurations_screen(): """Navigating to 'Feature Configurations' screen, Verifying Parameters, and Enable & Disable Integrated BP Cuff switch and Verifying it in Main Treatment Screen""" test.startSection( """Navigating to 'Feature Configurations' screen, Verifying Parameters, and Enable & Disable Integrated BP Cuff switch & Verifying it in Main Treatment Screen """ ) grid_container = waitForObject(names.o_DeviceSettingsGrid) feature_configurations_option = utility.findChildByText( grid_container, "Feature Configurations" ) if feature_configurations_option is not None: mouseClick(feature_configurations_option) headerbar_container = waitForObject(names.o_headerBar_HeaderBar) feature_configurations_title_text = utility.findChildByText( headerbar_container, "Feature Configurations" ) if feature_configurations_title_text is not None: test.compare( feature_configurations_title_text.text, config.FEATURE_CONFIGURATIONS_SCREEN_TITLE_TEXT, "{} screen is displayed and Comparison of Feature Configurations Screen Title text".format( config.FEATURE_CONFIGURATIONS_SCREEN_TITLE_TEXT ), ) # Wait for the main grid/container grid_container = waitForObject(names.o_SettingsBase_SettingsFeatureConfigurations) # Iterate through the list of expected texts from config for ( feature_configurations_parameter ) in config.FEATURE_CONFIGURATIONS_PARAMETERS_TEXTS: # Finding any child within the container that matches this text found_elements = utility.findAllObjectsByText( grid_container, feature_configurations_parameter ) # Verify that at least one such element was found if found_elements: # Take the first match found in the tree matched_obj = found_elements[0] test.compare( str(matched_obj.text), feature_configurations_parameter, f"'{feature_configurations_parameter}' found and verified in Feature Configurations Screen", ) # Wait for the toggle Integrated BP Cuff switch object integrated_bp_cuff_mode_switch = waitForObject( names.o_SettingsBase_integratedBPCuffSwitch_BaseSwitch, 3000 ) # Check current state and toggle Integrated BP Cuff and store the initial state was_checked = integrated_bp_cuff_mode_switch.checked test.log( f"Initial Integrated BP Cuff switch state: {'Checked' if was_checked else 'Unchecked'}" ) if was_checked == config.DISABLED: # Perform the toggle action mouseClick(integrated_bp_cuff_mode_switch) # Verify the state test.compare( integrated_bp_cuff_mode_switch.checked, config.ENABLED, f"Verify Integrated BP Cuff switch is Enabled", ) mouseClick(waitForObject(names.o_SettingsFeatureConfigurations_BackButton, 2000)) main_menu_container = waitForObject(names.o_mainMenu_MainMenu, 2000) prescriptions_menu_object = utility.findChildByText( main_menu_container, "Prescriptions" ) if prescriptions_menu_object is not None: mouseClick(prescriptions_menu_object) td_simulator.td_operation_mode(TDOpModes.MODE_STAN.value) navigate_to_main_treatment_screen_from_settings() mouseClick(waitForObjectExists(names.o_vitalsButton_VitalsButton, 2000)) verify_integrated_bp_cuff_button_state( config.ENABLED, "Comparison of Measure Vitals button Enabled state" ) mouseClick(waitForObjectExists(names.o_vitalsPopup_Close_Image, 2000)) td_simulator.td_operation_mode(TDOpModes.MODE_INIT.value) td_simulator.td_operation_mode(TDOpModes.MODE_SERV.value, 0) grid_container = waitForObject(names.o_DeviceSettingsGrid) feature_configurations_option = utility.findChildByText( grid_container, "Feature Configurations" ) if feature_configurations_option is not None: mouseClick(feature_configurations_option) # Wait for the toggle Integrated BP Cuff switch object integrated_bp_cuff_mode_switch = waitForObject( names.o_SettingsBase_integratedBPCuffSwitch_BaseSwitch, 3000 ) # Check current state and toggle Integrated BP Cuff and store the initial state was_checked = integrated_bp_cuff_mode_switch.checked test.log( f"Integrated BP Cuff switch state: {'Checked' if was_checked else 'Unchecked'}" ) if was_checked == config.ENABLED: # Perform the toggle action mouseClick(integrated_bp_cuff_mode_switch) # Verify the state test.compare( integrated_bp_cuff_mode_switch.checked, config.DISABLED, f"Verify Integrated BP Cuff switch is Disabled", ) mouseClick(waitForObject(names.o_SettingsFeatureConfigurations_BackButton, 2000)) main_menu_container = waitForObject(names.o_mainMenu_MainMenu, 2000) prescriptions_menu_object = utility.findChildByText( main_menu_container, "Prescriptions" ) if prescriptions_menu_object is not None: mouseClick(prescriptions_menu_object) navigate_to_main_treatment_screen_from_settings() mouseClick(waitForObjectExists(names.o_vitalsButton_VitalsButton, 2000)) verify_integrated_bp_cuff_button_state( config.DISABLED, "Comparison of Measure Vitals button Disabled state" ) mouseClick(waitForObjectExists(names.o_vitalsPopup_Close_Image, 2000)) td_simulator.td_operation_mode(TDOpModes.MODE_INIT.value) td_simulator.td_operation_mode(TDOpModes.MODE_SERV.value, 0) test.endSection() def enable_and_disable_heparin_and_verifing(): """Enable & Disable Heparin Syringe Pump switch and Verifying it in Main Treatment Screen""" test.startSection( "Enable & Disable Heparin Syringe Pump switch and Verifying it in Main Treatment Screen" ) grid_container = waitForObject(names.o_DeviceSettingsGrid) feature_configurations_option = utility.findChildByText( grid_container, "Feature Configurations" ) if feature_configurations_option is not None: mouseClick(feature_configurations_option) # Wait for the toggle Heparin Syringe Pump switch object heparin_syringe_pump_mode_switch = waitForObject( names.o_SettingsBase_heparinSyringePumpSwitch_BaseSwitch, 3000 ) # Check current state and toggle Heparin Syringe Pump and store the initial state was_checked = heparin_syringe_pump_mode_switch.checked test.log( f"Initial Heparin Syringe Pump switch state: {'Checked' if was_checked else 'Unchecked'}" ) if was_checked == config.DISABLED: # Perform the toggle action mouseClick(heparin_syringe_pump_mode_switch) # Verify the state test.compare( heparin_syringe_pump_mode_switch.checked, config.ENABLED, f"Verify Heparin Syringe Pump switch is Enabled", ) mouseClick(waitForObject(names.o_SettingsFeatureConfigurations_BackButton, 2000)) main_menu_container = waitForObject(names.o_mainMenu_MainMenu, 2000) prescriptions_menu_object = utility.findChildByText( main_menu_container, "Prescriptions" ) if prescriptions_menu_object is not None: mouseClick(prescriptions_menu_object) navigate_to_main_treatment_screen_from_settings() headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) heparin_bar = utility.findChildByText(headerbar_container, "Heparin") if heparin_bar.visible: test.log("In HeaderBar Heparin displayed and It is enabled") test.compare( heparin_bar.visible, config.ENABLED, f"Verify Heparin HeaderBar is Enabled and visible in screen", ) td_simulator.td_operation_mode(TDOpModes.MODE_INIT.value) td_simulator.td_operation_mode(TDOpModes.MODE_SERV.value, 0) grid_container = waitForObject(names.o_DeviceSettingsGrid) feature_configurations_option = utility.findChildByText( grid_container, "Feature Configurations" ) if feature_configurations_option is not None: mouseClick(feature_configurations_option) # Wait for the toggle Heparin Syringe Pump switch object heparin_syringe_pump_mode_switch = waitForObject( names.o_SettingsBase_heparinSyringePumpSwitch_BaseSwitch, 3000 ) # Check current state and toggle Heparin Syringe Pump and store the initial state was_checked = heparin_syringe_pump_mode_switch.checked test.log( f"Heparin Syringe Pump switch state: {'Checked' if was_checked else 'Unchecked'}" ) if was_checked == config.ENABLED: # Perform the toggle action mouseClick(heparin_syringe_pump_mode_switch) # Verify the state test.compare( heparin_syringe_pump_mode_switch.checked, config.DISABLED, f"Verify Heparin Syringe Pump switch is Disabled", ) mouseClick(waitForObject(names.o_SettingsFeatureConfigurations_BackButton, 2000)) main_menu_container = waitForObject(names.o_mainMenu_MainMenu, 2000) prescriptions_menu_object = utility.findChildByText( main_menu_container, "Prescriptions" ) if prescriptions_menu_object is not None: mouseClick(prescriptions_menu_object) navigate_to_main_treatment_screen_from_settings() headerbar_container = waitForObject(names.o_headerBar_HeaderBar, 2000) heparin_bar = utility.findChildByText(headerbar_container, "Heparin") if not heparin_bar.visible: test.log("In HeaderBar Heparin is not displayed") test.compare( heparin_bar.visible, config.DISABLED, f"Verify Heparin in HeaderBar is not visible", ) def main(): utils.tstStart(__file__) startApplication(utility.aut("-q")) navigation.navigate_to_device_settings_using_service_password() feature_configurations_screen() enable_and_disable_heparin_and_verifing() test.endSection()