Index: shared/scripts/configuration/config.py =================================================================== diff -u -rab639c7acff8c8444f869f2ac898a1cd241efa87 -r3037246670bc9f00dff0acc09f82b5aca6cd2bb8 --- shared/scripts/configuration/config.py (.../config.py) (revision ab639c7acff8c8444f869f2ac898a1cd241efa87) +++ shared/scripts/configuration/config.py (.../config.py) (revision 3037246670bc9f00dff0acc09f82b5aca6cd2bb8) @@ -19,13 +19,9 @@ AUT_NAME = "denaliSquish" COMMON_PATH = os.environ['HOME']+"/Projects" +SERVICE_CONF_LOCATION = os.environ['HOME']+"/Projects/application/resources/settings/Service.conf" -COLOR_CODES = {"Aqua": "#81ffff", "Blue": "#017dea", "Blue 2": "#1090d5", "Green": "#29fd2d", "Grey": "#d3d3d3", - "Lavender": "#db98f5", "Light Blue": "#acd7f1", "Light Teal": "#29f1da","Lime": "#b7fc36", - "Magenta":"#fd28fd", "Orange": "#f2721c", "Peach":"#f1979a", "Red": "#c53b33", "Rose":"#fc178d", - "Slate blue":"#7f7ffa", "Violet": "#6435c9", "White": "#ffffff", "Yellow": "#fcfc4d"} - #standby mode GOODMORNING_START_TIME_SEC = 0 GOODEVENING_START_TIME_SEC = 43200 @@ -34,12 +30,14 @@ DISABLED = False OUT_OF_RANGE_COLOR = "#c53b33" +RED_COLOR = "#ff0000" +GREEN_COLOR = "#008000" IN_RANGE_COLOR = "#fcfcfc" -SERVICE_CONF_LOCATION = os.environ['HOME']+"/Projects/application/resources/settings/Service.conf" VALID = True INVALID = False +NOT_VISIBLE = False +VISIBLE = True -USB_SLIDER_1 = 4.350 Index: shared/scripts/configuration/strings.py =================================================================== diff -u -r3cfcbf4c6dc09214cdbde312a5e5c7a90970e975 -r3037246670bc9f00dff0acc09f82b5aca6cd2bb8 --- shared/scripts/configuration/strings.py (.../strings.py) (revision 3cfcbf4c6dc09214cdbde312a5e5c7a90970e975) +++ shared/scripts/configuration/strings.py (.../strings.py) (revision 3037246670bc9f00dff0acc09f82b5aca6cd2bb8) @@ -13,6 +13,8 @@ # @date (last) 18-Jan-2022 # ############################################################################ + + BLOOD_PRIMING_UNIT = "mL" BLOOD_PRIMING_VALUE_0 = "0" BLOOD_PRIMING_DEFAULT_VALUE = BLOOD_PRIMING_VALUE_0 + " " + BLOOD_PRIMING_UNIT @@ -30,13 +32,20 @@ SettingsHome_Treatment_Text = "Treatment" SettingsHome_Manager_Text = "Manager" SettingsHome_Settings_Text = "Settings" +SERVICE_SCREEN_TITLE_TEXT = "Service" +SERVICE_SCREEN_PARAMETER = ["Information", "Volume And Brightness", "Wi-Fi", "Bluetooth Cuff", "Dialysate Generator Settings", "Services"] -#Information +#Information INFORMATION_TITLES = ["Information", "Versions"] INFORMATION_PARAMETERS = ["Information", "UI Version", "HD Version", "HD FPGA Version", "HD Serial Number", "DG Version", "DG FPGA Version", "DG Serial Number"] SERIVCES_TITLE = "Service" SERVICES_PARAMETERS = ["HD Last Service Date", "HD Next Service Date", "DG Last Service Date", "DG Next Service Date"] -#services + +#service +BACK_TEXT = "BACK" CONFIRM_TEXT = "CONFIRM" +SHUTDOWN_TEXT = "SHUTDOWN" + + Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rab639c7acff8c8444f869f2ac898a1cd241efa87 -r3037246670bc9f00dff0acc09f82b5aca6cd2bb8 --- shared/scripts/configuration/utility.py (.../utility.py) (revision ab639c7acff8c8444f869f2ac898a1cd241efa87) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 3037246670bc9f00dff0acc09f82b5aca6cd2bb8) @@ -178,12 +178,10 @@ @return latest_file - (string) returns latest file that append on log folder from sd-data """ -# try: current_date = get_current_date_and_time(date_format = "%Y_%m_%d") latest_file = '/home/denali/Desktop/sd-card/log/'+current_date+'_denaliSquish.log' return latest_file -# except: -# return False + def get_message_from_log(file_name, message_text): Index: shared/scripts/names.py =================================================================== diff -u -rab639c7acff8c8444f869f2ac898a1cd241efa87 -r3037246670bc9f00dff0acc09f82b5aca6cd2bb8 --- shared/scripts/names.py (.../names.py) (revision ab639c7acff8c8444f869f2ac898a1cd241efa87) +++ shared/scripts/names.py (.../names.py) (revision 3037246670bc9f00dff0acc09f82b5aca6cd2bb8) @@ -48,54 +48,19 @@ o_cumulative_fluid_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Cumulative Delivered", "type": "Text", "unnamed": 1, "visible": True} + #settings_Home -o_settings_Text = {"container": o_Gui_MainView, "text": "Settings", "type": "Text", "unnamed": 1, "visible": True} -o_SettingsHome_SettingsHome = {"container": o_Gui_MainView, "objectName": "_SettingsHome", "type": "SettingsHome", "visible": True} -o_settings_home_text_obj = {"container": o_SettingsHome_SettingsHome, "type": "Text", "unnamed": 1, "visible": True} +o_service_text = {"container": o_Gui_MainView, "text": "Service", "type": "Text", "unnamed": 1, "visible": True} +o_SettingsHome_SettingsHome_2 = {"container": o_Gui_MainView, "objectName": "_SettingsHome", "type": "SettingsHome", "visible": True} +o_service_home_text_obj = {"container": o_SettingsHome_SettingsHome_2, "type": "Text", "unnamed": 1, "visible": True} +o_set_date_and_time_text = {"container": o_Gui_MainView, "text": "Set Date And Time", "type": "Text", "unnamed": 1, "visible": True} +o_SettingsHome_SettingsHome = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsDateTime", "visible": True} +o_set_date_and_time_text_obj = {"container": o_SettingsHome_SettingsHome, "type": "Text", "unnamed": 1, "visible": True} +o_back_btn = {"container": o_SettingsHome_SettingsHome, "id": "_image", "source": "qrc:/images/iBack", "type": "Image", "unnamed": 1, "visible": True} o_eject_btn = {"container": o_SettingsHome_SettingsHome, "id": "_image", "source": "qrc:/images/iEject", "type": "Image", "unnamed": 1, "visible": True} o_arrow_btn = {"container": o_SettingsHome_SettingsHome, "id": "_image", "source": "qrc:/images/iArrowRight", "type": "Image", "unnamed": 1, "visible": True} -#shutdown -o_shutdown_btn= {"container": o_Gui_MainView, "type": "Text", "unnamed": 1, "visible": True} - o_SettingsBase_SettingsBase = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase", "visible": True} -o_services_screen_text_obj = {"container": o_SettingsBase_SettingsBase, "type": "Text", "unnamed": 1, "visible": True} -o_back_btn = {"container": o_Gui_MainView, "type": "Text", "unnamed": 1, "visible": True} -o_export_logs_text = {"container": o_SettingsBase_SettingsBase, "text": "Export Logs", "type": "Text", "unnamed": 1, "visible": True} -o_combo_box_base_object={"container": o_SettingsBase_SettingsBase, "id": "_logTypeRow", "type": "Row", "unnamed": 1, "visible": True} - -o_combo_box= {"container": o_SettingsBase_SettingsBase, "id": "_logTypeCombo", "type": "ComboBox", "unnamed": 1, "visible": True} - -o_option_combo_box={"container": o_Overlay, "type": "Text", "unnamed": 1, "visible": True} - - - -#o_option_combo_box={"checkable": False, "container": o_Overlay, "id": "_logTypeDelegate", "type": "ItemDelegate", "unnamed": 1, "visible": True} -#o_service_combo_box={"checkable": False, "container": o_Overlay, "id": "_logTypeDelegate", "text":"Service", "type": "ItemDelegate", "unnamed": 1, "visible": True} - -o_combo_box_text={"container": o_SettingsBase_SettingsBase, "echoMode": 0, "type": "TextField", "unnamed": 1, "visible": True} - -#slider -o_sd_folder_slider = {"container": o_SettingsBase_SettingsBase, "id": "_sdcFolderView", "type": "ListView", "unnamed": 1, "visible": True} -o_usb_folder_slider={"container": o_SettingsBase_SettingsBase, "id": "_usbFolderView", "type": "ListView", "unnamed": 1, "visible": True} -o_slider_text = {"container": o_SettingsBase_SettingsBase, "text": "4.350", "type": "Text", "unnamed": 1, "visible": True} - -#SD Card Information -o_sd_card_text = {"container": o_SettingsBase_SettingsBase, "text": "SD-Card (MB)\nFree : 0.000\nTotal: 0.000", "type": "Label", "unnamed": 1, "visible": True} -o_sd_card_btn= {"container": o_SettingsBase_SettingsBase, "text": "SD", "type": "Label", "unnamed": 1, "visible": True} - -#Export button -o_export_btns = {"container": o_SettingsBase_SettingsBase,"id": "_logTypeExportButton", "type": "ExportButton", "unnamed": 1, "visible": True} -o_export_btn = {"container": o_export_btns, "text": "Export", "type": "Text", "unnamed": 1, "visible": True} - -#USB drive Information -# o_usb_text = {"container": o_SettingsBase_SettingsBase, "text": "USB Drive (MB)\nFree : 0.000\nTotal: 0.000", "type": "Label", "unnamed": 1, "visible": True} -# o_usb_before_click= {"container": o_SettingsBase_SettingsBase, "text": 0, "type": "Label", "unnamed": 1, "visible": True} -# o_usb_after_click={"container": o_SettingsBase_SettingsBase, "text": "USB", "type": "Label", "unnamed": 1, "visible": True} - -o_usb_folder_list= {"container": o_SettingsBase_SettingsBase, "id": "_usbFolderView", "type": "ListView", "unnamed": 1, "visible": True} -o_usb_folder_file= {"container": o_SettingsBase_SettingsBase, "type": "Text", "unnamed": 1, "visible": True} -o_usb_folder_id= {"container": o_SettingsBase_SettingsBase, "type": "Text", "unnamed": 1, "visible": True} -#object on keyboard to switch to keypad +o_settings_base_text_obj = {"container": o_SettingsBase_SettingsBase, "type": "Text", "unnamed": 1, "visible": True} o_switch_keyboard_to_keypad = {"container": o_Gui_MainView, "text": "&123", "type": "Text", "unnamed": 1, "visible": True} o_keyboard_object = {"container": o_Gui_MainView, "type": "Text", "unnamed": 1, "visible": True} o_SettingsBase_SettingsDateTime = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsDateTime", "visible": True} @@ -108,12 +73,28 @@ o_shutdown_text = {"container": o_Gui_MainView, "text": "SHUTDOWN", "type": "Text", "unnamed": 1, "visible": True} #alarm minimize button o_minimize_button = {"container": o_Overlay, "id": "_image", "source": "qrc:/images/iChevronDown", "type": "Image", "unnamed": 1, "visible": True} -o_logTypeDelegate_ItemDelegate = {"checkable": False, "container": o_Overlay, "occurrence": 1, "type": "ItemDelegate", "unnamed": 1, "visible": True} -o_checkable_false_container_container_o_Gui_MainView_type_Overlay_unnamed_1_visible_true_id_logTypeDelegate_occurrence_3_type_ItemDelegate_unnamed_1_visible_true_Text_1 = "{checkable='false' container={container=':o_Gui_MainView' type='Overlay' unnamed='1' visible='true'} id='_logTypeDelegate' occurrence='3' type='ItemDelegate' unnamed='1' visible='true'}.Text_1" +o_SettingsHome_SettingsHome = {"container": o_Gui_MainView, "objectName": "_SettingsHome", "type": "SettingsHome", "visible": True} +o_settings_home_text_obj = {"container": o_SettingsHome_SettingsHome, "type": "Text", "unnamed": 1, "visible": True} +# service screen +o_SettingsBase_SettingsBase = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase", "visible": True} +o_services_screen_text_obj = {"container": o_SettingsBase_SettingsBase, "type": "Text", "unnamed": 1, "visible": True} +o_export_logs_text = {"container": o_SettingsBase_SettingsBase, "text": "Export Logs", "type": "Text", "unnamed": 1, "visible": True} +o_combo_box= {"container": o_SettingsBase_SettingsBase, "id": "_logTypeCombo", "type": "ComboBox", "unnamed": 1, "visible": True} +o_option_combo_box={"container": o_Overlay, "type": "Text", "unnamed": 1, "visible": True} +# #Export button +o_export_btns = {"container": o_SettingsBase_SettingsBase,"id": "_logTypeExportButton", "type": "ExportButton", "unnamed": 1, "visible": True} +o_export_btn = {"container": o_export_btns, "text": "Export", "type": "Text", "unnamed": 1, "visible": True} +#USB drive Information +o_usb_folder_file = {"container": o_SettingsBase_SettingsBase, "type": "Text", "unnamed": 1, "visible": True} +o_usb_folder_id = {"container": o_SettingsBase_SettingsBase, "type": "Text", "unnamed": 1, "visible": True} +o_usb_folder_slider = {"container": o_SettingsBase_SettingsBase, "id": "_usbFolderView", "type": "ListView", "unnamed": 1, "visible": True} +#device log objects +o_SettingsBase_progressCircle_ProgressCircle = {"container": o_SettingsBase_SettingsBase, "id": "_progressCircle", "type": "ProgressCircle", "unnamed": 1, "visible": True} +o_SettingsBase_usbFolderRectangle_Rectangle = {"container": o_SettingsBase_SettingsBase, "gradient": 0, "id": "_usbFolderRectangle", "type": "Rectangle", "unnamed": 1, "visible": True} +o_SettingsBase_progressCircle_ProgressCircle_2 = {"container": o_SettingsBase_SettingsBase, "id": "_progressCircle", "occurrence": 2, "type": "ProgressCircle", "unnamed": 1, "visible": True} +o_SettingsBase_image_Image = {"container": o_SettingsBase_SettingsBase, "id": "_image", "source": "qrc:/images/iEject", "type": "Image", "unnamed": 1, "visible": True} - - Index: tst_service_screen/test.py =================================================================== diff -u -rab639c7acff8c8444f869f2ac898a1cd241efa87 -r3037246670bc9f00dff0acc09f82b5aca6cd2bb8 --- tst_service_screen/test.py (.../test.py) (revision ab639c7acff8c8444f869f2ac898a1cd241efa87) +++ tst_service_screen/test.py (.../test.py) (revision 3037246670bc9f00dff0acc09f82b5aca6cd2bb8) @@ -11,18 +11,15 @@ # author Papiya Mandal # author Amrita Debnath -import builtins import names -from configuration import config, utility -from configuration.config import SERVICE_CONF_LOCATION +from configuration import config from dialin.ui.hd_simulator import HDSimulator from dialin.common.hd_defs import HDOpModes, HDOpSubModes from dialin.ui import utils -from builtins import str -from cgitb import text + EXPORT_LOGS = "Export Logs" SERVICE_SCREEN_OPTIONS = ["Information", "Volume And Brightness", "Wi-Fi", "Bluetooth Cuff", "DG Cleaning", "Service", "Export Logs"] @@ -32,30 +29,21 @@ def custom_object_for_export_log(text): """ - Method to set object property based on 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 settings_text_obj(text): + """ + Method to set custom object property for settings screen. + @param text : (string) parameter text + """ names.o_settings_home_text_obj["text"] = text return names.o_settings_home_text_obj -def services_screen_text_obj(text): - names.o_services_screen_text_obj["text"] = text - return names.o_services_screen_text_obj -def export_log_text(text): - names.o_usb_folder_file["text"]= text - return names.o_usb_folder_file - test.log(text) - -def export_log_id(id): - names.o_usb_folder_id["text"] = id - return names.o_usb_folder_id - test.log(id) - def navigate_to_settings_screen(): """ Method to navigate to "Settings" screen @@ -67,6 +55,7 @@ test.compare(device_settings_text.text, config.SERIVCES_TITLE, "{} screen is displayed".format(config.SERIVCES_TITLE)) test.endSection() + def verify_export_logs_screen(): """ Method to verify the export logs screen @@ -86,60 +75,81 @@ mouseClick(export_option) test.compare(config.EXPORT_LOGS_OPTIONS[option], waitForObjectExists(names.o_combo_box ).displayText, "User should able to select {}".format(config.EXPORT_LOGS_OPTIONS[option])) utils.waitForGUI(1) - test.log("verifying slider in export logs") - mouseClick(waitForObjectExists(names.o_usb_folder_slider)) -# parameter_object = export_log_id(text = config.USB_SLIDER_1) -# utility.scroll_to_zone(names.o_usb_folder_slider, direction = "Top") - parameter_object = export_log_id(id = config.USB_SLIDER_1) - utility.scroll_to_zone(parameter_object, names.o_slider_text) - + + test.endSection() + + +def get_storage_data_status(): + """ + Method to verify the storage data exported or not exported. + @return: (bool) - True - if export data list is present in dash board, else return False + """ + test.log("verification of storage data before exporting the data") + export_list_count = 0 + export_list = object.children(waitForObjectExists(names.o_usb_folder_slider))[0] + for child in object.children(export_list): + export_list_count += 1 + if export_list_count >= 1: + return True + else: + return False + + def verify_export_functionality(): """ - verify log before clicking export button and after clicking export button + verify export log section before and after export button click. """ - test.startSection("Verifying the the export button clicking") + test.startSection("Verifying the the export button functionality") + test.log("verification of progress bar color before 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.GREEN_COLOR,"{} color progress bar is displayed for usb-drive".format(config.GREEN_COLOR)) + + log_status = get_storage_data_status() + test.verify(log_status == True, "export data rectangles should be filled with contents.") + mouseClick(waitForObjectExists(names.o_export_btn )) - utils.waitForGUI(1) - test.compare(waitForObjectExists(names.o_export_btn).text, config.EXPORT_BUTTON_TEXT,"{} screen is displayed".format(config.EXPORT_BUTTON_TEXT)) - test.endSection() + utils.waitForGUI(2) + log_status = get_storage_data_status() + test.verify(log_status == False, "export data rectangles should be empty after export button click.") + + 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.GREEN_COLOR,"{} color progress bar is displayed for usb-drive".format(config.GREEN_COLOR)) + mouseClick(waitForObjectExists(names.o_SettingsBase_image_Image )) + test.compare(waitForObjectExists(names.o_export_btn).text, config.EXPORT_BUTTON_TEXT,"{} screen is displayed".format(config.EXPORT_BUTTON_TEXT)) + 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)) + test.endSection() + + def verify_device_shutdown(): """ verify shutdown button after clicking export button """ - mouseClick(waitForObjectExists(names.o_shutdown_btn)) - test.compare(waitForObjectExists(names.o_shutdown_btn).text, config.SHUTDOWN_BUTTON_TEXT, "User should able to click {}".format(config.SHUTDOWN_BUTTON_TEXT)) - test.endSection() - -# for logs in config.EXPORT_LOGS_OPTIONS: -# logs_export = waitForObjectExists(services_screen_text_obj(logs)) -# test.compare(logs_export.text, logs, "{} should be available under export logs screen".format(logs)) -# -# mouseClick(waitForObjectExists(names.o_back_btn)) -# test.compare(services_screen_text_obj.text, config.BACK_BUTTON_TEXT, "{} screen is displayed".format(config.BACK_BUTTON_TEXT)) -# mouseClick(waitForObjectExists(settings_text_obj(EXPORT_LOGS))) -# combobox_dropdown = waitForObjectExists(names.o_combo_box ) -# for option in range(3): -# mouseClick(waitForObjectExists(names.o_combo_box )) -# test.compare(combobox_dropdown.text.option[0], config.EXPORT_LOGS_OPTIONS[0], "{} combo box is displayed".format(config.EXPORT_LOGS_OPTIONS[0])) -# mouseClick(waitForObjectExists(names.o_combo_box )) -# test.compare(waitForObjectExists(names.o_combo_box).text, config.EXPORT_LOGS_OPTIONS, "{} combo box is displayed".format(config.EXPORT_LOGS_OPTIONS)) -# - - + test.startSection("verification of system shutdown option") + mouseClick(waitForObjectExists(names.o_keyboard_object)) + test.compare(waitForObjectExists(names.o_keyboard_object).text, config.SHUTDOWN_BUTTON_TEXT, "User should able to click {}".format(config.SHUTDOWN_BUTTON_TEXT)) + utils.waitForGUI(1.5) + mouseClick(waitForObjectExists(names.o_keyboard_object)) + test.endSection() + def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) navigate_to_settings_screen() + verify_export_logs_screen() verify_export_functionality() verify_device_shutdown() utils.tstDone() + + Index: tst_settings_date_and_time/test.py =================================================================== diff -u -re91712057f27742e36df123ac4519564c4e35399 -r3037246670bc9f00dff0acc09f82b5aca6cd2bb8 --- tst_settings_date_and_time/test.py (.../test.py) (revision e91712057f27742e36df123ac4519564c4e35399) +++ tst_settings_date_and_time/test.py (.../test.py) (revision 3037246670bc9f00dff0acc09f82b5aca6cd2bb8) @@ -16,14 +16,12 @@ from configuration import config, utility from dialin.ui.hd_simulator import HDSimulator -from dialin.common.hd_defs import HDOpModes +from dialin.common.hd_defs import HDOpModes, HDOpSubModes from dialin.ui import utils -from configuration.config import SERVICE_CONF_LOCATION from calendar import isleap hd_simulator = HDSimulator() -SERVICES_TITLE_TEXT = "Please Enter The Service Password" SET_DATE_AND_TIME_TEXT = "Set Date And Time" TIME_TITLE = "Time (HH:MM)" DATE_TITLE_TEXT = "Date (MM/DD/YYYY)" @@ -42,80 +40,61 @@ MONTH_LOWER_LIMIT = 1 YEAR_UPPER_LIMIT = 2100 YEAR_LOWER_LIMIT = 1970 +CONFIRMATION_MESSAGE = "Setting date and time ..." HD_DATE_AND_TIME_MESSAGE = "AdjustHDDateTime" DG_DATE_AND_TIME_MESSAGE = "AdjustDGDateTime" -INCORRECT_PASSWORD = "abcd" -INCORRECT_PASSWORD_MSG = "Incorrect service password" -SERVICE_SCREEN_OPTIONS = ["Information", "Volume And Brightness", "Wi-Fi", "Bluetooth Cuff", "Dialysate Generator Settings", "Set Date And Time", "Set Language", "Software Update", "Factory Reset", "Calibration ", ] +SERVICE_SCREEN_OPTIONS = ["Information", "Volume And Brightness", "Wi-Fi", "Bluetooth Cuff", "DG Cleaning", "Set Date And Time", "Export Logs" ] EMPTY_INPUT_FIELD = "" +def service_text_obj(text): + names.o_service_home_text_obj["text"] = text + return names.o_service_home_text_obj + def settings_text_obj(text): - names.o_settings_home_text_obj["text"] = text - return names.o_settings_home_text_obj + names.o_set_date_and_time_text_obj["text"] = text + return names.o_set_date_and_time_text_obj -def services_screen_text_obj(text): - names.o_services_screen_text_obj["text"] = text - return names.o_services_screen_text_obj - def date_time_screen_text_obj(text): names.o_settings_date_and_time_text["text"] = text return names.o_settings_date_and_time_text -def navigate_to_settings_screen(): +def navigate_to_service_screen(): """ - Method to navigate to "Settings" screen + Method to navigate to "Service" screen """ - test.startSection("Navigating to 'Device Settings' screen") - hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_STAN.value, sub_mode=HDOpModes.MODE_FAUL.value) - utils.waitForGUI(1) - mouseClick(waitForObjectExists(names.o_settings_Text)) - device_settings_text = waitForObjectExists(settings_text_obj(config.DEVICE_SETTINGS_TEXT)) - test.compare(device_settings_text.text, config.DEVICE_SETTINGS_TEXT, "{} screen is displayed".format(config.DEVICE_SETTINGS_TEXT)) + test.startSection("Navigating to 'Service' screen") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_SERV.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) + utils.waitForGUI(0.5) + service_screen_text = waitForObjectExists(service_text_obj(config.SERVICE_SCREEN_TITLE_TEXT)) + 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_services_password_screen_and_enter_password(): - """ - Method to navigate to services screen - and verify the "Please Enter The Service Password" - title is displayed and enter password, verify the - password and click on confirm button - """ - test.startSection("Navigating to 'services password' screen and enter password") - mouseClick(waitForObjectExists(settings_text_obj(config.SERIVCES_TITLE))) - services_password_title = waitForObjectExists(services_screen_text_obj(SERVICES_TITLE_TEXT)) - test.compare(services_password_title.text, SERVICES_TITLE_TEXT, "{} should display once user is navigated to services password screen".format(SERVICES_TITLE_TEXT)) - utils.waitForGUI(0.5) - mouseClick(waitForObjectExists(names.o_switch_keyboard_to_keypad)) - mouseClick(waitForObjectExists(names.o_password_text_field)) - with open(SERVICE_CONF_LOCATION, "r") as file: - lines = file.readlines() - for index, line in enumerate(lines): - if "Service Password" in line: - services_password = lines[index+1][:-1] - break - else: - continue - utility.enter_keyboard_numeric_value(entry=str(services_password)) - mouseClick(waitForObjectExists(names.o_show_password)) - test.log("Verifying the entered password") - password = str((waitForObjectExists(names.o_password_text_field)).text) - test.compare(password, str(services_password), "Entered password should be {}".format(str(services_password))) - mouseClick(waitForObjectExists(services_screen_text_obj(config.CONFIRM_TEXT))) - test.endSection() - def navigate_to_set_date_and_time(): """ Method to navigate to set date and time screen and verify its title 'Set Date And Time' """ test.startSection("Navigating 'Set Date And Time' screen") utils.waitForGUI(0.5) - mouseClick(waitForObjectExists(settings_text_obj(SET_DATE_AND_TIME_TEXT))) - set_date_and_time_title = waitForObjectExists(date_time_screen_text_obj(SET_DATE_AND_TIME_TEXT)) + mouseClick(waitForObjectExists(names.o_set_date_and_time_text)) + set_date_and_time_title = waitForObjectExists(settings_text_obj(SET_DATE_AND_TIME_TEXT)) test.compare(set_date_and_time_title.text, SET_DATE_AND_TIME_TEXT, "{} should be displayed when user is navigated to 'Set Date And Time' screen".format(SET_DATE_AND_TIME_TEXT)) test.endSection() +def verify_back_btn(): + """ + Method to verify the back button and click + """ + test.startSection("Verify the 'BACK' button") + test.compare(str(waitForObjectExists(settings_text_obj(config.BACK_TEXT)).text), config.BACK_TEXT,"'BACK' button text should be {}".format(config.BACK_TEXT)) + utils.waitForGUI(0.1) + test.compare(waitForObjectExists(settings_text_obj(config.BACK_TEXT)).enabled , True, "'BACK' button should be enabled") + mouseClick(waitForObjectExists(names.o_back_btn)) + utils.waitForGUI(0.5) + mouseClick(waitForObjectExists(names.o_set_date_and_time_text)) + test.endSection() + def verify_entered_date_and_time(hour, min, day, month, year, valid_parameter_passed): """ Method to enter date and time and verify the @@ -256,23 +235,28 @@ button and click on confirm button @param valid_paramter_passed - (bool) True/False whether hour/minute/day/month/year is valid """ + test.startSection("Verify the status of confirm button and click on confirm button") if valid_parameter_passed is config.VALID: if object.exists(date_time_screen_text_obj(text=config.CONFIRM_TEXT)): confirm_btn = waitForObjectExists(date_time_screen_text_obj(text=config.CONFIRM_TEXT)) test.compare(confirm_btn.enabled, config.ENABLED, "Confirm Button should be enabled") mouseClick(confirm_btn) + confirm_msg = waitForObjectExists(settings_text_obj(CONFIRMATION_MESSAGE)) + test.compare(confirm_msg.visible, config.VISIBLE, "{} message should be displayed".format(CONFIRMATION_MESSAGE)) else: if not(object.exists(date_time_screen_text_obj(text=config.CONFIRM_TEXT))): test.passes("Confirm button is not available") + test.endSection() + def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) - navigate_to_settings_screen() - navigate_to_services_password_screen_and_enter_password() + navigate_to_service_screen() navigate_to_set_date_and_time() + verify_back_btn() verify_entered_date_and_time(hour="24", min="33", day="1", month="3", year="2022", valid_parameter_passed=config.INVALID) verify_entered_date_and_time(hour="00", min="60", day="29", month="2", year="2020", valid_parameter_passed=config.INVALID) verify_entered_date_and_time(hour="13", min="33", day="32", month="2", year="2022", valid_parameter_passed=config.INVALID) @@ -284,4 +268,4 @@ utility.get_current_log_details(message_text=DG_DATE_AND_TIME_MESSAGE) utils.tstDone() - + \ No newline at end of file