Index: tst_settings_date_and_time/test.py =================================================================== diff -u -r8a2443814a96ee0a320eebf6ce267673b16901c3 -r1620a2c311b44e84f3ddd30f315e77e51de6e5e6 --- tst_settings_date_and_time/test.py (.../test.py) (revision 8a2443814a96ee0a320eebf6ce267673b16901c3) +++ tst_settings_date_and_time/test.py (.../test.py) (revision 1620a2c311b44e84f3ddd30f315e77e51de6e5e6) @@ -13,12 +13,14 @@ import builtins import names +import calendar from configuration import config, utility from dialin.ui.hd_simulator import HDSimulator from dialin.common.hd_defs import HDOpModes from dialin.ui import utils from configuration.config import SERVICE_CONF_LOCATION, ENABLED +from calendar import isleap hd_simulator = HDSimulator() @@ -127,7 +129,7 @@ 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) + utils.waitForGUI(0.5) 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") @@ -261,6 +263,20 @@ test.xcompare(actual_value, EMPTY_INPUT_FIELD, "{} value {} should be equal to {}".format(date_time_parameter, actual_value, EMPTY_INPUT_FIELD)) test.compare(input_field_color,config.IN_RANGE_COLOR, "Day value {} is in range of {} and {}".format(entry, DAY_LOWER_LIMIT, DAY_UPPER_LIMIT)) elif date_time_parameter is MONTH_TEXT: + if(entry==1 or entry==3 or entry==5 or entry==7 or entry==8 or entry==10 or entry==12): + day_upper_limit = DAY_UPPER_LIMIT + test.log("Number of days is " + str(day_upper_limit)) + elif(entry==2): + day_upper_limit = DAY_UPPER_LIMIT - 3 + test.log("Number of days is " + str(day_upper_limit)) + elif(entry==2 and isleap(builtins.int(year))): + day_upper_limit = DAY_UPPER_LIMIT - 2 + test.log("Number of days is " + str(day_upper_limit)) + elif(entry==4 or entry==6 or entry==9 or entry==11): + day_upper_limit = DAY_UPPER_LIMIT - 1 + test.log("Number of days is " + str(day_upper_limit)) + else: + test.fail("Invalid Month") if (entry < MONTH_LOWER_LIMIT) or (entry > MONTH_UPPER_LIMIT): test.compare(actual_value, entry, "{} value {} should be equal to {}".format(date_time_parameter, actual_value, entry)) test.compare(input_field_color, config.OUT_OF_RANGE_COLOR, "Month value {} is out of range, Month value should be in range of {} and {}".format(entry, MONTH_LOWER_LIMIT, MONTH_UPPER_LIMIT)) @@ -273,7 +289,7 @@ test.compare(input_field_color, config.OUT_OF_RANGE_COLOR, "Year value {} is out of range, Year value should be in range of {} and {}".format(entry, YEAR_LOWER_LIMIT, YEAR_UPPER_LIMIT)) elif (entry >= YEAR_LOWER_LIMIT) and (entry <= YEAR_UPPER_LIMIT): test.xcompare(actual_value, EMPTY_INPUT_FIELD, "{} value {} should be equal to {}".format(date_time_parameter, actual_value, EMPTY_INPUT_FIELD)) - test.compare(input_field_color, config.IN_RANGE_COLOR, "Year value {} is in range of {} and {}".format(entry, YEAR_LOWER_LIMIT, YEAR_UPPER_LIMIT)) + test.compare(input_field_color, config.IN_RANGE_COLOR, "Year value {} is in range of {} and {}".format(entry, YEAR_LOWER_LIMIT, YEAR_UPPER_LIMIT)) test.endSection() def verify_confirm_btn(valid_parameter_passed): @@ -301,7 +317,7 @@ navigate_to_set_date_and_time() 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="32", month="2", 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)