Index: tst_settings_information/test.py =================================================================== diff -u -r2dcf9ca847eefd278ba8e883b521324d553947fa -rad324b2834285a29c4458b100317f76eaf64fc6a --- tst_settings_information/test.py (.../test.py) (revision 2dcf9ca847eefd278ba8e883b521324d553947fa) +++ tst_settings_information/test.py (.../test.py) (revision ad324b2834285a29c4458b100317f76eaf64fc6a) @@ -11,68 +11,114 @@ # author Papiya Mandal # author Akshay Dhawan - import names -import datetime -import test -from dialin.ui import utils -from configuration import config,utility + +from configuration import config, utility from dialin.ui.hd_simulator import HDSimulator from dialin.common.hd_defs import HDOpModes +from dialin.ui import utils hd_simulator = HDSimulator() + +def settings_text_obj(text): + names.o_settings_home_text_obj["text"] = text + return names.o_settings_home_text_obj -def verify_settings_parameters(): +def settings_base_text_obj(text): + names.o_settings_base_text_obj["text"] = text + return names.o_settings_base_text_obj + +def verify_clear_alarm_condition_button(): + """ + Method to verify the 'Clear Alarm Condition' button + """ + test.startSection("Verifying Clear Alarm Condition button") + clear_condition_button = waitForObjectExists(settings_text_obj(config.CLEAR_ALARM_CONDITION_TEXT)) + test.compare(clear_condition_button.text, config.CLEAR_ALARM_CONDITION_TEXT, "Clear Alarm Condition button text should be {}".format(config.CLEAR_ALARM_CONDITION_TEXT)) + test.compare(clear_condition_button.enabled, config.ENABLED, "Clear Alarm Condition button should be enabled") + test.endSection() - test.compare(str(waitForObjectExists(names.o_SettingsHome_Clear_Alarm_Condition_Text).text), config.SettingsHome_Clear_Alarm_Condition_Text, "Text should be Clear Alarm Condition") - test.compare(waitForObject(names.o_SettingsHome_Clear_Alarm_Condition_Text).enabled, True, "Clear Alarm Condition button should be enabled") - test.compare(str(waitForObjectExists(names.o_SettingsHome_Export_Text).text), config.SettingsHome_Export_Text, "Text should be Export") - test.compare(waitForObject(names.o_SettingsHome_Export_Text).enabled, True, "Export button should be enabled") - test.compare(waitForObject(names.o_SettingsHome_image_Image_2).enabled, True, "UP button should be enabled") - mouseClick(waitForObjectExists(names.o_SettingsHome_image_Image_2)) - utils.waitForGUI(1) -# test.compare(waitForObject(names.o_SettingsHome_Export_Text).enabled, False, "Export button should be disabled") - test.compare(str(waitForObjectExists(names.o_SettingsHome_Device_Settings_Text).text), config.SettingsHome_Device_Settings_Text, "Text should be Device Settings") - test.compare(str(waitForObjectExists(names.o_SettingsHome_Information_Text).text), config.SettingsHome_Information_Text, "Text should be Information") - test.compare(str(waitForObjectExists(names.o_SettingsHome_Volume_And_Brightness_Text).text), config.SettingsHome_Volume_And_Brightness_Text, "Text should be Volume And Brightness") - test.compare(str(waitForObjectExists(names.o_SettingsHome_Wi_Fi_Text).text), config.SettingsHome_Wi_Fi_Text, "Text should be Wi-Fi") - test.compare(str(waitForObjectExists(names.o_SettingsHome_Bluetooth_Cuff_Text).text), config.SettingsHome_Bluetooth_Cuff_Text, "Text should be Bluetooth Cuff") - test.compare(str(waitForObjectExists(names.o_SettingsHome_Dialysate_Generator_Settings_Text).text), config.SettingsHome_Dialysate_Generator_Settings_Text, "Text should be Dialysate Generator Settings") - test.compare(str(waitForObjectExists(names.o_SettingsHome_Services_Text).text), config.SettingsHome_Services_Text, "Text should be Services") - test.compare(str(waitForObjectExists(names.o_treatment_Text).text), config.SettingsHome_Treatment_Text, "Text should be Treatment") - test.compare(str(waitForObjectExists(names.o_manager_Text).text), config.SettingsHome_Manager_Text, "Text should be Manager") - test.compare(str(waitForObjectExists(names.o_settings_Text).text), config.SettingsHome_Settings_Text, "Text should be Settings") +def verify_export_button(state): + """ + Method to verify the 'Export' button + """ + test.startSection("Verifying Export button") + export_btn = waitForObjectExists(settings_text_obj(config.EXPORT_TEXT)) + test.compare(export_btn.text, config.EXPORT_TEXT, "Export button text should be {}".format(config.EXPORT_TEXT)) + if state == config.ENABLED: + test.compare(export_btn.enabled, config.ENABLED, "Export button should be enabled") + else: + test.compare(export_btn.enabled, config.DISABLED, "Export button should be disabled") + test.endSection() -def verify_information(): +def verify_settings_parameters(): + """ + Method to verify the buttons + and parameters of 'Device Settings screen + """ + test.startSection("Verify the buttons and parameters of 'Device Settings' screen") - test.compare(str(waitForObjectExists(names.o_SettingsBase_Information_Text).text), config.SettingsBase_Information_Text, "Text should be Information") - test.compare(str(waitForObjectExists(names.o_SettingsBase_Versions_Text).text), config.SettingsBase_Versions_Text, "Text should be Versions") - test.compare(str(waitForObjectExists(names.o_SettingsBase_UI_Version_Text).text), config.SettingsBase_UI_Version_Text, "Text should be UI Version") - test.compare(str(waitForObjectExists(names.o_SettingsBase_HD_Version_Text).text), config.SettingsBase_HD_Version_Text, "Text should be HD Version") - test.compare(str(waitForObjectExists(names.o_SettingsBase_HD_FPGA_Version_Text).text), config.SettingsBase_HD_FPGA_Version_Text, "Text should be HD FPGA Version") - test.compare(str(waitForObjectExists(names.o_SettingsBase_HD_Serial_Number_Text).text), config.SettingsBase_HD_Serial_Number_Text, "Text should be HD Serial Number") - test.compare(str(waitForObjectExists(names.o_SettingsBase_DG_Version_Text).text), config.SettingsBase_DG_Version_Text, "Text should be DG Version") - test.compare(str(waitForObjectExists(names.o_SettingsBase_DG_FPGA_Version_Text).text), config.SettingsBase_DG_FPGA_Version_Text, "Text should be DG FPGA Version") - test.compare(str(waitForObjectExists(names.o_SettingsBase_DG_Serial_Number).text), config.SettingsBase_DG_Serial_Number, "Text should be DG Serial Number") - test.compare(str(waitForObjectExists(names.o_SettingsBase_Services_Text).text), config.SettingsBase_Services_Text, "Text should be Services") - test.compare(str(waitForObjectExists(names.o_SettingsBase_HD_Last_Service_Date_Text).text), config.SettingsBase_HD_Last_Service_Date_Text, "Text should be HD Last Service Date") - test.compare(str(waitForObjectExists(names.o_SettingsBase_HD_Next_Service_Date_Text).text), config.SettingsBase_HD_Next_Service_Date_Text, "Text should be HD Next Service Date") - test.compare(str(waitForObjectExists(names.o_SettingsBase_DG_Last_Service_Date_Text).text), config.SettingsBase_DG_Last_Service_Date_Text, "Text should be DG Last Service Date") - test.compare(str(waitForObjectExists(names.o_SettingsBase_DG_Next_Service_Date_Text).text), config.SettingsBase_DG_Next_Service_Date_Text, "Text should be DG Next Service Date") + verify_clear_alarm_condition_button() + mouseClick(waitForObjectExists(settings_text_obj(config.CLEAR_ALARM_CONDITION_TEXT))) + verify_export_button(config.ENABLED) + mouseClick(waitForObjectExists(settings_text_obj(config.EXPORT_TEXT))) + + eject_btn = waitForObject(names.o_eject_btn) + test.compare(eject_btn.enabled, config.ENABLED, "Eject button should be enabled") + mouseClick(eject_btn) + test.log("Verifying the state of 'Export' button after clicking on Eject button") + verify_export_button(config.DISABLED) + + for parameter in config.DEVICE_SETTINGS_SCREEN_PARAMETER: + parameter_text = waitForObjectExists(settings_text_obj(parameter)) + test.compare(parameter_text.text, parameter, "{} should be available under 'Device Settings' screen".format(parameter)) + test.endSection() +def verify_parameters_under_information(): + """ + Method to verify the parameter under 'Information'\ + and 'Services' + """ + test.startSection("Verify the parameter under 'Information' and 'Services'") + test.log("Navigating to 'Information' screen") + mouseClick(waitForObjectExists(names.o_arrow_btn)) + for title in config.INFORMATION_TITLES: + title_text = waitForObjectExists(settings_base_text_obj(title)) + test.compare(title_text.text, title, "{} should be available".format(title)) + + for info_parameter in config.INFORMATION_PARAMETERS: + info_parameter_text = waitForObjectExists(settings_base_text_obj(info_parameter)) + test.compare(info_parameter_text.text, info_parameter, "{} should be available under 'Information'".format(info_parameter)) + + test.log("Verifying 'Serivces title and") + services_text = waitForObjectExists(settings_base_text_obj(config.SERIVCES_TITLE)) + test.compare(services_text.text, config.SERIVCES_TITLE, "Services title should be {}".format(config.SERIVCES_TITLE)) + + for services_parameter in config.SERVICES_PARAMETERS: + services_par_text = waitForObjectExists(settings_base_text_obj(services_parameter)) + test.compare(services_par_text.text, services_parameter, "{} should be available under services".format(services_parameter)) + test.endSection() + +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) + 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 main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) - hd_simulator.cmd_send_hd_operation_mode(op_mode = 3, sub_mode = 0) - mouseClick(waitForObjectExists(names.o_settings_Text)) + + navigate_to_settings_screen() verify_settings_parameters() - mouseClick(waitForObjectExists(names.o_SettingsHome_image_Image)) #clicking on Information arrow mark - verify_information() + verify_parameters_under_information() utils.tstDone() - - - - \ No newline at end of file