Index: shared/scripts/configuration/config.py =================================================================== diff -u -rc99951f0aa8f348dbc5e72d47ab30443b47c5415 -rffa29812cc49397be901378d94e5ac7dadd24d0c --- shared/scripts/configuration/config.py (.../config.py) (revision c99951f0aa8f348dbc5e72d47ab30443b47c5415) +++ shared/scripts/configuration/config.py (.../config.py) (revision ffa29812cc49397be901378d94e5ac7dadd24d0c) @@ -36,9 +36,7 @@ #post-treatment - - -INCOMPLETE_COLOR_POST_TREATMENT = '#fcfcfc' + CURRENT_COLOR = '#000000' COMPLETE_COLOR= '#4290ec' ENABLED_COLOR = '#fcfcfc' @@ -52,41 +50,41 @@ #dictionary consist of review parameters values of post treatment POST_TREATMENT_REVIEW_PARAMETER_RANGE = { - "Patient ID": ["abcd", "xyz", "qwerty", "dghjf", "cdtys"], - "Heparin Stop": [0, 101, 205, 307, 470], - "Device ID": [1234, 1234, 1234, 1234, 1234], - "Heparin Delivered Volume": [10.1, 10.5, 15.4, 18.9, 20.0], - "Blood Flow Rate": [100, 125, 150, 175, 500], - "Treatment Start DateTime": [1623382321, 1623382321, 1623382321, 1623382321, 1623382321], - "Dialysate Flow Rate": [100, 150, 200, 250, 600], - "Treatment End DateTime": [1623382321, 1623382321, 1623382321, 1623382321, 1623382321], - "Treatment Duration": [60, 75, 90, 105, 330, 480], - "Water Sample Test Result": [0, 1, 1, 1, 1], - "Actual Treatment Duration": [2, 6, 14, 67, 100], - "Dialysate Volume Used": [4.0, 6.0, 54.0, 67.0, 81.0], - "Acid ConcentrateType": [0, 1, 2, 3, 3], - "Prescribed UF Volume": [0.3, 0.5, 0.6, 10.0, 0.8, 5.8, 6.4], - "Bicarbonate Concentrate Type": [0, 0, 0, 0, 0], - "Target UF Volume": [10.1, 10.5, 15.4, 18.9, 20.0], - "Potassium Concentration": [60, 75, 90, 105, 330, 465, 480], - "Actual UF Volume": [0.3, 0.5, 0.6, 10.0, 0.8, 5.8, 6.4], - "Calcium Concentration": [3, 56, 100, 154, 67], - "Prescribed UF Rate": [0.1, 0.55, 0.9, 5.1, 6.7], - "Bicarbonate Concentration": [14, 50, 67, 156, 1], - "Target UF Rate": [0.2, 0.56, 0.45, 2.56, 10.93], - "Sodium Concentration": [4, 6, 54, 67, 81, 100], - "Actual UF Rate": [0.5, 0.6, 10.0, 0.8, 5.8, 6.4], - "Dialysate Temperature": [35.0, 35.5, 36.0, 36.5, 37.0], - "Saline Bolus Volume": [300, 250, 200, 150, 300], - "Dialyzer Type": [0, 1, 2, 3, 4], - "Average Blood Flow": [54.3, 67.3, 65.89, 75.89, 48.76], - "Heparin Type": [0, 0, 0, 0, 0], - "Average Dialysate Flow": [0.6, 0.5, 5.8, 6.4, 10.0, 0.8], - "Average Dialysate Temp": [35.0, 35.5, 36.0, 36.5, 37.0], - "Heparin Bolus Volume": [0.0, 0.1, 1.5, 1.6, 2.0], - "Average Arterial Pressure": [0.0, 11.56, 154.46, 225.57, 300.0], - "Heparin Dispense Rate": [0.0, 0.1, 0.2, 0.9, 1.0], - "Average Venous Pressure": [20.0, 101.45, 394.56, 447.45, 600.00], + "Patient ID": ["abcd", "xyz"], + "Heparin Stop": [0, 101], + "Device ID": [1234, 1234], + "Heparin Delivered Volume": [10.1, 10.5], + "Blood Flow Rate": [100, 125], + "Treatment Start DateTime": [1654519251, 1623382321], + "Dialysate Flow Rate": [100, 150], + "Treatment End DateTime": [1654519251, 1623382321], + "Treatment Duration": [70, 75], + "Water Sample Test Result": [0, 1], + "Actual Treatment Duration": [62, 126], + "Dialysate Volume Used": [4.0, 6.0], + "Acid ConcentrateType": [0, 1], + "Prescribed UF Volume": [0.3, 0.5], + "Bicarbonate Concentrate Type": [0, 0], + "Target UF Volume": [10.1, 10.5], + "Potassium Concentration": [60, 75], + "Actual UF Volume": [0.3, 0.5], + "Calcium Concentration": [3, 56], + "Prescribed UF Rate": [0.1, 0.55], + "Bicarbonate Concentration": [14, 50], + "Target UF Rate": [0.2, 0.56], + "Sodium Concentration": [4, 6], + "Actual UF Rate": [0.5, 0.6], + "Dialysate Temperature": [35.0, 35.5], + "Saline Bolus Volume": [300, 250], + "Dialyzer Type": [0, 1], + "Average Blood Flow": [54.3, 67.3], + "Heparin Type": [0, 0], + "Average Dialysate Flow": [0.6, 0.5], + "Average Dialysate Temp": [35.0, 35.5], + "Heparin Bolus Volume": [0.0, 0.1], + "Average Arterial Pressure": [0.0, 11.56], + "Heparin Dispense Rate": [0.0, 0.1], + "Average Venous Pressure": [20.0, 101.45], } Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r441bbd17451e0afba3c3fe9e22b3afe2f7a9d5e0 -rffa29812cc49397be901378d94e5ac7dadd24d0c --- shared/scripts/configuration/utility.py (.../utility.py) (revision 441bbd17451e0afba3c3fe9e22b3afe2f7a9d5e0) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision ffa29812cc49397be901378d94e5ac7dadd24d0c) @@ -25,55 +25,7 @@ from configuration import config from builtins import int as pyInt - -def verify_page_step_indicator(screen_obj, post_treatment_step): - """ - Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] - @param post_treatment_step : (int) indicates the Current post-treatment step - """ - test.startSection("verification of page step indicators") - for page in range(config.NUM_OF_POST_TREATMENT_BULLETS): - bullet_children = object.children(squish.waitForObjectExists(get_bullet_object(screen_obj, page))) - bullet_circle_color = bullet_children[0].color.name - #test.log() - bullet_border_color = bullet_children[0].border.color.name - step_title = squish.waitForObjectExists(get_text_object(screen_obj, config.POST_TREATMENT_SCREENS[page])) - #To verify the step indicators of the completed post treatment screens - if page < post_treatment_step: - test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) - test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) - test.compare(bullet_circle_color, config.CURRENT_COLOR) - test.compare(bullet_border_color,config.COMPLETE_COLOR) - test.compare(step_title.color.name,config.ENABLED_COLOR) - #To verify the step indicators of the current post treatment screen - elif page == post_treatment_step: - test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) - test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) - test.compare(bullet_circle_color,config.CURRENT_COLOR) - test.compare(bullet_border_color,config.COLOR) - test.compare(step_title.color.name,config.ENABLED_COLOR_ONE) - test.verify(step_title.font.bold) - #To verify the step indicators of the remaining post treatment screens - else: - test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) - test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete,) - test.compare(step_title.color.name,config.COLOR) - test.compare(bullet_circle_color,config.CURRENT_COLOR) - test.compare(bullet_border_color,config.COLOR) - test.endSection() - -def get_text_object(screen_obj, txt): - """ - 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 - - def get_bullet_object(screen_obj, num): """ To obtain a bullet object based on occurrence provided. @@ -124,31 +76,6 @@ return False -def scroll_to_zone(zone=None, screen_object=None): - """ - scroll to the zone if object is hidden - @param zone - (obj) UI object - @param screen_object - (obj) UI object - @return boolean true and false - """ - counter = 0 - while counter <= 100: - try: - counter += 1 - squish.findObject(zone) - squish.snooze(0.5) - if check_if_object_is_within_the_container(obj=zone, container=screen_object): - return True - else: - raise RuntimeError - except RuntimeError: - ScreenObj = squish.waitForObject(screen_object) - screenHeight = pyInt(ScreenObj.height) - screenWidth = pyInt(ScreenObj.width) - squish.mouseWheel(ScreenObj, screenWidth//2, screenHeight//2, 0, -50, squish.Qt.NoModifier) - raise LookupError("zone object is not in view to the user after trying 100 times") - - def scroll_to_zone(zone=None, screen_object=None, direction = None): """ scroll to the UI, if object is hidden @@ -194,32 +121,7 @@ return min_and_sec -def verify_parameter_from_post_treatment_log(msg_text): - """ - To obtain the details of parameter from post treatment log file. - @param msg_text: parameter to be extracted. - @returns message value and message unit - """ - try: - log_location = str(get_extracted_file()) - with open(log_location, 'r') as csv_file: - - try: - for row in csv_file: - reader = csv.reader(csv_file) - for row in reader: - row_length = sum(1 for values in row) - for row1 in row: - if row[0]!= None and row[0] == msg_text and row_length == 3: - return (row[1],row[2]) - else: - pass - except: - test.fail("Treatment log data is corrupted") - except: - test.fail("Log file is not created or log file is not created based on standard log naming format.") - def get_extracted_file(): """ This function is the handler for getting file from log folder. @@ -292,37 +194,42 @@ def verify_page_step_indicator_post_treatment(screen_obj, post_treatment_step): """ - Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] - @param post_treatment_step : (int) indicates the Current post-treatment step - + 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.POST_TREATMENT_SCREENS)): bullet_children = object.children(squish.waitForObjectExists(get_bullet_object(screen_obj, page))) bullet_circle_color = bullet_children[0].color.name bullet_border_color = bullet_children[0].border.color.name - step_title = squish.waitForObjectExists(get_text_object(screen_obj, config.POST_TREATMENT_SCREENS[0])) - #To verify the step indicators of the completed post-treatment screens + step_title = squish.waitForObjectExists(get_text_object(screen_obj, config.POST_TREATMENT_SCREENS[page])) + if page < post_treatment_step: + test.log("To verify the step indicator of the completed post-treatment screen " + config.POST_TREATMENT_SCREENS[page]) test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) - test.compare(bullet_circle_color, config.COMPLETE_COLOR) - test.compare(bullet_border_color,config.COMPLETE_COLOR) - test.compare(step_title.color.name,config.ENABLED_COLOR) - #To verify the step indicators of the current post-treatment screen + test.compare(bullet_circle_color, config.COMPLETE_COLOR, " the bullet color must be " + str(config.COMPLETE_COLOR)) + test.compare(bullet_border_color, config.COMPLETE_COLOR," the bullet border color must be " + str(config.COMPLETE_COLOR)) + test.compare(step_title.color.name, config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) + elif page == post_treatment_step: - test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) + test.log("To verify the step indicators of the current post-treatment screen " + config.POST_TREATMENT_SCREENS[page]) + test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) - test.compare(bullet_circle_color,config.CURRENT_COLOR) - test.compare(bullet_border_color,config.COMPLETE_COLOR) - test.compare(step_title.color.name,config.ENABLED_COLOR) - #To verify the step indicators of the remaining post-treatment screens + test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) + test.compare(bullet_border_color,config.COMPLETE_COLOR, " the bullet border color must be " + str(config.COMPLETE_COLOR)) + test.compare(step_title.color.name,config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) + test.verify(step_title.font.bold, " the current text must be in bold") + else: + test.log("To verify the step indicators of the remaining post-treatment screen " + config.POST_TREATMENT_SCREENS[page]) test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete,) - test.compare(step_title.color.name,config.INCOMPLETE_COLOR_POST_TREATMENT) - test.compare(bullet_circle_color,config.CURRENT_COLOR) - test.compare(bullet_border_color,config.INCOMPLETE_COLOR) - test.endSection() + test.compare(step_title.color.name,config.INCOMPLETE_COLOR, " the text color must be " + str(config.INCOMPLETE_COLOR)) + 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() + + Index: tst_post_treatment/test.py =================================================================== diff -u -r8977e6f10ea8a1b5807f963a1b98dc11ea2d181f -rffa29812cc49397be901378d94e5ac7dadd24d0c --- tst_post_treatment/test.py (.../test.py) (revision 8977e6f10ea8a1b5807f963a1b98dc11ea2d181f) +++ tst_post_treatment/test.py (.../test.py) (revision ffa29812cc49397be901378d94e5ac7dadd24d0c) @@ -16,11 +16,16 @@ # NOTE: # This test contradicts verification of post treatment section. +import builtins import names +import csv +import test +import time import builtins from dialin.ui import utils -from dialin.ui.hd_simulator import HDSimulator +from datetime import * from configuration import config +from dialin.ui.hd_simulator import HDSimulator from configuration import utility from dialin.common.hd_defs import HDOpModes, HDOpSubModes, PostTreatmentStates @@ -55,10 +60,9 @@ Method for navigating to post treatment disconnection submode. """ hd_simulator.cmd_send_hd_operation_mode(op_mode = HDOpModes.MODE_POST.value, sub_mode=PostTreatmentStates.HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE.value) - if object.exists(get_rightarrow_obj(rightarrow_obj_names[0])): - mouseClick(waitForObject(get_rightarrow_obj(rightarrow_obj_names[0]))) - elif object.exists(get_rightarrow_obj(rightarrow_obj_names[0])): - mouseClick(waitForObject(get_rightarrow_obj(rightarrow_obj_names[0]))) + for iteration in range(2): + if object.exists(get_rightarrow_obj(rightarrow_obj_names[0])): + mouseClick(waitForObject(get_rightarrow_obj(rightarrow_obj_names[0]))) def post_treatment_review_text_obj(text): @@ -265,7 +269,7 @@ """ test.startSection("Method to check all the values of parameters in review screen") - for index in range (5): + for index in range (2): getting_patient_id_from_create_custom_treatment(config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Patient ID"][index]) navigation_to_post_treatment() @@ -312,8 +316,7 @@ utils.waitForGUI(1) test.startSection("verification of post treatment review values for iteration -> "+str(index+1)) - test.log("###verification of post treatment UI data") - + test.log("###verification of post treatment UI data based on config data") for parameters_value in config.POST_TREATMENT_REVIEW_PARAMETER_RANGE.keys(): parameter_set = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE[parameters_value] @@ -352,13 +355,25 @@ elif parameters_value == 'Water Sample Test Result': test.log("verification of values for parameter ->" + parameters_value) review_parameter_value = review_text(text = str(parameter_set[index])) + test.log(str(review_parameter_value)) parameter_text = waitForObjectExists(review_parameter_value) test.compare(str(parameter_set[index]), str(parameter_text.text), "parameter value should be "+str(parameter_set[index])) continue - if parameters_value == 'Treatment Start DateTime' or parameters_value == 'Treatment End DateTime' or parameters_value == 'Actual Treatment Duration': - continue + if parameters_value == 'Treatment Start DateTime': + start_date_time = datetime.fromtimestamp(parameter_set[index]).strftime('%Y/%m/%d %H:%M') + review_parameter_value = review_text(text = str(start_date_time)) + parameter_text = waitForObjectExists(review_parameter_value) + test.compare(start_date_time, str(parameter_text.text), "parameter value should be "+str(parameter_set[index])) + continue + if parameters_value == 'Treatment End DateTime': + end_date_time = datetime.fromtimestamp(parameter_set[index]).strftime('%Y/%m/%d %H:%M') + review_parameter_value = review_text(text = str(end_date_time)) + parameter_text = waitForObjectExists(review_parameter_value) + test.compare(end_date_time, str(parameter_text.text), "parameter value should be "+str(parameter_set[index])) + continue + else: if isinstance(parameter_set[index], float): parameter_set[index] = ('%.3f' %parameter_set[index]) @@ -370,26 +385,54 @@ parameter_to_scroll = "0" else: parameter_to_scroll = str(time_duration) - + if parameters_value == 'Actual Treatment Duration': + time_duration = builtins.int(utility.convert_seconds_into_min_and_sec(seconds=parameter_to_scroll, time_format="%M")) + test.log(str(time_duration)) + parameter_to_scroll = str(time_duration) + review_parameter_value = review_text(text = parameter_to_scroll) parameter_text = waitForObjectExists(review_parameter_value) test.log("###verification of values for parameter - >" + parameters_value + " from UI screen") parameter_set[index] = parameter_to_scroll test.compare(str(parameter_set[index]), str(parameter_text.text), "parameter value should be "+str(parameter_set[index])) test.log("verification of post treatment log file data") - parameter_value, parameter_unit = utility.verify_parameter_from_post_treatment_log(parameters_value) - if parameter_unit is None or parameter_value is None: - continue + parameter_value, parameter_unit = verify_parameter_from_post_treatment_log(parameters_value) test.compare(parameter_unit, config.POST_TREATMENT_REVIEW_SCREEN_UNITS[parameters_value], "parameters unit should be ->" + config.POST_TREATMENT_REVIEW_SCREEN_UNITS[parameters_value]) test.compare(parameter_value, parameter_set[index], "parameters value should be ->" + str(parameter_set[index])) test.endSection() test.endSection() - + +def verify_parameter_from_post_treatment_log(msg_text): + """ + To obtain the details of parameter from post treatment log file. + @param msg_text: parameter to be extracted. + @returns message value and message unit + """ + try: + log_location = str(utility.get_extracted_file()) + with open(log_location, 'r') as csv_file: + + try: + for row in csv_file: + reader = csv.reader(csv_file) + for row in reader: + row_length = sum(1 for values in row) + for row1 in row: + if row[0]!= None and row[0] == msg_text and row_length == 3: + return (row[1],row[2]) + else: + pass + except: + test.fail("Treatment log data is corrupted") + except: + test.fail("Log file is not created or log file is not created based on standard log naming format.") + + def main(): - + #TODO: Export functionality need to be verified in new build utils.tstStart(__file__) startApplication(config.AUT_NAME) hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_POST.value, sub_mode=PostTreatmentStates.HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE.value) @@ -400,4 +443,3 @@ utils.tstDone() -