Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r73d2a9643bcdd4a91e0befd00f45802c6fee77a5 -rc5d3c9cf7ca5e576425f3babefc803a50fd33cf4 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 73d2a9643bcdd4a91e0befd00f45802c6fee77a5) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision c5d3c9cf7ca5e576425f3babefc803a50fd33cf4) @@ -14,10 +14,10 @@ import object import names -import test +import sys import squish -import test import time +import test from builtins import int as pyInt from configuration import config @@ -26,6 +26,7 @@ from dialin.common.hd_defs import HDOpModes from dialin.ui.hd_simulator import HDSimulator + hd_simulator = HDSimulator() @@ -516,16 +517,32 @@ names.o_self_test_dry_check_list_text["text"] = text return names.o_self_test_dry_check_list_text +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(HDOpModes.MODE_PRET.value,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 def get_time(screen_title): """ - Method to return the current count down - in the application - @param screen_title - (str) current title of the screen + Method to return the current count down + in the application + @param screen_title - (str) current title of the screen + @return time_text - (str) count down in the application """ if screen_title == config.BEGIN_PRIME_TITLE or screen_title == config.PRIMING_TITLE: parent_object = object.parent(squish.waitForObjectExists(self_test_dry_check_list_text(screen_title))) - elif screen_title == SYSTEM_SELF_TEST_TITLE: + elif screen_title == config.SYSTEM_SELF_TEST_TITLE: parent_object = object.parent(squish.waitForObjectExists(names.o_system_self_test)) else: parent_object = object.parent(squish.waitForObjectExists(names.o_PreTreatmentBase_Filter_Flush_Text)) @@ -565,8 +582,8 @@ def verify_the_progress(count_down, screen_title): """ Method to verify the current progress - @param count_down - (int) current count down time - @param screen_title - (str) current title of the screen + @param count_down - (int) current count down time, + @param screen_title - (str) current title of the screen """ test.startSection("Verifying the current progress") if screen_title == config.BEGIN_PRIME_TITLE or screen_title == config.PRIMING_TITLE: @@ -584,7 +601,7 @@ """ Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] @param pre_treatment_step : indicates the Current pre-treatment step - """ + """ test.startSection("verification of page step indicators") for page in range(len(config.PRE_TREATMENT_SCREENS)): bullet_children = object.children(squish.waitForObjectExists(get_bullet_object(screen_obj, page))) @@ -616,13 +633,27 @@ test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) test.compare(bullet_border_color,config.INCOMPLETE_COLOR, " the bullet border color must be " + str(config.INCOMPLETE_COLOR)) test.endSection() - + +def verify_missing_object(object_to_check): + """ + Method to verify the given object is invisible or is not present on the screen + @param object_to_check: the object whose invisibility must be verified + """ + try: + squish.testSettings.objectNotFoundDebugging = False + squish.waitForObject(object_to_check,3000) + test.fail("Given object should not be present initially") + except LookupError as _: + test.passes("object is not present as expected") + + squish.testSettings.objectNotFoundDebugging = True + def get_text_object(screen_obj, txt): + """ + Method to return the text object + @param screen_obj: the screen object ,txt: text of the object + @param return the text object """ - To obtain a text object based on text provided - @param screen_obj: provides the container on which the txt must be present - @returns a real name object - """ names.o_text_object["container"] = screen_obj names.o_text_object["text"] = txt return names.o_text_object @@ -650,3 +681,13 @@ indicator_parent = children_obj[2] indicators = object.children(indicator_parent) return indicators + +def get_bullet_object(screen_obj, num): + """ + Method to return the bullet object + @param screen_obj: the screen object ,num: the number of bullet occurrence + @param return the bullet object + """ + names.o_bullet_object["container"] = screen_obj + names.o_bullet_object["occurrence"] = num + 1 + return names.o_bullet_object