# -*- 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 # date 2022/04/01 # author Joseph varghese # author Amol Shinde # author Bhavana Savanth # NOTE: # This test contradicts verification of standbymode. import names import datetime import test from dialin.ui import utils from configuration import config,utility from dialin.ui.hd_simulator import HDSimulator from dialin.common.hd_defs import HDOpModes hd_simulator = HDSimulator() MORNING_MIN = "00" MORNING_MAX = "12" def get_current_time(): """ Tests to get current time. @return: current time in seconds """ current_time = utility.get_current_date_and_time("%H") return current_time def verify_create_treatment_text(): """ Tests for verification of create treatment text. @return: N/A """ standby_text = waitForObject(names.o_standby_page) create_treatment = object.children(standby_text)[1] child = object.children(create_treatment)[1] 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) child = object.children(standby_text)[0] print(str(current_time)) if current_time >= MORNING_MIN and current_time < MORNING_MAX: test.compare(child.text, "Good Morning") else: test.compare(child.text, "Good Evening") def event_analysis_for_create_treatment_button(): """ Tests to verify binaries for create treatment button upon click """ mouseClick(waitForObject(names.o_MainHome_Create_Treatment_Button)) message = utility.cmd_set_create_treatment_click_event(response = True) event_binary = utility.ui_all_publication_handler(message) test.compare(config.CREATE_TREATMENT_BUTTON_ACTIVE, str(event_binary), "binaries obtained during event-> create treatment button click should be expected") def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) hd_simulator.cmd_send_power_on_self_test_version_request() hd_simulator.cmd_send_hd_operation_mode(HDOpModes.MODE_STAN.value) event_analysis_for_create_treatment_button() current_time = get_current_time() verify_welcome_text_on_standby_mode(current_time) verify_create_treatment_text() utils.tstDone()