Index: shared/scripts/configuration/config.py =================================================================== diff -u -r9ef78246744be74035d8521b7ee71dc84a623883 -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 --- shared/scripts/configuration/config.py (.../config.py) (revision 9ef78246744be74035d8521b7ee71dc84a623883) +++ shared/scripts/configuration/config.py (.../config.py) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -157,7 +157,7 @@ #Service password location SERVICE_CONF_LOCATION ="".join([str(HOME_DIR_PATH),'/Projects/application/resources/settings/Settings/System.conf']) DEFAULT_SERVICE_PASSWORD_RAW = "Atal.Matal.22leh" # TODO need to update if we ever change the default -SERVICE_SCREEN_SUBSCREEN_INDEX = { +SERVICE_SCREEN_SUBSCREEN_INDEX = { #these indices are only valid for the service screen accessed after password entered "INFORMATION_SUBSCREEN" :2, "VOLUME_AND_BRIGHTNESS_SUBSCREEN":3, "WIFI_SUBSCREEN" : 4, @@ -220,17 +220,17 @@ #pressure PRESSURE_STEPS = 10 -ARTERIAL_PRESSURE_MINIMUM = -400 -ARTERIAL_PRESSURE_MAXIMUM = +100 +ARTERIAL_PRESSURE_MINIMUM = +120 +ARTERIAL_PRESSURE_MAXIMUM = +200 ARTERIAL_PRESSURE_LOW_MIN = -300 ARTERIAL_PRESSURE_LOW_DEF = -300 ARTERIAL_PRESSURE_LOW_MAX = +200 ARTERIAL_PRESSURE_HIGH_MIN = -300 ARTERIAL_PRESSURE_HIGH_DEF = +100 ARTERIAL_PRESSURE_HIGH_MAX = +200 -VENOUS_PRESSURE_MINIMUM = -100 -VENOUS_PRESSURE_MAXIMUM = +500 #check is meant to be 500 +VENOUS_PRESSURE_MINIMUM = +100 +VENOUS_PRESSURE_MAXIMUM = +200 #check is meant to be 500 VENOUS_PRESSURE_LOW_MIN = -100 VENOUS_PRESSURE_LOW_DEF = -100 VENOUS_PRESSURE_LOW_MAX = +600 Index: shared/scripts/configuration/strings.py =================================================================== diff -u -r9ef78246744be74035d8521b7ee71dc84a623883 -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 --- shared/scripts/configuration/strings.py (.../strings.py) (revision 9ef78246744be74035d8521b7ee71dc84a623883) +++ shared/scripts/configuration/strings.py (.../strings.py) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -217,6 +217,15 @@ SERVICES_TITLE_TEXT = "Service Password" SERVICES_ENABLE_ROOT_SSH_TITLE="Enable Root SSH" +SERVICES_FACTORY_RESET_TITLE="Factory Reset" +SERVICES_FACTORY_RESET_CONFIRM_MSG = "Are you sure?" +SERVICES_FACTORY_RESET_MSGS = ["Do you want to perform the factory reset?", "Please wait..."] + +SERVICES_DECOMMISSION_TITLE="Decommissioning" +SERVICES_DECOMMISSION_CONFIRM_MSG = "Are you sure?" +SERVICES_DECOMMISSION_MSGS = ["Do you want to perform the decommissioning?", "Please wait..."] + + #main treatment screen VITALS_TITLE = "VITALS" PATIENT_ID = "demopatientid" Index: shared/scripts/configuration/utility.py =================================================================== diff -u -re8535a7e3c30daad306221dd3d0c822f6994d503 -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 --- shared/scripts/configuration/utility.py (.../utility.py) (revision e8535a7e3c30daad306221dd3d0c822f6994d503) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -32,6 +32,17 @@ def color_verification(exp_val = "Red", act_val = "#c53b33"): test.compare(config.COLOR_CODES[color_name],(act_val.color[name])) +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 + @param names_dict - the dictionary element from the names.py file (ie: names.some_variable_name_of_element) + @returns the object with corresponding dictionary, otherwise "None" + """ + try: + return squish.waitForObject(names_dict, timeout_ms) + except LookupError: + test.fail("ERROR : " + error_message) + return None def get_text_object(screen_obj, txt): """ Index: shared/scripts/names.py =================================================================== diff -u -re8535a7e3c30daad306221dd3d0c822f6994d503 -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 --- shared/scripts/names.py (.../names.py) (revision e8535a7e3c30daad306221dd3d0c822f6994d503) +++ shared/scripts/names.py (.../names.py) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -1110,5 +1110,21 @@ o_SettingsBase_settingsRootSSHAccess_SSHDSwitch_Switch = {"checkable": True, "container": o_SettingsBase_SettingsRootSSHAccess, "id": "_settingsRootSSHAccess_SSHDSwitch", "type": "Switch", "unnamed": 1, "visible": True} o_SettingsBase_settingsRootSSHAccess_RootSwitch_Switch = {"checkable": True, "container": o_SettingsBase_SettingsRootSSHAccess, "id": "_settingsRootSSHAccess_RootSwitch", "type": "Switch", "unnamed": 1, "visible": True} o_SettingsBase_Enable_Root_SSH_Text = {"container": o_SettingsBase_SettingsRootSSHAccess, "text": "Enable Root SSH", "type": "Text", "unnamed": 1, "visible": True} -o_treatmentHome_Saline_Rejection_Text = {"container": o_treatmentHome, "text": "", "type": "Text", "unnamed": 1, "visible": True} +# Services -> Service screen +o_userConfirmation_SettingsFactoryReset = {"container": o_Gui_MainView, "objectName": "UserConfirmation", "type": "SettingsFactoryReset", "visible": True} +o_userConfirmation_Factory_Reset_Text = {"container": o_userConfirmation_SettingsFactoryReset, "text": "Factory Reset", "type": "Text", "unnamed": 1, "visible": True} +o_service_confirmation_are_you_sure_TitleText = {"container": o_Overlay, "text": "Are you sure?", "type": "TitleText", "unnamed": 1, "visible": True} +o_confirmTouch_TouchRect = {"container": o_Overlay, "id": "_confirmTouch", "type": "TouchRect", "unnamed": 1, "visible": True} +o_services_factory_reset_back_button = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_backButton", "type": "BackButton", "visible": True} +o_services_factory_reset_confirm_button = {"container": o_userConfirmation_SettingsFactoryReset, "objectName": "_confirmButton", "type": "ConfirmButton", "visible": True} +o_service_subscreen_titleText = {"container": o_Overlay, "text": "Factory Reset", "type": "TitleText", "unnamed": 1, "visible": True} + +# Services -> Decommission screen +o_serviec_decommission_parent = {"container": o_Gui_MainView, "objectName": "UserConfirmation", "type": "SettingsDecommission", "visible": True} +o_service_decommission_confirm_button = {"container": o_serviec_decommission_parent, "objectName": "_confirmButton", "type": "ConfirmButton", "visible": True} +o_service_decommission_back_button = {"container": o_serviec_decommission_parent, "objectName": "_backButton", "type": "BackButton", "visible": True} +userConfirmation_Decommissioning_Text = {"container": o_serviec_decommission_parent, "text": "Decommissioning", "type": "Text", "unnamed": 1, "visible": True} +o_SettingsHome_touchItem_TouchRect_2 = {"container": o_SettingsHome_SettingsHome_settings, "id": "_touchItem", "occurrence": 8, "type": "TouchRect", "unnamed": 1, "visible": True} +o_SettingsBase_rectAnim_Rectangle = {"container": o_SettingsBase_SettingsExportLogs, "id": "_rectAnim", "type": "Rectangle", "unnamed": 1, "visible": True} + Index: suite.conf =================================================================== diff -u -re8535a7e3c30daad306221dd3d0c822f6994d503 -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 --- suite.conf (.../suite.conf) (revision e8535a7e3c30daad306221dd3d0c822f6994d503) +++ suite.conf (.../suite.conf) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -5,6 +5,6 @@ IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_environment tst_post tst_standbymode tst_In_treatment tst_main_treatment_pressure tst_treatment_blood_dialysateflow_rate tst_main_treatment_vitals tst_ui_alarms_list tst_ui_alarms_dialog tst_main_treatment_ultrafiltration tst_main_treatment_heparin tst_pre_treatment_priming pre_treatment_disposables pre_treatment_patient_connection tst_unhandled_message_log tst_instructions_poc tst_service_screen tst_cloud_sync_device_registration tst_rinseback_setup tst_recirculate tst_settings_information tst_cloud_sync - treatment_screen tst_dialin_logs tst_disinfection tst_service_menu +TEST_CASES=tst_environment tst_post tst_standbymode tst_In_treatment tst_main_treatment_pressure tst_treatment_blood_dialysateflow_rate tst_main_treatment_vitals tst_ui_alarms_list tst_ui_alarms_dialog tst_main_treatment_ultrafiltration tst_main_treatment_heparin tst_pre_treatment_priming pre_treatment_disposables pre_treatment_patient_connection tst_unhandled_message_log tst_instructions_poc tst_service_screen tst_cloud_sync_device_registration tst_rinseback_setup tst_recirculate tst_settings_information tst_cloud_sync - treatment_screen tst_dialin_logs tst_disinfection tst_service_protected_menu tst_service_export_logs VERSION=3 WRAPPERS=Qt Index: tst_main_treatment_pressure/test.py =================================================================== diff -u -r7883bcc9c71da71d09d48d8998a99a9b8ad0640a -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 --- tst_main_treatment_pressure/test.py (.../test.py) (revision 7883bcc9c71da71d09d48d8998a99a9b8ad0640a) +++ tst_main_treatment_pressure/test.py (.../test.py) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -588,9 +588,7 @@ art_max_limit=0, art_min_limit=0, ven_max_limit=0, - ven_min_limit=0, - filtered_arterial_prs=0, - filtered_venous_prs=0) + ven_min_limit=0) arterial_limit_min = waitForObjectExists(names.o_arterial_limitbar).minimum arterial_limit_max = waitForObjectExists(names.o_arterial_limitbar).maximum @@ -624,9 +622,7 @@ art_max_limit=0, art_min_limit=0, ven_max_limit=0, - ven_min_limit=0, - filtered_arterial_prs=0, - filtered_venous_prs=0) + ven_min_limit=0) # venous_current_value = waitForObjectExists(names.o_venous_marker).value venous_limit_min = waitForObjectExists(names.o_venous_limitbar).minimum venous_limit_max = waitForObjectExists(names.o_venous_limitbar).maximum Index: tst_service_export_logs/test.py =================================================================== diff -u --- tst_service_export_logs/test.py (revision 0) +++ tst_service_export_logs/test.py (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*-" +## +# Copyright (c) 2019-2023 Diality Inc. - All Rights Reserved. +# copyright +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, +# IN PART OR IN WHOLE, +# WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# file tst_settings_information +# date 10/07/2023 +# author Vy Duong + +### +## Tests for the service menu section that is password protected +### + +import builtins +import names + +from configuration import application_init as application_init +from configuration import config, utility +from dialin.ui.hd_simulator import HDSimulator +from dialin.common.hd_defs import HDOpModes, HDStandbyStates +from dialin.ui import utils +from calendar import isleap + +hd_simulator = HDSimulator() + +def custom_object_for_export_log(text): + """ + Method to set custom object property for export option + @param text : (string) parameter text + """ + names.o_option_combo_box["text"] = text + return names.o_option_combo_box + +def service_text_obj(text): + names.o_service_home_text_obj["text"] = text + return names.o_service_home_text_obj + + +def navigate_to_service_menu(): + """ + Method to navigate to "Service" screen + """ + test.startSection("Navigating to 'Service' menu") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_SERV.value, sub_mode=HDStandbyStates.STANDBY_START_STATE.value) + utils.waitForGUI(0.5) + service_screen_text = utility.get_object_from_names(service_text_obj(config.SERVICE_SCREEN_TITLE_TEXT), error_message="Service Screen title object missing") + if service_screen_text is not None: + test.compare(service_screen_text.text, config.SERVICE_SCREEN_TITLE_TEXT, "{} screen is displayed".format(config.SERVICE_SCREEN_TITLE_TEXT)) + test.endSection() + + +def navigate_to_subscreen(whichScreenKey, expectedScreenTitle, titleObject): + """ + Method to navigate to the water input mode screen + @param whichScreenEnum : SERVICE_SCREEN_SUBSCREEN_INDEX + """ + test.startSection(f"Navigating '{expectedScreenTitle}' screen") + names.o_serviceScreen_subscreen_menu["occurrence"] = whichScreenKey + service_subScreen_menu_element = utility.get_object_from_names(names.o_serviceScreen_subscreen_menu, error_message="subscreen menu element not found") + if service_subScreen_menu_element is not None: + mouseClick(service_subScreen_menu_element) + utils.waitForGUI(0.5) + subscreenTitle = utility.get_object_from_names(titleObject, error_message=f"{expectedScreenTitle} object is missing") + if subscreenTitle is not None: + test.compare(subscreenTitle.text, expectedScreenTitle, "{} should be displayed when user is navigated to this screen".format(expectedScreenTitle)) + test.endSection() + +def navigate_to_export_logs(): + test.startSection("Verifying the the export logs screen") + export_log_subscreen_menu_element = utility.get_object_from_names(names.o_SettingsHome_export_log_mouseArea_MouseArea, error_message = "export log menu element object missing") + if export_log_subscreen_menu_element is not None: + mouseClick(export_log_subscreen_menu_element) + + utils.waitForGUI(1) + + export_log_text = utility.get_object_from_names(names.o_export_logs_text, error_message = "export log text object missing") + if export_log_text is not None: + test.compare(export_log_text.text,config.EXPORT_LOG_TEXT,"{} should be under export logs screen ".format(config.EXPORT_LOG_TEXT)) + test.endSection() + +def select_different_log_type(whichTypeIndex): + log_type_combo_box = utility.get_object_from_names(names.o_combo_box, error_message="Combo box object is missing") + if log_type_combo_box is not None: + mouseClick(waitForObjectExists(names.o_combo_box)) + + log_type_option = utility.get_object_from_names(custom_object_for_export_log(config.EXPORT_LOGS_OPTIONS[whichTypeIndex]), + error_message=f"Option {config.EXPORT_LOGS_OPTIONS[whichTypeIndex]} object is missing", timeout_ms = 500) + if log_type_option is not None: + mouseClick(log_type_option) + utils.waitForGUI(2) + test.compare(config.EXPORT_LOGS_OPTIONS[whichTypeIndex], waitForObjectExists(names.o_combo_box ).displayText, "User should able to select {}".format(config.EXPORT_LOGS_OPTIONS[whichTypeIndex])) + utils.waitForGUI(1) + return True + return False # default return if not successful + +def check_eject_usb_button(is_enabled, is_clicking_button = False): + """ + For checking enabled/disabled state of the usb eject button + """ + eject_usb_button = utility.get_object_from_names(names.o_SettingsBase_image_Image_export_log_eject_button, error_message="eject usb button object not found") + if eject_usb_button is not None: + test.compare(eject_usb_button.enabled, is_enabled, f"Check if the USB eject button enabled = {is_enabled}") + if is_clicking_button: + utils.waitForGUI(0.5) + mouseClick(eject_usb_button) + utils.waitForGUI(0.5) + +app_context = None; +def init_application_service_export_logs(): + """ + starts the application and traverse to the export log screen + """ + app_context = startApplication(config.AUT_NAME+ " -l") + + navigate_to_service_menu() + navigate_to_export_logs() + +def stop_application(): + if app_context is not None: + app_context.detach() + +def test_export_logs_eject_usb_case(): + """ + tests the case that the usb is ejected, requires restarting the application to get original state + """ + init_application_service_export_logs() + check_eject_usb_button(config.ENABLED, is_clicking_button=True) + utils.waitForGUI(1) + # check_eject_usb_button(config.DISABLED) + stop_application() + +def main(): + utils.tstStart(__file__) + test.log("TODO test case incomplete, need script call handling in the APP to complete", "Need to add an option to the application to allow mocked-script calls") + application_init.setup_post_log_successful_start() + + test_export_logs_eject_usb_case() + + # select_different_log_type(1) + + # TODO need to select the logs and click export + + utils.tstDone() + \ No newline at end of file Fisheye: Tag 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 refers to a dead (removed) revision in file `tst_service_menu/test.py'. Fisheye: No comparison available. Pass `N' to diff? Index: tst_service_protected_menu/test.py =================================================================== diff -u --- tst_service_protected_menu/test.py (revision 0) +++ tst_service_protected_menu/test.py (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -0,0 +1,315 @@ +# -*- coding: utf-8 -*-" +## +# Copyright (c) 2019-2023 Diality Inc. - All Rights Reserved. +# copyright +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, +# IN PART OR IN WHOLE, +# WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# file tst_settings_information +# date 10/07/2023 +# author Vy Duong + +### +## Tests for the service menu section that is password protected +### + +import builtins +import names + +from configuration import application_init as application_init +from configuration import config, utility +from dialin.ui.hd_simulator import HDSimulator +from dialin.common.hd_defs import HDOpModes, HDStandbyStates +from dialin.ui import utils +from calendar import isleap + +hd_simulator = HDSimulator() + +def service_text_obj(text): + names.o_service_home_text_obj["text"] = text + return names.o_service_home_text_obj + + +def navigate_to_service_menu(): + """ + Method to navigate to "Service" screen + """ + test.startSection("Navigating to 'Service' menu") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_SERV.value, sub_mode=HDStandbyStates.STANDBY_START_STATE.value) + utils.waitForGUI(0.5) + service_screen_text = utility.get_object_from_names(service_text_obj(config.SERVICE_SCREEN_TITLE_TEXT), error_message="Service Screen title object missing") + if service_screen_text is not None: + test.compare(service_screen_text.text, config.SERVICE_SCREEN_TITLE_TEXT, "{} screen is displayed".format(config.SERVICE_SCREEN_TITLE_TEXT)) + + service_text = utility.get_object_from_names(names.o_service_text, error_message = "Service text object is missing") + if service_text is not None: + test.compare(service_text.text,config.SERVICE_TEXT, "{} screen is displayed".format(config.SERVICE_TEXT)) + mouseClick(waitForObjectExists(names.o_service_text)) + + #enter the password to access screen + test.log("Clicking on password entry field") + utils.waitForGUI(0.5) + mouseClick(waitForObjectExists(names.o_password_text_field)) + mouseClick(waitForObjectExists(names.o_switch_keyboard_to_keypad)) + password = config.DEFAULT_SERVICE_PASSWORD_RAW + type(waitForObject(names.o_password_text_field), str(password)) + confirm_button = (waitForObjectExists(names.o_service_confirm_btn).text) + test.compare(confirm_button, config.CONFIRM_TEXT, "Button text should be {}".format(config.CONFIRM_TEXT)) + mouseClick(waitForObjectExists(names.o_service_confirm_btn)) + utils.waitForGUI(0.5) + + # HD response to advance to the service menu + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_SERV.value, sub_mode=HDStandbyStates.STANDBY_START_STATE.value) + + test.endSection() + + +def navigate_to_subscreen(whichScreenKey, expectedScreenTitle, titleObject): + """ + Method to navigate to the water input mode screen + @param whichScreenEnum : SERVICE_SCREEN_SUBSCREEN_INDEX + """ + test.startSection(f"Navigating '{expectedScreenTitle}' screen") + utils.waitForGUI(0.5) + names.o_serviceScreen_subscreen_menu["occurrence"] = whichScreenKey + service_subScreen_menu_element = utility.get_object_from_names(names.o_serviceScreen_subscreen_menu, error_message="subscreen menu element not found") + if service_subScreen_menu_element is not None: + mouseClick(service_subScreen_menu_element) + utils.waitForGUI(0.5) + subscreenTitle = utility.get_object_from_names(titleObject, error_message=f"{expectedScreenTitle} object is missing") + if subscreenTitle is not None: + test.compare(subscreenTitle.text, expectedScreenTitle, "{} should be displayed when user is navigated to this screen".format(expectedScreenTitle)) + test.endSection() + +def test_enable_root_ssh_screen(): + test.startSection(f"Navigating {config.SERVICES_ENABLE_ROOT_SSH_TITLE} screen") + navigate_to_subscreen(config.SERVICE_SCREEN_SUBSCREEN_INDEX["ENABLE_ROOT_SUBSCREEN"], config.SERVICES_ENABLE_ROOT_SSH_TITLE, names.o_SettingsBase_Enable_Root_SSH_Text) + + enable_root_ssh_options=[{"option_label": "Enable SSH Login", "option_switch": names.o_SettingsBase_settingsRootSSHAccess_SSHDSwitch_Switch}, + {"option_label": "Enable Root Login", "option_switch": names.o_SettingsBase_settingsRootSSHAccess_RootSwitch_Switch}] + + #traverse the options available to enable/disable on the "enable root ssh" screen + for index in range(0,len(enable_root_ssh_options), 1): + option_text = enable_root_ssh_options[index]["option_label"] + names.o_SettingsBase_Enable_Root_SSH_Screen_Text["text"] = option_text + try: + # option label text object + option_label_text_object = waitForObject(names.o_SettingsBase_Enable_Root_SSH_Screen_Text) + test.compare(option_label_text_object.text, option_text, f"{option_text} text") + utils.waitForGUI(0.5) + + try: + option_switch_object = waitForObject(enable_root_ssh_options[index]["option_switch"]) + test.compare(option_switch_object.checked, False, f"{option_text} switch value should be False") + utils.waitForGUI(0.5) + mouseClick(option_switch_object) + utils.waitForGUI(0.5) + test.compare(option_switch_object.checked, True, f"{option_text} switch value should be True") + except LookupError: + test.fail(f"FAIL : Switch object for \"{option_text}\" not found") + + except LookupError: + test.fail(f"FAIL : Object for \"{option_text}\" not found") + + # done, go back to main screen + back_button_obj = utility.get_object_from_names(names.o_service_back_btn, error_message = "enable root ssh screen back button object missing") + if back_button_obj is not None: + mouseClick(back_button_obj) + utils.waitForGUI(0.5) + test.endSection() + + +## ================================================================================= +## Helper functions for the Factory reset and decommissioning sub screens: +## ================================================================================= +def check_factory_reset_confirm_button_state(expected_enable_state): + try: + test.compare(waitForObjectExists(names.o_services_factory_reset_confirm_button).enabled, expected_enable_state, f"Check that the confirm button state is {expected_enable_state}") + utils.waitForGUI(0.5) + except LookupError: + test.fail("ERROR : Confirm button object missing") + +def check_factory_reset_back_button_state(expected_enable_state): + try: + test.compare(waitForObjectExists(names.o_services_factory_reset_back_button).enabled, expected_enable_state, f"Check that the enable button state is {expected_enable_state}") + utils.waitForGUI(0.5) + except LookupError: + test.fail("ERROR : back button object missing") + +def check_decommission_confirm_button_state(expected_enable_state): + try: + test.compare(waitForObjectExists(names.o_service_decommission_confirm_button).enabled, expected_enable_state, f"Check that the confirm button state is {expected_enable_state}") + utils.waitForGUI(0.5) + except LookupError: + test.fail("ERROR : Confirm button object missing") + +def check_decommission_back_button_state(expected_enable_state): + try: + test.compare(waitForObjectExists(names.o_service_decommission_back_button).enabled, expected_enable_state, f"Check that the enable button state is {expected_enable_state}") + utils.waitForGUI(0.5) + except LookupError: + test.fail("ERROR : back button object missing") + +def check_decommission_back_button_state(expected_enable_state): + try: + test.compare(waitForObjectExists(names.o_service_decommission_back_button).enabled, expected_enable_state, f"Check that the enable button state is {expected_enable_state}") + utils.waitForGUI(0.5) + except LookupError: + test.fail("ERROR : back button object missing") + +def click_on_factory_reset_confirm_button(): + try: + mouseClick(waitForObject(names.o_services_factory_reset_confirm_button)) + utils.waitForGUI(0.5) + except LookupError: + test.fail("ERROR : Confirm button object missing") + +def click_on_decommission_confirm_button(): + try: + mouseClick(waitForObject(names.o_service_decommission_confirm_button)) + utils.waitForGUI(0.5) + except LookupError: + test.fail("ERROR : Confirm button object missing") + +def test_user_confirmation_screen(expected_title, expected_message, + is_test_click_confirm = False, is_test_click_cancel = False): + # expecting a pop-up user confirmation dialog + confirmation_dialog = utility.get_object_from_names(names.o_modalDialog, error_message = "Confirmation dialog object not found") + if confirmation_dialog is not None: + test.compare(confirmation_dialog.visible, True, "Check if user confirmation dialog is visible") + + # check dialog title + names.o_service_subscreen_titleText["text"] = expected_title + confirmation_title = utility.get_object_from_names(names.o_service_subscreen_titleText, error_message = "Confirmation dialog title object not found") + if confirmation_title is not None: + test.compare(confirmation_title.text, expected_title, "Checking the confirm dialog message string") + + # check dialog message + confirmation_message = utility.get_object_from_names(names.o_service_confirmation_are_you_sure_TitleText, error_message = "Confirmation dialog message object not found") + if confirmation_message is not None: + test.compare(confirmation_message.text, expected_message, "Checking the confirm dialog message string") + + + ## Do check on the confirmation dialog action buttons + # Cancel Button + confirmation_cancel_button = utility.get_object_from_names(names.o_cancelTouch_TouchRect, error_message = "Cancel button object not found") + if confirmation_cancel_button is not None: + test.compare(confirmation_cancel_button.enabled, config.ENABLED, "Checking that the cancel button is enabled") + + if is_test_click_cancel and confirmation_cancel_button.enabled: + mouseClick(confirmation_cancel_button) + utils.waitForGUI(0.5) + + #Confirm Button : + if is_test_click_cancel is not True: + confirmation_confirm_button = utility.get_object_from_names(names.o_confirmTouch_TouchRect, error_message = "Confirm button object not found") + if confirmation_confirm_button is not None: + test.compare(confirmation_confirm_button.enabled, config.ENABLED, "Checking that the confirm button is enabled") + + if is_test_click_confirm and confirmation_confirm_button.enabled: + mouseClick(confirmation_confirm_button) + utils.waitForGUI(0.5) + + # clicking any button will trigger the dialog to be invisible, check + if is_test_click_cancel or is_test_click_confirm: + test.compare(confirmation_dialog.visible, False, "Checking dialog is not visible since testing button clicked") + else: + test.compare(confirmation_dialog.visible, True, "Checking dialog is visible since not testing for button clicked") + + utils.waitForGUI(1) + else: + test.log("NOTE: Confirmation Dialog body tests not run since dialog object not found") + +## ================================================================================= + +def test_factory_reset_screen(): + test.startSection("Navigating to 'Factory Reset' screen") + navigate_to_subscreen(config.SERVICE_SCREEN_SUBSCREEN_INDEX["FACTORY_RESET_SUBSCREEN"], config.SERVICES_FACTORY_RESET_TITLE, names.o_userConfirmation_Factory_Reset_Text) + + # test buttons enable-state + check_factory_reset_confirm_button_state(config.ENABLED) + check_factory_reset_back_button_state(config.ENABLED) + + # Checking the user confirmation dialog behavior for when clicking cancel button + click_on_factory_reset_confirm_button() + utils.waitForGUI(0.5) + test_user_confirmation_screen(expected_title=config.SERVICES_FACTORY_RESET_TITLE, + expected_message=config.SERVICES_FACTORY_RESET_CONFIRM_MSG, + is_test_click_cancel = True) + + # Checking the user confirmation dialog behavior for when clicking cancel button + + # TODO need to uncomment when scripting handling is added + + # click_on_factory_reset_confirm_button() + # test_user_confirmation_screen(expected_title = config.SERVICES_FACTORY_RESET_TITLE, + # expected_message = config.SERVICES_FACTORY_RESET_CONFIRM_MSG, + # is_test_click_confirm = True) + + # when reset is happening, the buttons should be both disabled + # check_factory_reset_confirm_button_state(config.DISABLED) + # check_factory_reset_back_button_state(config.DISABLED) + + # TODO check for completion or failure state + + # Done, navigate back to main screen + back_button_obj = utility.get_object_from_names(names.o_services_factory_reset_back_button, error_message = "Factory reset screen back button object missing") + if back_button_obj is not None: + mouseClick(back_button_obj) + utils.waitForGUI(0.5) + + test.endSection() + +def test_decommissioning_screen(): + test.startSection("Navigating to 'decommissioning' screen") + navigate_to_subscreen(config.SERVICE_SCREEN_SUBSCREEN_INDEX["DECOMMISSION_SUBSCREEN"], config.SERVICES_DECOMMISSION_TITLE, names.userConfirmation_Decommissioning_Text) + + # test buttons enable-state + check_decommission_confirm_button_state(config.ENABLED) + check_decommission_back_button_state(config.ENABLED) + + # Checking the user confirmation dialog behavior for when clicking cancel button + click_on_decommission_confirm_button() + utils.waitForGUI(0.5) + test_user_confirmation_screen(expected_title=config.SERVICES_DECOMMISSION_TITLE, + expected_message=config.SERVICES_DECOMMISSION_CONFIRM_MSG, + is_test_click_cancel = True) + + # Checking the user confirmation dialog behavior for when clicking cancel button + # TODO need to uncomment when scripting handling is added + # click_on_confirm_button() + # test_user_confirmation_screen(expected_title = config.SERVICES_FACTORY_RESET_TITLE, + # expected_message = config.SERVICES_FACTORY_RESET_CONFIRM_MSG, + # is_test_click_confirm = True) + + # when reset is happening, the buttons should be both disabled + # check_factory_reset_confirm_button_state(config.DISABLED) + # check_factory_reset_back_button_state(config.DISABLED) + + # TODO check for completion or failure state + + # Done, navigate back to main screen + back_button_obj = utility.get_object_from_names(names.o_service_decommission_back_button, error_message = "Decommission screen back button object missing") + if back_button_obj is not None: + mouseClick(back_button_obj) + utils.waitForGUI(0.5) + + test.endSection() + +def main(): + utils.tstStart(__file__) + test.log("TODO test case incomplete, need script call handling in the APP to complete", "Need to add an option to the application to allow mocked-script calls") + application_init.setup_post_log_successful_start() + + startApplication(config.AUT_NAME+ " -l") + + navigate_to_service_menu() + + # test the subscreens + test_enable_root_ssh_screen() + test_factory_reset_screen() + test_decommissioning_screen() + + utils.tstDone() + \ No newline at end of file Index: tst_service_screen/test.py =================================================================== diff -u -rf24d9f0bfc30fa024ceef73cb8b25efb86a70f70 -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 --- tst_service_screen/test.py (.../test.py) (revision f24d9f0bfc30fa024ceef73cb8b25efb86a70f70) +++ tst_service_screen/test.py (.../test.py) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -17,6 +17,7 @@ from dialin.ui.hd_simulator import HDSimulator from dialin.common.hd_defs import HDOpModes, HDStandbyStates from dialin.ui import utils +from configuration import utility hd_simulator = HDSimulator() @@ -192,6 +193,7 @@ def verify_export_logs_screen(): """ Method to verify the export logs screen + Note overall export log functionality is tested in tst_service_export_logs """ test.startSection("Verifying the the export logs screen") test.log("Navigating to service screen to export log screen") @@ -245,19 +247,44 @@ test.log("verification of progress bar color after exporting data") test.compare(waitForObjectExists(names.o_SettingsBase_progressCircle_ProgressCircle).color.name, config.RED_COLOR,"{} color progress bar is displayed for sd-card".format(config.RED_COLOR)) test.compare(waitForObjectExists(names.o_SettingsBase_progressCircle_ProgressCircle_2).color.name, config.RED_COLOR,"{} color progress bar is displayed for usb-drive".format(config.RED_COLOR)) - + + mouseClick(waitForObjectExists(names.o_SettingsBase_backbutton_service_information_mouseArea_MouseArea_2)) test.endSection() + +def verify_water_input_subscreen(): + expected_screen_title = "Water Input Mode" + test.startSection("Navigating 'Set Date And Time' screen") + service_subScreen_menu_element = utility.get_object_from_names(names.o_SettingsHome_touchItem_TouchRect_2, error_message="subscreen menu element not found") + if service_subScreen_menu_element is not None: + mouseClick(service_subScreen_menu_element) + utils.waitForGUI(0.5) + subscreenTitle = utility.get_object_from_names(names.o_SettingsBase_Water_Input_Mode_Text, error_message=f"{expected_screen_title} object is missing") + if subscreenTitle is not None: + test.compare(subscreenTitle.text, expected_screen_title, "{} should be displayed when user is navigated to this screen".format(expected_screen_title)) + + pure_water_mode_switch = utility.get_object_from_names(names.o_SettingsBase_settingsRoInputSwitch_Switch, error_message = "RO Switch object not found") + if pure_water_mode_switch is not None: + test.compare(pure_water_mode_switch.checked, False, "Pure water mode switch value should be False") + utils.waitForGUI(0.5) + mouseClick(pure_water_mode_switch) + utils.waitForGUI(0.5) + test.compare(pure_water_mode_switch.checked, True, "Pure water mode switch value should be True") + + # done, go back to main screen + back_button_obj = utility.get_object_from_names(names.o_SettingsBase_backbutton_service_information_mouseArea_MouseArea_2, error_message = "Water input screen back button object missing") + if back_button_obj is not None: + mouseClick(back_button_obj) + utils.waitForGUI(0.5) + test.endSection() + def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME+ " -l") navigate_to_settings_screen() verify_settings_parameters() - - # To avoid issues with the mouse cick due to the alarm dialog - Remove if the alarm dialog no longer shown on app start - mouseClick(waitForObject(names.o_minimize_button)) - + verify_parameters_under_information() verify_volume_and_brightness_section() verify_wifi_setting() @@ -266,7 +293,10 @@ verify_dg_cleaning_setting() verify_export_logs_screen() verify_export_functionality() + verify_water_input_subscreen() + #Note the protected service menu items (factory reset, decommission, etc) are in tst_service_menu + utils.tstDone() Index: tst_ui_logs/test.py =================================================================== diff -u -r7ec619e4740a21f0e6dee6421f59638baaba4c6c -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 --- tst_ui_logs/test.py (.../test.py) (revision 7ec619e4740a21f0e6dee6421f59638baaba4c6c) +++ tst_ui_logs/test.py (.../test.py) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -103,8 +103,9 @@ #0x0900 hd_simulator.cmd_set_pressure_occlusion_data(arterial_prs = 54.5, venous_prs = 20.1, blood_pump_occlusion = 100, pressure_state = 10, art_min_limit = 200, art_max_limit = 340, - ven_min_limit = 20, ven_max_limit = 50, filtered_arterial_prs = 30.4, - filtered_venous_prs = 21.4) + ven_min_limit = 20, ven_max_limit = 50 + # , filtered_arterial_prs = 30.4, filtered_venous_prs = 21.4 + ) verify_log(msg_id = MsgIds.MSG_ID_PRESSURE_OCCLUSION_DATA.value, msg = "Occlusion", param = [54.5,20.1,100,10,200,340,20,50,30.4,21.4]) #0x0B00