Index: shared/scripts/configuration/config.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -rd6518e26df89b43f269338a95d45b708cc37ec3a --- shared/scripts/configuration/config.py (.../config.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/configuration/config.py (.../config.py) (revision d6518e26df89b43f269338a95d45b708cc37ec3a) @@ -18,7 +18,6 @@ AUT_NAME = "denaliSquish" COMMON_PATH = os.environ['HOME']+"/Projects" - COLOR_CODES = {"Aqua": "#81ffff", "Blue": "#017dea", "Blue 2": "#1090d5", "Green": "#29fd2d", "Grey": "#d3d3d3", "Lavender": "#db98f5", "Light Blue": "#acd7f1", "Light Teal": "#29f1da","Lime": "#b7fc36", @@ -32,3 +31,154 @@ BLOOD_PRIMING_TEXT = "Blood Priming" SALINE_UNIT = "mL" BLOOD_PRIMING_DEFAULT_VALUE = "0 mL" + +# #post-treatment +# +# PATIENT_DISCONNECTION_TEXT = "Patient Disconnection" +# PATIENT_DISCONNECTION_CONFIRM_BUTTON_TEXT = "CONFIRM" +# +# +# CURRENT_COLOR = '#000000' +# COMPLETE_COLOR = '#4290ec' +# ENABLED_COLOR = '#fcfcfc' +# INCOMPLETE_COLOR = '#607a91' +# INCOMPLETE_COLOR_POST_TREATMENT = '#fcfcfc' +# +# COLOR = '#607a91' +# ENABLED_COLOR_ONE = '#607a91' + + + +#post-treatment + +PATIENT_DISCONNECTION_TEXT = "Patient Disconnection" +REVIEW_TEXT = "Review" +EXPORT_TEXT = "Export" +PATIENT_DISCONNECTION_CONFIRM_BUTTON_TEXT = "CONFIRM" +DISPOSABLE_TEXT = "Disposables" +NEXT_TEXT = "NEXT" +BACK_TEXT = "BACK" +CONFIRM_TEXT = "CONFIRM" +DISPOSABLES_REMOVAL_TEXT = "Disposables Removal" +INCOMPLETE_COLOR_POST_TREATMENT = '#fcfcfc' +CURRENT_COLOR = '#000000' +COMPLETE_COLOR= '#4290ec' +ENABLED_COLOR = '#fcfcfc' +INCOMPLETE_COLOR = '#607a91' + +POST_TREATMENT_SCREENS = ["Disconnection", "Review", "Disposables", "Disinfection"] + +#post treatment review +HEPARIN_TYPE = "UFH 1,000 IU/mL" +ACID_CONCENTRATE = ["Fres. Naturalyte", "08-1251-1", "08-2251-0", "08-3251-9", "08-3251-9"] +BICARBONATE_CONCENTRATE = "Fres. Centrisol" +DIALYZER_TYPE = ["BB Diacap Pro 13H", "BB Diacap Pro 16H", "BB Diacap Pro 19H", "F Optiflux F160NRe", "F Optiflux F180NRe"] + +TREATMENT_LOG_LOCATION = '/home/denali/Desktop/sd-card/treatment/*.log' +TREATMENT_REVIEW_TITLE_TEXT = "Treatment Review" +VISIBLE = True + +POST_TREATMENT_REVIEW_SCREEN_PARAMETERS = ["Patient ID", "Heparin Stop", + "Device ID", "Heparin Delivered Volume", + "Blood Flow Rate", "Treatment Start DateTime", + "Dialysate Flow Rate", "Treatment End DateTime", + "Treatment Duration", "Water Sample Test Result", + "Actual Treatment Duration", "Dialysate Volume Used", + "Acid ConcentrateType", "Prescribed UF Volume", + "Bicarbonate Concentrate Type", "Target UF Volume", + "Potassium Concentration", "Actual UF Volume", + "Calcium Concentration", "Prescribed UF Rate", + "Bicarbonate Concentration", "Target UF Rate", + "Sodium Concentration", "Actual UF Rate", + "Dialysate Temperature", "Saline Bolus Volume", + "Dialyzer Type", "Average Blood Flow", + "Heparin Type", "Average Dialysate Flow", + "Heparin Concentration", "Average Dialysate Temp", + "Heparin Bolus Volume", "Average Arterial Pressure", + "Heparin Dispense Rate", "Average Venous Pressure"] + + +POST_TREATMENT_REVIEW_SCREEN_UNITS = { + "Patient ID" : "", + "Device ID" : "", + "Blood Flow Rate" : "mL/min", + "Dialysate Flow Rate" : "mL/min", + "Treatment Duration" : "min", + "Actual Treatment Duration":"min", + "Acid ConcentrateType" : "", + "Bicarbonate Concentrate Type" : "", + "Heparin Stop" : "min", + "Heparin Bolus Volume": "mL", + "Heparin Delivered Volume": "mL", + "Treatment Start DateTime" : "", + "Treatment End DateTime" : "", + "Water Sample Test Result": "", + "Dialysate Volume Used" : "L", + "Prescribed UF Volume" : "L", + "Target UF Volume" : "L", + "Potassium Concentration" : "mEg/L", + "Calcium Concentration" :"mEg/L", + "Bicarbonate Concentration" : "mEg/L", + "Sodium Concentration" : "mEg/L", + "Average Blood Flow" : "mL/min", + "Saline Bolus Volume" : "mL", + "Average Dialysate Flow" : "mL/min", + "Average Arterial Pressure" : "mmHg", + "Average Venous Pressure" : "mmHg", + "Dialysate Temperature" :"°C", + "Dialyzer Type" : "", + "Heparin Type" : "IU/mL", + "Heparin Concentration" : "IU/mL", + "Actual UF Volume" : "L", + "Prescribed UF Rate" : "mL/min", + "Target UF Rate": "mL/min", + "Actual UF Rate": "mL/min", + "Heparin Dispense Rate" : "mL/hr", + "Average Dialysate Flow" : "mL/min", + "Average Dialysate Temp" : "°C", + + } + + +#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], + + +} + + \ No newline at end of file Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -rd6518e26df89b43f269338a95d45b708cc37ec3a --- shared/scripts/configuration/utility.py (.../utility.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision d6518e26df89b43f269338a95d45b708cc37ec3a) @@ -12,82 +12,124 @@ # ############################################################################ - +import builtins +import names +import os +import csv +import glob +import object import sys import test +import time import squish from configuration import config from builtins import int as pyInt - + -def start_application(app_name): +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): """ - 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) + 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): """ - 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) + To obtain a bullet object based on occurrence provided. + @param screen_obj: provides the container on which the bullet must be present + @param num: provides the occurrence value + @returns a real name object + """ + names.o_bullet_object["container"] = screen_obj + names.o_bullet_object["occurrence"] = num + 1 + return names.o_bullet_object - + +def get_indicators(screen_obj, txt): + """ + Verifying the busy indicators for BiCarb Pump Check and Acid Pump Check. + indicator object of expected text + @param step - (str) expected text + @return indicators - (obj) list of busy and check indicator + """ + parent_obj = object.parent(squish.waitForObjectExists(get_text_object(screen_obj,txt))) + children_obj = object.children(parent_obj) + indicator_parent = children_obj[2] + indicators = object.children(indicator_parent) + return indicators + + 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 - @return boolean true/false + @return boolean true and false """ container = squish.findObject(container) containerPos = container.mapToGlobal(squish.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)) obj_x, obj_y = pyInt(objPos.x), pyInt(objPos.y) obj_width, obj_height = pyInt(obj.width), pyInt(obj.height) - + if obj_x >= container_x and obj_y >= container_y: if (obj_x + obj_width) <= (container_x + container_width) and (obj_y + obj_height) <= (container_y + container_height): return True - + return False - - + + def scroll_to_zone(zone=None, screen_object=None): """ - scroll to the numeric if object is hidden - @param zone - UI object - @param screen_object - UI object (UI Home screen = waveforms + numerics) - @return boolean true/false + 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: @@ -103,8 +145,170 @@ ScreenObj = squish.waitForObject(screen_object) screenHeight = pyInt(ScreenObj.height) screenWidth = pyInt(ScreenObj.width) - squish.mouseWheel(ScreenObj, screenWidth-1000, - screenHeight-10, 0, -50, squish.Qt.NoModifier) - + 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 + @param zone - object to be find out. + @param screen_object - object of the screen. + @return boolean + """ + counter = 0 + while counter <= 100: + try: + counter += 1 + squish.snooze(0.5) + 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.findObject(screen_object) + screenHeight = pyInt(ScreenObj.height) + screenWidth = pyInt(ScreenObj.width) + if direction is None: + squish.mouseWheel(ScreenObj, (screenWidth-100), + 107, 0, -(screenHeight-460), squish.Qt.NoModifier) + else: + squish.mouseWheel(ScreenObj, (screenWidth-100), + -(screenHeight-700), 0, 50, squish.Qt.NoModifier) + raise LookupError("zone object is not in view to the user after " + \ - "trying 100 times") + "trying 100 times") + + +def convert_seconds_into_min_and_sec(seconds, time_format="%M:%S"): + seconds = builtins.int(seconds) + min_and_sec = time.strftime(time_format, time.gmtime(seconds)) + return min_and_sec + + + +def verify_parameter_from_post_treatment_log(msg_text): + 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. + + This handler will go inside log folder and looks for newly added log based on current time. + if it satisfied that condition, it will return the exact path of newly created log. + + @return latest_file - (string) returns latest file that append on log folder from sd-data + """ + try: + list_of_files = glob.glob(config.TREATMENT_LOG_LOCATION) + latest_file = max(list_of_files, key=os.path.getctime) + return latest_file + except: + test.fail("log file is not created during application interaction") + return False + + +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. + @param screen_obj: provides the container on which the bullet must be present + @param num: provides the occurrence value + @returns a real name object + """ + names.o_bullet_object["container"] = screen_obj + names.o_bullet_object["occurrence"] = num + 1 + return names.o_bullet_object + + +def get_indicators(screen_obj, txt): + """ + Verifying the busy indicators for BiCarb Pump Check and Acid Pump Check. + indicator object of expected text + @param step - (str) expected text + @return indicators - (obj) list of busy and check indicator + """ + parent_obj = object.parent(squish.waitForObjectExists(get_text_object(screen_obj,txt))) + children_obj = object.children(parent_obj) + indicator_parent = children_obj[2] + indicators = object.children(indicator_parent) + return indicators + + +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 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 + """ + 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 + if page < post_treatment_step: + 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 + 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.COMPLETE_COLOR) + test.compare(step_title.color.name,config.ENABLED_COLOR) + #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.INCOMPLETE_COLOR_POST_TREATMENT) + test.compare(bullet_circle_color,config.CURRENT_COLOR) + test.compare(bullet_border_color,config.INCOMPLETE_COLOR) + test.endSection() Index: shared/scripts/names.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -rd6518e26df89b43f269338a95d45b708cc37ec3a --- shared/scripts/names.py (.../names.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/names.py (.../names.py) (revision d6518e26df89b43f269338a95d45b708cc37ec3a) @@ -48,6 +48,63 @@ o_cumulative_fluid_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Cumulative Delivered", "type": "Text", "unnamed": 1, "visible": True} +#post-treatment +o_text_object = {"type": "Text", "unnamed": 1, "visible": True} +o_bullet_object = {"type": "StepBullet", "unnamed": 1, "visible": True} +o_PostTreatmentStack_PostTreatmentStack = {"container": o_Gui_MainView, "objectName": "_PostTreatmentStack", "type": "PostTreatmentStack", "visible": True} +o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase = {"container": o_PostTreatmentStack_PostTreatmentStack, "objectName": "_patientDisconnectionConfirm", "type": "TreatmentFlowBase", "visible": True} +o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase = {"container": o_PostTreatmentStack_PostTreatmentStack, "objectName": "_disposablesRemovalConfirm", "type": "TreatmentFlowBase", "visible": True} +o_patientDisconnectionConfirm_Patient_Disconnection_Text = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "text": "Patient Disconnection", "type": "Text", "unnamed": 1, "visible": True} +o_patient_Disconnection_left_arrow = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "id": "_leftImage", "source": "qrc:/images/iArrowLeft", "type": "Image", "unnamed": 1, "visible": True} +o_patientDisconnectionConfirm_rightImage_Image = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "id": "_rightImage", "source": "qrc:/images/iArrowRight", "type": "Image", "unnamed": 1, "visible": True} +o_patientDisconnectionConfirm_lefttImage_Image = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "id": "_leftImage", "source": "qrc:/images/iArrowLeft", "type": "Image", "unnamed": 1, "visible": True} +o_patientDisconnectionConfirm_Button = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "text": "CONFIRM", "type": "Text", "unnamed": 1, "visible": True} +o_PostTreatmentStack_PostTreatmentStack = {"container": o_Gui_MainView, "objectName": "_PostTreatmentStack", "type": "PostTreatmentStack", "visible": True} +o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase = {"container": o_PostTreatmentStack_PostTreatmentStack, "objectName": "_patientDisconnectionConfirm", "type": "TreatmentFlowBase", "visible": True} +o_patient_disconnection_text = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "text": "Patient Disconnection", "type": "Text", "unnamed": 1, "visible": True} +o_patient_Disconnection_right_arrow = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "id": "_rightImage", "source": "qrc:/images/iArrowRight", "type": "Image", "unnamed": 1, "visible": True} +o_patient_Disconnection_left_arrow = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "id": "_leftImage", "source": "qrc:/images/iArrowLeft", "type": "Image", "unnamed": 1, "visible": True} +o_patient_disconnection_confirm_button = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "text": "CONFIRM", "type": "Text", "unnamed": 1, "visible": True} +o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview = {"container": o_PostTreatmentStack_PostTreatmentStack, "objectName": "_treatmentReviewConfirm", "type": "PostTreatmentReview", "visible": True} +o_treatment_review_next_text = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "text": "NEXT", "type": "Text", "unnamed": 1, "visible": True} +o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase = {"container": o_PostTreatmentStack_PostTreatmentStack, "objectName": "_disposablesRemovalConfirm", "type": "TreatmentFlowBase", "visible": True} +o_disposablesRemovalConfirm_swipeview_SwipeView = {"container": o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase, "id": "_swipeview", "type": "SwipeView", "unnamed": 1, "visible": True} +o_disposables_removal_backButton = {"container": o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase, "objectName": "_backButton", "type": "BackButton", "visible": True} +o_treatment_review_next_button = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "objectName": "_confirmButton", "type": "TouchRect", "visible": True} +o_treatmentReviewConfirm_ExportButton = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "gradient": 0, "type": "ExportButton", "unnamed": 1, "visible": True} +o_disposables_removal_confirm_button = {"container": o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase, "objectName": "_confirmButton", "type": "TouchRect", "visible": True} +o_disposablesRemovalConfirm_BACK_Text = {"container": o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase, "text": "BACK", "type": "Text", "unnamed": 1, "visible": True} +o_disposables_removal_confirm_button_text = {"container": o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase, "text": "CONFIRM", "type": "Text", "unnamed": 1, "visible": True} +o_disposables_removal_left_arrow = {"container": o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase, "id": "_leftImage", "source": "qrc:/images/iArrowLeft", "type": "Image", "unnamed": 1, "visible": True} +o_disposables_removal_right_arrow = {"container": o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase, "id": "_rightImage", "source": "qrc:/images/iArrowRight", "type": "Image", "unnamed": 1, "visible": True} +o_disposables_removal_text = {"container": o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase, "text": "Disposables Removal", "type": "Text", "unnamed": 1, "visible": True} +o_treatmentReviewConfirm_Export_Text = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "text": "Export", "type": "Text", "unnamed": 1, "visible": True} +o_right_arrow = {"id": "_rightImage", "source": "qrc:/images/iArrowRight", "type": "Image", "unnamed": 1, "visible": True} +o_left_arrow = {"id": "_leftImage", "source": "qrc:/images/iArrowLeft", "type": "Image", "unnamed": 1, "visible": True} + +#post treatment review +o_Gui_MainView = {"type": "Gui::MainView", "unnamed": 1, "visible": True} +o_PostTreatmentStack_PostTreatmentStack = {"container": o_Gui_MainView, "objectName": "_PostTreatmentStack", "type": "PostTreatmentStack", "visible": True} +o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview = {"container": o_PostTreatmentStack_PostTreatmentStack, "objectName": "_treatmentReviewConfirm", "type": "PostTreatmentReview", "visible": True} +o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview_ONE = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "type": "Text", "unnamed": 1, "visible": True} +o_review_area = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "id": "_flickable", "type": "Flickable", "unnamed": 1, "visible": True} +o_review_text = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "type": "Text", "unnamed": 1, "visible": True} + +#patient ID from create custom treatment +o_input_patient_id = {"container": o_PreTreatmentCreateStack_PreTreatmentBase_TreatmentFlowBase, "echoMode": 0, "id": "_input", "type": "TextInput", "unnamed": 1, "visible": True} +o_confirm_button = {"container": o_PreTreatmentCreateStack_PreTreatmentBase_TreatmentFlowBase, "text": "CONFIRM", "type": "Text", "unnamed": 1, "visible": True} +o_right_arrow = {"id": "_rightImage", "source": "qrc:/images/iArrowRight", "type": "Image", "unnamed": 1, "visible": True} +o_left_arrow = {"id": "_leftImage", "source": "qrc:/images/iArrowLeft", "type": "Image", "unnamed": 1, "visible": True} +o_patientDisconnectionConfirm_Button = {"container": o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase, "text": "CONFIRM", "type": "Text", "unnamed": 1, "visible": True} +o_treatmentReviewConfirm_NEXT_Text = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "text": "NEXT", "type": "Text", "unnamed": 1, "visible": True} +o_treatmentReviewConfirm_patient_ID_Text = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "type": "Text", "unnamed": 1, "visible": True} +o_treatmentReviewConfirm_500_Text = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "text": 500, "type": "Text", "unnamed": 1, "visible": True} +o_treatmentReviewConfirm_Calcium_Concentration_Text = {"container": o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview, "text": "Calcium Concentration", "type": "Text", "unnamed": 1, "visible": True} + + + + + Index: tst_post_treatment/test.py =================================================================== diff -u --- tst_post_treatment/test.py (revision 0) +++ tst_post_treatment/test.py (revision d6518e26df89b43f269338a95d45b708cc37ec3a) @@ -0,0 +1,440 @@ +# -*- coding: utf-8 -*-" + +## +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# copyright +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, +# IN PART OR IN WHOLE, +# WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# file tst_post_treatment_disconnection +# date 2022/05/20 +# author Joseph Varghese +# author Akshay Dhawan +# author Shweta POlicepatil +# author Amol Shinde +# NOTE: +# This test contradicts verification of post treatment section. + +import names +import builtins +from dialin.ui import utils +from dialin.ui.hd_simulator import HDSimulator +from configuration import config +from configuration import utility +from dialin.common.hd_defs import HDOpModes, HDOpSubModes, PostTreatmentStates + + +hd_simulator = HDSimulator() + +NUM_OF_POSTTREATMENT_BULLETS = len(config.POST_TREATMENT_SCREENS) +SCREEN_OBJ1 = names.o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase +SCREEN_OBJ2 = names.o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview +SCREEN_OBJ3 = names.o_PostTreatmentStack_disposablesRemovalConfirm_TreatmentFlowBase +num_of_instructionss = 0 +NUM_OF_PATIENT_DISCONNECTION_SCREENS = 2 +NUM_OF_DISPOSABLE_INSTALLATION_SCREENS = 7 +DISPOSABLES_STEP = 2 +PATIENT_DISCONNECTION_STEP = 0 + +rightarrow_obj_names = [names.o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase] +leftarrow_obj_names = [names.o_PostTreatmentStack_patientDisconnectionConfirm_TreatmentFlowBase] + +contents = [] +parameter_names = [] +parameter_values = [] +parameter_units = [] +title_list = [] + + + +def get_rightarrow_obj(screen_obj): + """ + To obtain object for right arrow based on container + @param (str) screen_obj: provides the container + @returns a real name object + """ + names.o_right_arrow["container"] = screen_obj + return names.o_right_arrow + + +def get_leftarrow_obj(screen_obj): + """ + To obtain object for right arrow based on container + @param (str) screen_obj: provides the container + @returns a real name object + """ + names.o_left_arrow["container"] = screen_obj + return names.o_left_arrow + + +def navigation_to_post_treatment(): + """ + 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]))) + 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): + """ + Method to set object property as dynamic. + @param text : (str) treatment parameter text to be appended with object properties + """ + names.o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview_ONE["text"] = text + return names.o_PostTreatmentStack_treatmentReviewConfirm_PostTreatmentReview_ONE + + +def review_text(text): + """ + Method to set object property based on text + @param text : (str) treatment parameter text + """ + if isinstance(text, str): + names.o_review_text["text"] = text + return names.o_review_text + else: + test.log("Invalid \"text\": " +text+" for object.") + names.o_review_text["text"] = None + + +def verify_right_instruction_navigation_patient_disconnection(num_of_instructions): + """. + Method to verify right arrow functionality + @param num_of_instructions - (int) count the number of instructions + """ + test.startSection("verifying right arrow functionality for Patient Disconnection Screen") + utility.verify_missing_object(names.o_patient_Disconnection_left_arrow) + for indicator in range(1, num_of_instructions, 1): + verify_bullet_navigation(indicator, num_of_instructions, SCREEN_OBJ1) + if indicator != num_of_instructions: + mouseClick(waitForObject(names.o_patient_Disconnection_right_arrow)) + test.compare(str(waitForObjectExists(names.o_patient_disconnection_text).text), config.PATIENT_DISCONNECTION_TEXT, "Patient Disconnection text must be {}".format(config.PATIENT_DISCONNECTION_TEXT)) + utility.verify_missing_object(names.o_patient_Disconnection_right_arrow) + test.endSection() + + +def verify_left_instruction_navigation_patient_disconnection(num_of_instructions): + """ + Method to verify left arrow functionality and + verify the status of back, next and confirm button if available + @param num_of_instructions - (int) count the number of instructions, + """ + test.startSection("verifying left arrow functionality for Patient Disconnection Screen") + utility.verify_missing_object(names.o_patient_Disconnection_right_arrow) + for indicator in range(num_of_instructions, 0, -1): + verify_bullet_navigation(indicator, num_of_instructions, SCREEN_OBJ1) + if indicator != 1: + mouseClick(waitForObject(names.o_patient_Disconnection_left_arrow)) + test.compare(str(waitForObjectExists(names.o_patient_disconnection_text).text), config.PATIENT_DISCONNECTION_TEXT, "Patient Disconnection text must be {}".format(config.PATIENT_DISCONNECTION_TEXT)) + utility.verify_missing_object(names.o_patient_Disconnection_left_arrow) + test.endSection() + + +def verify_right_instruction_navigation_disposables(num_of_instructions): + """ + Method to verify right arrow functionality and + verify status confirm button if available + @param num_of_instructions - (int) count the number of instructions + """ + test.startSection("verifying right arrow functionality and Confirm Button for Disposables Screen") + utility.verify_missing_object(names.o_disposables_removal_left_arrow) + for indicator in range(1, num_of_instructions, 1): + verify_bullet_navigation(indicator, num_of_instructions, SCREEN_OBJ3) + test.verify(not waitForObjectExists(names.o_disposables_removal_confirm_button).enabled, "Confirm button should be disabled") + if indicator != num_of_instructions: + mouseClick(waitForObject(names.o_disposables_removal_right_arrow)) + test.compare(findObject(names.o_disposables_removal_text).text, config.DISPOSABLES_REMOVAL_TEXT, "DISPOSABLES_REMOVAL_TEXT must be NEXT"+config.DISPOSABLES_REMOVAL_TEXT) + utility.verify_missing_object(names.o_disposables_removal_right_arrow) + test.verify(waitForObjectExists(names.o_disposables_removal_confirm_button).enabled ," confirm button must be active") + test.verify(waitForObjectExists(names.o_disposables_removal_backButton).enabled, " Back button must be active") + test.endSection() + + +def verify_left_instruction_navigation_disposables(num_of_instructions): + """ + Method to verify left arrow functionality and + verify status of back button. + @param num_of_instructions - (int) count the number of instructions + """ + test.startSection("verifying left arrow functionality and Back Button for Disposables Screen") + utility.verify_missing_object(names.o_disposables_removal_right_arrow) + for indicator in range(num_of_instructions, 0, -1): + verify_bullet_navigation(indicator, num_of_instructions, SCREEN_OBJ3) + if indicator != 1: + mouseClick(waitForObject(names.o_disposables_removal_left_arrow)) + test.compare(waitForObjectExists(names.o_disposables_removal_text).text, config.DISPOSABLES_REMOVAL_TEXT, "DISPOSABLES_REMOVAL_TEXT must be "+config.DISPOSABLES_REMOVAL_TEXT) + utility.verify_missing_object(names.o_disposables_removal_left_arrow) + test.verify(waitForObjectExists(names.o_disposables_removal_backButton).enabled, " Back button must be active") + test.endSection() + + +def verify_bullet_navigation(num, num_of_instructions, screen_obj): + """ + Method to verify status of bullets based + on number of instruction screen + @param num - (int) number of indicator + @param num_of_instructions- (int) count the number of instructions + @param object - screen_obj - (str) Screen object + """ + test.startSection("instruction bullet verification for screens") + for instruction in range(1, num_of_instructions): + bullet_children = object.children(waitForObjectExists(utility.get_bullet_object(screen_obj,(NUM_OF_POSTTREATMENT_BULLETS + instruction) - 1))) + bullet_circle_color = bullet_children[0].color.name + bullet_border_color = bullet_children[0].border.color.name + if instruction <= num: + test.compare(bullet_circle_color, config.COMPLETE_COLOR) + test.compare(bullet_border_color,config.COMPLETE_COLOR) + test.log(str(instruction) + " Complete bullet") + else: + test.compare(bullet_circle_color, config.CURRENT_COLOR) + test.compare(bullet_border_color,config.INCOMPLETE_COLOR) + test.log(str(instruction) + " Incomplete bullet") + test.endSection() + + +def verify_patient_disconnection_screens(): + """ + Method to verify parameters under 'Patient Disconnection Screens' + """ + test.startSection("verifying Patient Disconnection screen") + utility.verify_page_step_indicator_post_treatment(SCREEN_OBJ1, PATIENT_DISCONNECTION_STEP) + verify_right_instruction_navigation_patient_disconnection(NUM_OF_PATIENT_DISCONNECTION_SCREENS) + verify_left_instruction_navigation_patient_disconnection(NUM_OF_PATIENT_DISCONNECTION_SCREENS) + verify_right_instruction_navigation_patient_disconnection(NUM_OF_PATIENT_DISCONNECTION_SCREENS) + test.compare(str(waitForObjectExists(names.o_patient_disconnection_confirm_button).text), config.PATIENT_DISCONNECTION_CONFIRM_BUTTON_TEXT,"Confirm button text must be {}".format(config.PATIENT_DISCONNECTION_CONFIRM_BUTTON_TEXT)) + test.verify(waitForObjectExists(names.o_patient_disconnection_confirm_button).enabled, "Confirm button must be enabled") + mouseClick(waitForObject(names.o_patient_disconnection_confirm_button)) + utility.verify_page_step_indicator_post_treatment(SCREEN_OBJ2,1) + test.compare(waitForObject(names.o_treatment_review_next_text).text, config.NEXT_TEXT, "NEXT button text must be NEXT") + test.verify(waitForObject(names.o_treatment_review_next_button).enabled, "NEXT button must be enabled") + mouseClick(waitForObject(names.o_treatment_review_next_button)) + test.endSection() + + +def navigate_treatment_review_screen(): + """ + Method to navigate to review treatment screen and verify page step indicator + """ + + test.startSection("navigating and verifying page step indicator under Review screen") + test.verify(waitForObjectExists(names.o_disposables_removal_backButton).enabled, " Back button must be active") + test.verify(not waitForObjectExists(names.o_treatmentReviewConfirm_Export_Text).enabled, " Export button should not be active") + test.compare(str(waitForObjectExists(names.o_treatmentReviewConfirm_Export_Text).text), config.EXPORT_TEXT,"Export button text must be {}".format(config.EXPORT_TEXT)) + mouseClick(waitForObject(names.o_disposables_removal_backButton)) + test.verify(waitForObjectExists(names.o_treatment_review_next_button).enabled, " Next button must be active") + mouseClick(waitForObject(names.o_treatment_review_next_button)) + utility.verify_page_step_indicator_post_treatment(SCREEN_OBJ3, DISPOSABLES_STEP) + test.endSection() + + +def verify_disposables_screen(): + """ + Method to verify parameters under 'Disposables screens' + """ + navigate_treatment_review_screen() + test.startSection("verification of Disposable Screen") + names.o_bullet_object.pop("occurrence") + verify_right_instruction_navigation_disposables(NUM_OF_DISPOSABLE_INSTALLATION_SCREENS) + test.verify(waitForObjectExists(names.o_disposables_removal_confirm_button).enabled, " confirm button must be active") + verify_left_instruction_navigation_disposables(NUM_OF_DISPOSABLE_INSTALLATION_SCREENS) + test.verify(not waitForObjectExists(names.o_disposables_removal_confirm_button).enabled, " confirm button must not to be active") + verify_right_instruction_navigation_disposables(NUM_OF_DISPOSABLE_INSTALLATION_SCREENS) + test.verify(waitForObjectExists(names.o_disposables_removal_confirm_button).enabled ," confirm button must be active") + mouseClick(waitForObjectExists(names.o_disposables_removal_confirm_button)) + test.endSection() + + +def verify_post_treatment_review_parameters(): + """ + Method to verify post treatment review parameters and unit by default. + """ + test.startSection("verification of post treatment review parameters") + mouseClick(waitForObject(names.o_disposables_removal_backButton)) + treatment_review_text = waitForObjectExists(post_treatment_review_text_obj(config.TREATMENT_REVIEW_TITLE_TEXT)) + test.compare(treatment_review_text.text, config.TREATMENT_REVIEW_TITLE_TEXT, "{} screen is displayed".format(config.TREATMENT_REVIEW_TITLE_TEXT)) + utils.waitForGUI(0.1) + for parameter in config.POST_TREATMENT_REVIEW_SCREEN_PARAMETERS: + utility.scroll_to_zone(review_text(parameter), names.o_review_area) + parameter_text = waitForObjectExists(review_text(parameter)) + test.log("verification of parameter -> " + str(parameter)) + test.compare(parameter_text.text, parameter, "{} should be available under 'Treatment Review' screen".format(parameter)) + test.endSection() + + utility.scroll_to_zone(review_text(parameter), names.o_review_area, direction = "Top") + test.startSection("verification of post treatment review units") + + for parameter in config.POST_TREATMENT_REVIEW_SCREEN_PARAMETERS: + unit = config.POST_TREATMENT_REVIEW_SCREEN_UNITS[parameter] + unit_text = waitForObjectExists(review_text(unit)) + test.log("verification of unit for data -> " + str(parameter)) + test.compare(unit_text.text, unit, "{} should be available under 'Treatment Review' screen".format(unit)) + test.endSection() + + +def getting_patient_id_from_create_custom_treatment(patient_id): + """ + Method to fetch patient ID from create custom treatment in post treatment review + """ + test.startSection("Method for navigate to create custom treatment to set all parameters ") + hd_simulator.cmd_send_hd_operation_mode(op_mode = HDOpModes.MODE_TPAR.value , sub_mode = HDOpSubModes.SUBMODE_START.value) + mouseClick(waitForObject(names.o_input_patient_id)) + type(waitForObject(names.o_input_patient_id), patient_id) + mouseClick(waitForObject(names.o_confirm_button)) + test.endSection() + + +def verify_post_treatment_review_log_data(): + """ + Method to verify all the log values on review submode of post treatment + Here we are verifying 5 set of values to the review section based in edge condition. This section coveres log verification. + """ + test.startSection("Method to check all the values of parameters in review screen") + + for index in range (5): + + getting_patient_id_from_create_custom_treatment(config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Patient ID"][index]) + navigation_to_post_treatment() + + mouseClick(waitForObject(names.o_patientDisconnectionConfirm_Button)) + review_parameter_value = review_text(text = "Patient ID") + utility.scroll_to_zone(review_parameter_value, names.o_review_area, direction = "Top") + + hd_simulator.cmd_send_post_treatment_log_response(accepted = 1, reason = 0, + device_id = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Device ID"][index], + treatment_duration = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Treatment Duration"][index], + bood_flow_rate = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Blood Flow Rate"][index], + dialysate_flow_rate = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Dialysate Flow Rate"][index], + acid_concentrate_type = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Acid ConcentrateType"][index], + bicarbonate_concentrate_type = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Bicarbonate Concentrate Type"][index], + potassium_concentration = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Potassium Concentration"][index], + calcium_concentration = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Calcium Concentration"][index], + bicarbonate_concentration = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Bicarbonate Concentration"][index], + sodium_concentration = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Sodium Concentration"][index], + dialysate_temperature = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Dialysate Temperature"][index], + dialyzer_type = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Dialyzer Type"][index], + heparin_type = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Heparin Type"][index], + heparin_bolus_volume = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Heparin Bolus Volume"][index], + heparin_dispense_rate = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Heparin Dispense Rate"][index], + heparin_pre_stop = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Heparin Stop"][index], + treatment_start_date_time = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Treatment Start DateTime"][index], + treatment_end_date_time = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Treatment End DateTime"][index], + actual_treatment_duration = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Actual Treatment Duration"][index], + dialysate_volume_used = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Dialysate Volume Used"][index], + origin_uf_volume = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Actual UF Volume"][index], + target_uf_volume = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Target UF Volume"][index], + actual_uf_volume = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Actual UF Volume"][index], + saline_bolus_volume = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Saline Bolus Volume"][index], + heparin_delivered_volume = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Heparin Delivered Volume"][index], + water_sample_test_result = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Water Sample Test Result"][index], + origin_uf_rate = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Prescribed UF Rate"][index], + target_uf_rate = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Target UF Rate"][index], + actual_uf_rate = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Actual UF Rate"][index], + average_blood_flow = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Average Blood Flow"][index], + average_dialysate_flow = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Average Dialysate Flow"][index], + average_dialysate_temp = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Average Dialysate Temp"][index], + average_arterial_pressure = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Average Arterial Pressure"][index], + average_venous_pressure = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE["Average Venous Pressure"][index] + ) + + utils.waitForGUI(2) #adding delay for fetching effect. + + test.startSection("verification of post treatment review values for iteration -> "+str(index+1)) + test.log("###verification of post treatment UI data") + + for parameters_value in config.POST_TREATMENT_REVIEW_PARAMETER_RANGE.keys(): + parameter_set = config.POST_TREATMENT_REVIEW_PARAMETER_RANGE[parameters_value] + + if parameters_value == "Prescribed UF Rate": + review_parameter_value = review_text(text = "Average Venous Pressure") + utility.scroll_to_zone(zone = review_parameter_value, screen_object = names.o_review_area) + + if parameters_value == "Heparin Type": + review_parameter_value = review_text(text = config.HEPARIN_TYPE) + parameter_text = waitForObject(review_parameter_value) + test.log("verification of values for parameter ->" + parameters_value) + test.compare(config.HEPARIN_TYPE, parameter_text.text, "parameter value should be "+str(parameter_set[index])) + continue + + if parameters_value == "Bicarbonate Concentrate Type": + review_parameter_value = review_text(text = config.BICARBONATE_CONCENTRATE) + parameter_text = waitForObject(review_parameter_value) + test.log("verification of values for parameter ->" + parameters_value) + test.compare(config.BICARBONATE_CONCENTRATE, parameter_text.text, "parameter value should be "+str(parameter_set[index])) + continue + + if parameters_value == "Acid ConcentrateType": + review_parameter_value = review_text(text = config.ACID_CONCENTRATE[index]) + parameter_text = waitForObject(review_parameter_value) + test.log("verification of values for parameter ->" + parameters_value) + test.compare(config.ACID_CONCENTRATE[index], parameter_text.text, "parameter value should be "+str(parameter_set[index])) + continue + + if parameters_value == "Dialyzer Type": + review_parameter_value = review_text(text = config.DIALYZER_TYPE[index]) + parameter_text = waitForObject(review_parameter_value) + test.log("verification of values for parameter ->" + parameters_value) + test.compare(config.DIALYZER_TYPE[index], parameter_text.text, "parameter value should be "+str(parameter_set[index])) + continue + + if 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])) + 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 + + else: + if isinstance(parameter_set[index], float): + parameter_set[index] = ('%.3f' %parameter_set[index]) + test.log("verification of values for parameter" + str(parameter_to_scroll)) + parameter_to_scroll = str(parameter_set[index]) + if parameters_value == "Treatment Duration": + time_duration = builtins.int(utility.convert_seconds_into_min_and_sec(seconds=parameter_to_scroll, time_format="%M")) + if time_duration < 1 : + parameter_to_scroll = "0" + else: + 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 + 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 main(): + + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + + #navigate to post treatment screens + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_POST.value, sub_mode=PostTreatmentStates.HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE.value) + + verify_patient_disconnection_screens() + verify_disposables_screen() + + + navigation_to_post_treatment() + verify_post_treatment_review_parameters() + verify_post_treatment_review_log_data() + + utils.tstDone() +