Index: tst_service_screen/test.py =================================================================== diff -u -r3840a7480f702f48ccfab1d624c3700527ec1ab2 -r76fdc8bb69841df3df89e211fabb333aa6d48dc0 --- tst_service_screen/test.py (.../test.py) (revision 3840a7480f702f48ccfab1d624c3700527ec1ab2) +++ tst_service_screen/test.py (.../test.py) (revision 76fdc8bb69841df3df89e211fabb333aa6d48dc0) @@ -11,114 +11,145 @@ # 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 +from dialin.common.hd_defs import HDOpModes, HDOpSubModes from dialin.ui import utils -SERVICES_TITLE_TEXT = "Please Enter The Service Password" -SET_DATE_AND_TIME_TEXT = "Set Date And Time" -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 ", ] + +EXPORT_LOGS = "Export Logs" + +SERVICE_SCREEN_OPTIONS = ["Information", "Volume And Brightness", "Wi-Fi", "Bluetooth Cuff", "DG Cleaning", "Service", "Export Logs"] + 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 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 navigate_to_settings_screen(): """ Method to navigate to "Settings" 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) + 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(1) + device_settings_text = waitForObjectExists(settings_text_obj(config.SERIVCES_TITLE)) + 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 + """ + test.startSection("Verifying the the export logs screen") + test.log("Navigating to service screen to export log screen") + mouseClick(waitForObjectExists(settings_text_obj(EXPORT_LOGS))) + test.compare(waitForObjectExists(names.o_export_logs_text).text,config.EXPORT_LOGS,"{} should be under export logs screen ".format(config.EXPORT_LOGS)) + + for option in range(len(config.EXPORT_LOGS_OPTIONS)): + + utils.waitForGUI(1) + mouseClick(waitForObjectExists(names.o_combo_box )) + export_option = waitForObjectExists(custom_object_for_export_log(config.EXPORT_LOGS_OPTIONS[option])) + + utils.waitForGUI(1) + 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) - 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.endSection() -def verify_incorrect_password_msg(): + +def get_storage_data_status(): """ - Method to verify the message displayed - upon entering wrong password + 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.startSection("Verifying the functionalities with Incorrect password") - test.log("Clicking on password entry field") - utils.waitForGUI(0.3) - mouseClick(waitForObjectExists(names.o_password_text_field)) - utility.enter_keyboard_numeric_value(entry=str(INCORRECT_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, INCORRECT_PASSWORD, "Entered password should be {}".format(str(INCORRECT_PASSWORD))) - mouseClick(waitForObjectExists(services_screen_text_obj(config.CONFIRM_TEXT))) - incorrect_password_text = waitForObjectExists(settings_text_obj(INCORRECT_PASSWORD_MSG)) - test.compare(incorrect_password_text.text, INCORRECT_PASSWORD_MSG, "{} message should display upon entering wrong password".format(INCORRECT_PASSWORD_MSG)) - test.endSection() + 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 navigate_to_services_password_screen_and_enter_password(): + +def verify_export_functionality(): """ - 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 + verify export log section before and after export button click. """ - 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) - verify_incorrect_password_msg() - utils.waitForGUI(0.5) - mouseClick(waitForObjectExists(settings_text_obj(config.SERIVCES_TITLE))) - utils.waitForGUI(0.5) - test.log("Clicking on password entry field") - 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))) - utils.waitForGUI(0.5) - test.log("Verifying the 'Export' button") - test.compare(str(waitForObjectExists(settings_text_obj(config.EXPORT_TEXT)).text), config.EXPORT_TEXT,"'Export' button text should be {}".format(config.EXPORT_TEXT)) - utils.waitForGUI(0.1) - test.compare(waitForObjectExists(settings_text_obj(config.EXPORT_TEXT)).enabled , True, "'Export' button should be enabled") - test.log("Verifying the 'Shutdown' button enabled") - test.compare(str(waitForObjectExists(names.o_shutdown_text).text), config.SHUTDOWN_TEXT,"'SHUTDOWN' button text should be {}".format(config.SHUTDOWN_TEXT)) - test.compare(waitForObjectExists(names.o_shutdown_text).enabled , True, "'SHUTDOWN' button should be enabled") - for option in SERVICE_SCREEN_OPTIONS: - option_text = waitForObjectExists(settings_text_obj(option)) - test.compare(option_text.text, option, "{} should be available under services screen".format(option)) - test.endSection() + 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(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 + """ + 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() - navigate_to_services_password_screen_and_enter_password() + + verify_export_logs_screen() + verify_export_functionality() + verify_device_shutdown() + utils.tstDone() + +