# -*- coding: utf-8 -*- ## # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_standbymode # author Joseph Varghese # # NOTE: # This test contradicts verification of standby mode screen import names import datetime import test from dialin.ui import utils from configuration import config from dialin.ui.hd_simulator import HDSimulator from builtins import int as pyInt from dialin.common.hd_defs import HDOpModes def get_current_time(): """ Tests to get current time. @return: current time in seconds """ now = datetime.datetime.now() current_time = now.strftime("%H:%M:%S") hours, minutes, seconds = current_time.split(':') time_in_seconds = datetime.timedelta(hours = pyInt(hours), minutes = pyInt(minutes), seconds = pyInt(seconds)) total_seconds = time_in_seconds.total_seconds() return total_seconds def verify_create_treatment_text(): """ Tests for verification of create treatment text. @return: N/A """ standby_text = waitForObject(names.o_standby_page) CREATE_TREATMENT_RECTANGLE_INDEX_VALUE = 1 create_treatment = object.children(standby_text)[CREATE_TREATMENT_RECTANGLE_INDEX_VALUE] CREATE_TREATMENT_TEXT_INDEX_VALUE = 1 child = object.children(create_treatment)[CREATE_TREATMENT_TEXT_INDEX_VALUE] test.compare(child.text, "CREATE TREATMENT") def verify_welcome_text_on_standby_mode(current_time): """ Tests to verify welcome text based on current time. @return: current time in seconds """ standby_text = waitForObject(names.o_standby_page) STANDBY_TEXT_INDEX_VALUE = 0 child = object.children(standby_text)[STANDBY_TEXT_INDEX_VALUE] if current_time >= config.GOODMORNING_START_TIME_SEC and \ current_time <= config.GOODEVENING_START_TIME_SEC: test.compare(child.text, "Good Morning") else: test.compare(child.text, "Good Evening") def main(): utils.tstStart("demo") startApplication("denaliSquish") hd = HDSimulator() hd.cmd_send_power_on_self_test_version_request() hd.cmd_send_hd_operation_mode(HDOpModes.MODE_STAN.value) current_time = get_current_time() verify_welcome_text_on_standby_mode(current_time) utils.waitForGUI(0.5) verify_create_treatment_text() utils.tstDone()