# -*- coding: utf-8 -*-" import names from configuration.config import * from configuration.utility import * from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator hd_simulator = HDSimulator() BEGIN_PRIME_TITLE = "Begin Prime" PRIMING_TITLE = "Priming" MAXIMUM_COUNTDOWN_TIME = 300 MINIMUM_COUNTDOWN_TIME = 0 def navigate_self_test_dry_screen(): """ Method to navigate to self test dry screen and verify the 'Begin Prime' title is displayed """ test.startSection("Navigating to self test dry screen and verify the 'Begin Prime' title is displayed") navigate_to_pretreatment_screen(mode=5) title = (waitForObject(names.o_begin_prime_text)).text test.compare(title, BEGIN_PRIME_TITLE, "{} title should be displayed when user is navigating to self test dry screen".format(BEGIN_PRIME_TITLE)) test.endSection() def navigate_to_priming_screen(): """ Method to navigate to priming screen and verify the 'Priming' title is displayed """ test.startSection("Navigating to priming screen and verify the begin 'Priming' title is displayed") navigate_to_pretreatment_screen(mode=6) title = (waitForObject(names.o_begin_prime_text)).text test.compare(title, BEGIN_PRIME_TITLE, "{} title should be displayed when user is navigating to 'Priming' screen".format(BEGIN_PRIME_TITLE)) test.endSection() def get_time(): """ Method to return the current priming time in the application @return time_text - (str) current time in the application """ parent_object = object.parent(waitForObjectExists(names.o_begin_prime_text)) time_parent_children = object.children(parent_object) progress_circle_parent = time_parent_children[4] progress_circle_parent = object.children(progress_circle_parent) progress_circle_parent = progress_circle_parent[0] progress_circle_parent = object.children(progress_circle_parent) progress_circle_children = object.children(progress_circle_parent[0]) time_text = progress_circle_children[1] return time_text.time def verify_the_countdown_in_self_test_dry_screen(): """ Method to verify the count down time in application """ test.startSection("Verify the count down time in application") for count_down in range(MINIMUM_COUNTDOWN_TIME, MAXIMUM_COUNTDOWN_TIME+1): hd_simulator.cmd_send_pre_treatment_self_test_dry_progress_data(total=300, countdown=count_down) expected_time = convert_seconds_into_min_and_sec(count_down) actual_time = get_time() if count_down > MAXIMUM_COUNTDOWN_TIME or count_down < MINIMUM_COUNTDOWN_TIME: test.xcompare(actual_time, expected_time, "{} should not display on progress circle".format(expected_time)) else: test.compare(actual_time, expected_time, "Actual count down time: {} should be equal to expected count down time {}".format(actual_time, expected_time)) verify_the_progress(count_down) test.endSection() def verify_the_progress(count_down): """ Method to verify the current progress """ test.startSection("Verifying the current progress") current_progress = (waitForObjectExists(names.o_self_test_dry_progress)).progressValue #Since progress value is equal maximum count down value - current count down value expected_progress = MAXIMUM_COUNTDOWN_TIME - count_down test.compare(current_progress, expected_progress, "{} should be the current progress".format(expected_progress)) test.endSection() def main(): utils.tstStart(__file__) startApplication(AUT_NAME) navigate_self_test_dry_screen() verify_the_countdown_in_self_test_dry_screen() navigate_to_priming_screen() snooze(20) # hd_simulator.cmd_send_pre_treatment_disposables_prime_progress_data(self, timeout: int, countdown: int)