Index: tst_settings_date_and_time/test.py =================================================================== diff -u -r98de6e3aae57ae6e06b6624fab7e183103149f33 -rcc8afc4a6f8cafd58fe7b902d8bfb6b1f1040225 --- tst_settings_date_and_time/test.py (.../test.py) (revision 98de6e3aae57ae6e06b6624fab7e183103149f33) +++ tst_settings_date_and_time/test.py (.../test.py) (revision cc8afc4a6f8cafd58fe7b902d8bfb6b1f1040225) @@ -40,6 +40,7 @@ MONTH_LOWER_LIMIT = 1 YEAR_UPPER_LIMIT = 2100 YEAR_LOWER_LIMIT = 1970 +DATE_AND_TIME_MESSAGE = "AdjustHDDateTime" def settings_text_obj(text): names.o_settings_home_text_obj["text"] = text @@ -94,6 +95,15 @@ 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.3) + mouseClick(waitForObjectExists(settings_text_obj(config.EXPORT_TEXT))) + 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") test.endSection() def navigate_to_set_date_and_time(): @@ -108,30 +118,40 @@ 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_entered_date_and_time(hour, min, day, month, year): +def verify_entered_date_and_time(hour, min, day, month, year, valid_parameter_passed): """ Method to enter date and time and verify the - valid and invalid entries and click on confirm - button + valid and invalid entries + @param hour - (str) Hour + @param min - (str) Minute + @param day - (str) Day + @param month - (str) Month + @param year - (str) Year + @param valid_paramter_passed - (bool) True/False whether hour/minute/day/month/year is valid """ + test.startSection("Enter date and time and verify the valid and invalid entries") date_time_column = waitForObjectExists(names.o_date_time_container) date_time_column_children = object.children(date_time_column) - time_row = date_time_column_children[0] - date_row = date_time_column_children[1] + ITEM_0_TIME_ROW = 0 + ITEM_1_DATE_ROW = 1 + TITLE_OBJECT_ITEM_NUMBER_0 = 0 + time_row = date_time_column_children[ITEM_0_TIME_ROW] + date_row = date_time_column_children[ITEM_1_DATE_ROW] time_row_children = object.children(time_row) date_row_children = object.children(date_row) - time_title_text = time_row_children[0] - date_title_text = date_row_children[0] + time_title_text = time_row_children[TITLE_OBJECT_ITEM_NUMBER_0] + date_title_text = date_row_children[TITLE_OBJECT_ITEM_NUMBER_0] test.log("Verifying time title text") test.compare(time_title_text.text, TIME_TITLE, "{} shoule be the time title text".format(TIME_TITLE)) test.log("Verifying date title text") test.compare(date_title_text.text, DATE_TITLE_TEXT, "{} should be the date title text".format(DATE_TITLE_TEXT)) hour_parent = time_row_children[1] hour_parent_children = object.children(hour_parent) - hour_input_field = hour_parent_children[1] + INPUT_FIELD_INDEX = 1 + hour_input_field = hour_parent_children[INPUT_FIELD_INDEX] minute_parent = time_row_children[-1] minute_parent_children = object.children(minute_parent) - minute_input_field = minute_parent_children[1] + minute_input_field = minute_parent_children[ INPUT_FIELD_INDEX] test.log("Entering hour") utils.waitForGUI(0.5) mouseClick(hour_input_field) @@ -145,15 +165,18 @@ utility.enter_keypad_value(min) test.compare(minute_input_field.text, min, "Minute value should be {}".format(min)) verify_color_of_entry(entry=min, date_time_parameter=MINUTE_TEXT, input_field=minute_input_field) - month_parent = date_row_children[1] + MONTH_PARENT_INDEX = 1 + DAY_PARENT_INDEX = 3 + YEAR_PARENT_INDEX = -1 + month_parent = date_row_children[MONTH_PARENT_INDEX] month_children = object.children(month_parent) - month_input_field = month_children[1] - day_parent = date_row_children[3] + month_input_field = month_children[INPUT_FIELD_INDEX] + day_parent = date_row_children[DAY_PARENT_INDEX] day_children = object.children(day_parent) - day_input_field = day_children[1] - year_parent = date_row_children[-1] + day_input_field = day_children[INPUT_FIELD_INDEX] + year_parent = date_row_children[YEAR_PARENT_INDEX] year_children = object.children(year_parent) - year_input_field = year_children[1] + year_input_field = year_children[INPUT_FIELD_INDEX] test.log("Entering Month") mouseClick(month_input_field) utility.erase_entered_value(month_input_field) @@ -172,8 +195,9 @@ utility.enter_keypad_value(year) test.compare(year_input_field.text, year, "Year value should be {}".format(year)) verify_color_of_entry(entry=year, date_time_parameter=YEAR_TEXT, input_field=year_input_field) + verify_confirm_btn(valid_parameter_passed) + test.endSection() - def verify_color_of_entry(entry, date_time_parameter, input_field): """ Method to verify the color of entry @@ -231,22 +255,14 @@ navigate_to_settings_screen() navigate_to_services_password_screen_and_enter_password() navigate_to_set_date_and_time() - verify_entered_date_and_time(hour="12", min="33", day="1", month="3", year="2022") - verify_confirm_btn(config.VALID) - verify_entered_date_and_time(hour="24", min="33", day="1", month="3", year="2022") - verify_confirm_btn(config.INVALID) - verify_entered_date_and_time(hour="00", min="60", day="1", month="3", year="2022") - verify_confirm_btn(config.INVALID) - verify_entered_date_and_time(hour="13", min="33", day="32", month="3", year="2022") - verify_confirm_btn(config.INVALID) - verify_entered_date_and_time(hour="13", min="33", day="4", month="13", year="2022") - verify_confirm_btn(config.INVALID) - verify_entered_date_and_time(hour="22", min="33", day="22", month="12", year="2101") - verify_confirm_btn(config.INVALID) - verify_entered_date_and_time(hour="22", min="33", day="22", month="12", year="1969") - verify_confirm_btn(config.INVALID) - verify_entered_date_and_time(hour="23", min="12", day="7", month="8", year="1977") - verify_confirm_btn(config.VALID) + 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="1", month="3", year="2022", valid_parameter_passed=config.INVALID) + verify_entered_date_and_time(hour="13", min="33", day="32", month="3", year="2022", valid_parameter_passed=config.INVALID) + verify_entered_date_and_time(hour="13", min="33", day="4", month="13", year="2022", valid_parameter_passed=config.INVALID) + verify_entered_date_and_time(hour="22", min="33", day="22", month="12", year="2101", valid_parameter_passed=config.INVALID) + verify_entered_date_and_time(hour="22", min="33", day="22", month="12", year="1969", valid_parameter_passed=config.INVALID) + verify_entered_date_and_time(hour="23", min="12", day="7", month="8", year="1977", valid_parameter_passed=config.VALID) + utility.get_current_log_details(message_text=DATE_AND_TIME_MESSAGE) + utils.tstDone() - - +