Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r5265f8b3b6c85e406b011b9fc9fe71be73d83d8a --- shared/scripts/configuration/utility.py (.../utility.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 5265f8b3b6c85e406b011b9fc9fe71be73d83d8a) @@ -14,11 +14,14 @@ import sys +import time import test import squish from configuration import config from builtins import int as pyInt +from dialin.ui.hd_simulator import HDSimulator +hd_simulator = HDSimulator() def start_application(app_name): """ @@ -108,3 +111,20 @@ raise LookupError("zone object is not in view to the user after " + \ "trying 100 times") + + +def navigate_to_pretreatment_screen(mode): + """ + Method to navigate to sub mode under pre-treatment screen + @param mode - (int) pre treatment state + """ + hd_simulator.cmd_set_hd_operation_mode_data(5,0) + hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=mode, water_sample_state=0, + consumables_self_test_state=0, no_cartridge_self_test_state=0, + installation_state=0, dry_self_test_state=0, prime_state=0, + recirculate_state=0, patient_connection_state=0) + + +def convert_seconds_into_min_and_sec(seconds): + min_and_sec = time.strftime("%M:%S", time.gmtime(seconds)) + return min_and_sec \ No newline at end of file Index: shared/scripts/names.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r5265f8b3b6c85e406b011b9fc9fe71be73d83d8a --- shared/scripts/names.py (.../names.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/names.py (.../names.py) (revision 5265f8b3b6c85e406b011b9fc9fe71be73d83d8a) @@ -48,6 +48,10 @@ o_cumulative_fluid_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Cumulative Delivered", "type": "Text", "unnamed": 1, "visible": True} - - - +#pre-treatment priming +o_PreTreatmentBase_TreatmentFlowBase = {"container": ":o_PreTreatmentStack_PreTreatmentPrimeStack_PreTreatmentPrimeStack", "objectName": "_PreTreatmentBase", "type": "TreatmentFlowBase", "visible": True} +o_PreTreatmentStack_PreTreatmentStack = {"container": o_Gui_MainView, "objectName": "_PreTreatmentStack", "type": "PreTreatmentStack", "visible": True} +o_PreTreatmentStack_PreTreatmentPrimeStack_PreTreatmentPrimeStack = {"container": o_PreTreatmentStack_PreTreatmentStack, "objectName": "_PreTreatmentPrimeStack", "type": "PreTreatmentPrimeStack", "visible": True} +o_PreTreatmentPrimeStack_PreTreatmentBase_TreatmentFlowBase = {"container": o_PreTreatmentStack_PreTreatmentPrimeStack_PreTreatmentPrimeStack, "objectName": "_PreTreatmentBase", "type": "TreatmentFlowBase", "visible": True} +o_begin_prime_text = {"container": o_PreTreatmentPrimeStack_PreTreatmentBase_TreatmentFlowBase, "text": "Begin Prime", "type": "Text", "unnamed": 1, "visible": True} +o_self_test_dry_progress = {"container": o_PreTreatmentPrimeStack_PreTreatmentBase_TreatmentFlowBase, "objectName": "_TimeCircle", "type": "TimeCircle", "visible": True} \ No newline at end of file Index: suite.conf =================================================================== diff -u -r8df6f936193bbd9127d3ec940562e62db0060bcb -r5265f8b3b6c85e406b011b9fc9fe71be73d83d8a --- suite.conf (.../suite.conf) (revision 8df6f936193bbd9127d3ec940562e62db0060bcb) +++ suite.conf (.../suite.conf) (revision 5265f8b3b6c85e406b011b9fc9fe71be73d83d8a) @@ -1,6 +1,6 @@ AUT=denaliSquish LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_environment tst_post tst_standbymode tst_In_treatment +TEST_CASES=tst_environment tst_post tst_standbymode tst_In_treatment tst_pre_treatment_priming VERSION=3 WRAPPERS=Qt Index: tst_pre_treatment_priming/test.py =================================================================== diff -u --- tst_pre_treatment_priming/test.py (revision 0) +++ tst_pre_treatment_priming/test.py (revision 5265f8b3b6c85e406b011b9fc9fe71be73d83d8a) @@ -0,0 +1,84 @@ +# -*- 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" +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 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() + + snooze(20) +# hd_simulator.cmd_send_pre_treatment_disposables_prime_progress_data(self, timeout: int, countdown: int)