Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r7fb24046293d1d1f1c4dba5f0b679e403ac096db -rbf0f91cc77deda73a01e96768c76160d71e46ddf --- shared/scripts/configuration/utility.py (.../utility.py) (revision 7fb24046293d1d1f1c4dba5f0b679e403ac096db) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision bf0f91cc77deda73a01e96768c76160d71e46ddf) @@ -15,70 +15,30 @@ import builtins import names import pytz +import squish import sys import test -import squish from configuration import config from dialin.ui import utils from builtins import int as pyInt from datetime import datetime -from pytz import timezone -from squish import * -def start_application(app_name): - """ - Function to start application and verify application status [running] - If application does not start or running status is false, test stops - Argument: - @param app_name : (str) - Name of the application - @param app_executable : (str) - Actual application - @return: handle for the application if the application is in running state, - or error (exist the application) - """ - counter = 0 - while True: - try: - counter += 1 - test.log("Starting {}".format(app_name)) - squish.startApplication(app_name) - if counter == 1: - test.log("Application launched at the "+str(counter)+" st try.") - elif counter == 2: - test.log("Application launched at the "+str(counter)+" nd try.") - elif counter == 3: - test.log("Application launched at the "+str(counter)+" rd try.") - else: - test.log("Application launched at the "+str(counter)+" th try.") - break - except RuntimeError: - if counter == 1: - test.log("Application failed to launch after "+str(counter)+" try - Please refer logs") - elif counter == 20: - test.log("Exiting after "+str(counter)+ " tries..") - sys.exit(1) - else: - test.log("Application failed to launch after "+str(counter)+ " tries - Please refer logs") - except: - logErrorDetails("Failed to start the application") - sys.exit(1) - - def check_if_object_is_within_the_container(obj=None, container=None): """ check if an object is inside a container - @param obj - child UI object - @param container - container UI object + @param obj - (obj) child UI object + @param container - (obj) container UI object @return boolean true/false """ container = squish.findObject(container) - containerPos = container.mapToGlobal(squish.QPoint(0, 0)) + containerPos = container.mapToGlobal(QPoint(0, 0)) container_x, container_y = pyInt(containerPos.x), pyInt(containerPos.y) container_width, container_height = pyInt(container.width), pyInt(container.height) obj = squish.findObject(obj) - objPos = obj.mapToGlobal(squish.QPoint(0, 0)) + objPos = obj.mapToGlobal(QPoint(0, 0)) obj_x, obj_y = pyInt(objPos.x), pyInt(objPos.y) obj_width, obj_height = pyInt(obj.width), pyInt(obj.height) @@ -111,7 +71,7 @@ screenHeight = pyInt(ScreenObj.height) screenWidth = pyInt(ScreenObj.width) squish.mouseWheel(ScreenObj, screenWidth-1000, - screenHeight-10, 0, -50, squish.Qt.NoModifier) + screenHeight-10, 0, -50, Qt.NoModifier) raise LookupError("zone object is not in view to the user after " + \ "trying 100 times") @@ -121,26 +81,22 @@ date_format='%Y/%b/%d - %H:%M' date = datetime.now() - - device_timezone=pytz.timezone('US/Pacific') - date = device_timezone.localize(date) date = date.astimezone(device_timezone) - return str(date.strftime(date_format)) def enter_keypad_value(entry): """ Method to enter user desired value using keypad - @param entry: User expected value + @param entry: (str) User expected value """ - test.startSection("Enter {entry}".format(entry=entry)) + test.startSection("Enter {}".format(entry)) for value in entry: value = builtins.int(value) - key_val = waitForObject(names.keypad_input(key_value=value)) + key_val = squish.waitForObject(names.keypad_input(key_value=value)) squish.mouseClick(key_val) utils.waitForGUI(1) test.endSection() @@ -149,18 +105,16 @@ def erase_entered_value(input_field): """ Method to erase the entered value - @param input_field - object of input field + @param input_field - (obj) object of input field """ test.startSection("Erasing value") - input_field= waitForObject(input_field) + input_field= squish.waitForObject(input_field) entered_value = input_field.text.toUtf8().constData() for value in entered_value: utils.waitForGUI(1) - squish.mouseClick(waitForObjectExists(names.o_back_space_key)) + squish.mouseClick(squish.waitForObjectExists(names.o_back_space_key)) test.compare(input_field.text.toUtf8().constData(), "", "Input field should be empty") test.endSection() - - - - + + \ No newline at end of file Index: tst_main_treatment_vitals/test.py =================================================================== diff -u -r62b41ac739f27813608a6b4eb0bdd9ee4331d64f -rbf0f91cc77deda73a01e96768c76160d71e46ddf --- tst_main_treatment_vitals/test.py (.../test.py) (revision 62b41ac739f27813608a6b4eb0bdd9ee4331d64f) +++ tst_main_treatment_vitals/test.py (.../test.py) (revision bf0f91cc77deda73a01e96768c76160d71e46ddf) @@ -143,7 +143,7 @@ input_field = waitForObject(input_field) entered_value = input_field.text.toUtf8().constData() test.compare(entered_value, value, - "Expected {} value: {} should be equal to Actual {} value: {}".format(vital, value, vital, entered_value)) + "Actual {} value: {} should be equal to Expected {} value: {}".format(vital, entered_value, vital, value)) test.endSection() @@ -294,15 +294,15 @@ rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, treatment_end_state=0, treatment_stop_state= 0) - utils.waitForGUI(delay_s=3) + utils.waitForGUI(1) open_vitals_pop_up() verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_120, dia_val=DIASTOLIC_PRESSSURE_80, heart_rate=HEART_RATE_VAL_101, save=True) - utils.waitForGUI(2) + utils.waitForGUI(1) open_vitals_pop_up() verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_120, @@ -318,7 +318,7 @@ dia_val=DIASTOLIC_PRESSSURE_60, heart_rate=HEART_RATE_VAL_85, save=False) - utils.waitForGUI(2) + utils.waitForGUI(1) open_vitals_pop_up() verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_175, input_field=names.o_pop_up_systolic_input_field, @@ -333,7 +333,7 @@ dia_val=DIASTOLIC_PRESSSURE_74, heart_rate=HEART_RATE_VAL_70, save=True) - utils.waitForGUI(2) + utils.waitForGUI(1) open_vitals_pop_up() verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_113, input_field=names.o_pop_up_systolic_input_field, @@ -348,7 +348,7 @@ dia_val=DIASTOLIC_PRESSSURE_150, heart_rate=HEART_RATE_VAL_60, save=False) - utils.waitForGUI(2) + utils.waitForGUI(1) open_vitals_pop_up() verify_ranges_of_vital(vital_parameter=SYSTOLIC_TEXT) verify_ranges_of_vital(vital_parameter=DIASTOLIC_TEXT)