Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -r8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab -r0130028593cbcfc6ec7e97af4b4c48f26b96898b --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 0130028593cbcfc6ec7e97af4b4c48f26b96898b) @@ -89,6 +89,8 @@ CREATERX = "Rx" VALIDATE = "Validate" CONFIRM = "Confirm" -NEXT ="Next" +NEXT = "Next" +RED_COLOR = "#c53b33" +WHITE_COLOR = "#fefefe" Index: suite_leahi/shared/scripts/configuration/navigation.py =================================================================== diff -u -r8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab -r0130028593cbcfc6ec7e97af4b4c48f26b96898b --- suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision 8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab) +++ suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision 0130028593cbcfc6ec7e97af4b4c48f26b96898b) @@ -39,6 +39,9 @@ def get_ini_value(conf_path: str , section: str, key: str): + """ + Method to get the advanced option from the System.conf file + """ path = Path(conf_path) if not path.exists(): raise FileNotFoundError(f"Not found: {path}") @@ -51,10 +54,6 @@ if not parser.has_option(section, key): raise KeyError(f"Key '{key}' not found in section [{section}]") return parser.get(section, key) - -# Example: -# value = get_ini_value("settings.conf", "database", "host") -# print(value) def navigation_pageIndicator_step(vStep_name): """ @@ -67,16 +66,15 @@ """ test.startSection("Method to navigation in the pretreatment page ") - stepcount = squish.waitForObjectExists(names.o_preTreatmentStack_repeater_Repeater) - Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) - squish.mouseClick(squish.waitForObject(Nextbutton)) - autoLoadbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text ="Auto Load") - squish.mouseClick(squish.waitForObject(autoLoadbutton)) - td_simulator.td_blood_set_auto_load_response(vRejectionReason = 0) - stepId = squish.waitForObjectExists(names.o_preTreatmentStack_stepIndicator_StepIndicator) - values = utility.findAllObjectsById(stepId, "_text") value = get_ini_value("/home/denali/Public/luis/config/configurations/Settings/System.conf", section ="AdvancedMode", key ="AdvancedMode") - if stepcount.count == 9: + if value == "0": + Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) + squish.mouseClick(squish.waitForObject(Nextbutton)) + autoLoadbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text ="Auto Load") + squish.mouseClick(squish.waitForObject(autoLoadbutton)) + td_simulator.td_blood_set_auto_load_response(vRejectionReason = 0) + stepId = squish.waitForObjectExists(names.o_preTreatmentStack_stepIndicator_StepIndicator) + values = utility.findAllObjectsById(stepId, "_text") for input_field in values[3:]: test.log(str(input_field.text)) if str(input_field.text) == "Water Sample": @@ -87,6 +85,11 @@ Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) squish.mouseClick(Nextbutton) else: + autoLoadbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text ="Auto Load") + squish.mouseClick(squish.waitForObject(autoLoadbutton)) + td_simulator.td_blood_set_auto_load_response(vRejectionReason = 0) + stepId = squish.waitForObjectExists(names.o_preTreatmentStack_stepIndicator_StepIndicator) + values = utility.findAllObjectsById(stepId, "_text") for input_field in values[3:]: test.log(str(input_field.text)) if str(input_field.text) == "Water Sample": Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab -r0130028593cbcfc6ec7e97af4b4c48f26b96898b --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 0130028593cbcfc6ec7e97af4b4c48f26b96898b) @@ -131,7 +131,6 @@ def verify_create_treatment_parameters(): test.startSection("Pre treatment parameters") navigation.navigation_pageIndicator_step(config.CREATERX) - # squish.mouseClick(names.o_PreTreatmentSampleStack_failContainer_WaterSampleContainer) squish.mouseClick(squish.waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry)) squish.waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry).text ="abcd" set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 60) @@ -169,7 +168,11 @@ vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 ) - squish.mouseClick(names.o_preTreatmentStack_confirmButton_ConfirmButton) + + # confirm = squish.waitFor(lambda:object.exists(names.o_preTreatmentStack_confirmButton_ConfirmButton), 3000) + # step_id = squish.waitForObjectExists(names.o_preTreatmentStack_PreTreatmentStack) + squish.mouseClick(names.o_preTreatmentStack_confirmButton_ConfirmButton) + test.endSection() def findAllObjectsById(parent, target_id): @@ -276,4 +279,4 @@ return squish.waitForObject(names_dict, timeout_ms).text except LookupError: test.fail("ERROR : " + error_message) - return None \ No newline at end of file + return None Index: suite_leahi/shared/scripts/ga_formater.py =================================================================== diff -u --- suite_leahi/shared/scripts/ga_formater.py (revision 0) +++ suite_leahi/shared/scripts/ga_formater.py (revision 0130028593cbcfc6ec7e97af4b4c48f26b96898b) @@ -0,0 +1,93 @@ +import re + +def format_ui_objects_extended(text): + lines = text.strip().split('\n') + formatted_lines = [] + + for line in lines: + # Extract the variable name and the content inside the curly braces + match = re.match(r'^(.*?)\s*=\s*\{(.*)\}', line.strip()) + if match: + var_name = match.group(1).strip() + content = match.group(2).strip() + + # Extract individual key-value pairs + items = [item.strip() for item in content.split(',') if item.strip()] + + # Map specific keys for alignment + parts = {"container": "", "id": "", "objectName": "", "type": "", "unnamed": ""} + for item in items: + if '"container"' in item: parts["container"] = item + "," + elif '"id"' in item: parts["id"] = item + "," + elif '"objectName"' in item: parts["objectName"] = item + "," + elif '"type"' in item: parts["type"] = item + "," + elif '"unnamed"' in item: parts["unnamed"] = item + + # Construction with specific column offsets: + # 1. '=' at 45 (index 44) + line_out = f"{var_name:<44}= {{" + + # 2. 'container' starts immediately after '{ ' + line_out += parts["container"] + + # 3. 'id' at 105 (index 104) + line_out = line_out.ljust(104) + parts["id"] + + # 4. 'objectName' at 129 (index 128) + line_out = line_out.ljust(128) + parts["objectName"] + + # 5. 'type' at 173 (index 172) + line_out = line_out.ljust(172) + parts["type"] + + # 6. 'unnamed' at 205 (index 204) + line_out = line_out.ljust(204) + parts["unnamed"] + + # 7. '}' at 221 (index 220) + line_out = line_out.ljust(220) + "}" + + formatted_lines.append(line_out) + + return '\n'.join(formatted_lines) + +# Input data +raw_text = """ +o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_PreTreatmentSampleStack", "type": "PreTreatmentWaterSample", "visible": True} +o_PreTreatmentSampleStack_failContainer_WaterSampleContainer = {"container": o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample, "id": "_failContainer", "type": "WaterSampleContainer", "unnamed": 1, "visible": True} + +o_arterialWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_arterialWindow", "type": "LabelUnitValueAdjuster", "visible": True} +o_venousWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_venousWindow", "type": "LabelUnitValueAdjuster", "visible": True} +o_venousAsymmetricWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_venousAsymmetricWindow", "type": "LabelUnitValueAdjuster", "visible": True} +o_tmpWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_tmpWindow", "type": "LabelUnitValueAdjuster", "visible": True} +o_PreTreatmentSampleStack_button_TouchRect = {"container": o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample, "id": "_button", "occurrence": 2, "type": "TouchRect", "unnamed": 1, "visible": True} +o_preTreatmentStack_repeater_Repeater = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "repeater", "type": "Repeater", "unnamed": 1, "visible": True} +o_preTreatmentStack_gridSteps_Grid = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_gridSteps", "type": "Grid", "unnamed": 1, "visible": True} +o_preTreatmentStack_gridSteps_Grid_2 = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_gridSteps", "occurrence": 2, "type": "Grid", "unnamed": 1, "visible": True} +o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjusterCustom = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_bpMeasurementIntervalControl", "type": "ValueAdjusterCustom", "unnamed": 1} + +o_preTreatmentStack_Validate_Text = {"container": o_preTreatmentStack_PreTreatmentStack, "text": "Validate", "type": "Text", "unnamed": 1, "visible": True} +o_notification_bar ={"container": o_Overlay, "objectName": "NotificationBar", "type": "NotificationBarSmall"} +o_treatmentHome_editButton_IconButton = {"container": mainTreatmentScreen, "id": "_editButton", "type": "IconButton", "unnamed": 1 } +o_treatmentHome_treatmentPressures_TreatmentPressures = {"container": mainTreatmentScreen, "objectName": "treatmentPressures", "type": "TreatmentPressures", "visible": True} +o_valueAdjuster_ValueAdjuster = {"container": o_Overlay, "objectName": "_valueAdjuster", "type": "ValueAdjuster", "visible": True} +o_treatmentHome_editButton_IconButton_2 = {"container": mainTreatmentScreen, "id": "_editButton", "type": "IconButton", "unnamed": 1 } +o_treatmentHome_treatmentFlows_TreatmentFlows = {"container": mainTreatmentScreen, "objectName": "treatmentFlows", "type": "TreatmentFlows", "visible": True} +o_dialysateFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateFlowRate", "type": "LabelUnitValueAdjuster", "visible": True} +o_bloodFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_bloodFlowRate", "type": "LabelUnitValueAdjuster", "visible": True} +o_dialysateTemperature_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateTemperature", "type": "LabelUnitValueAdjuster", "visible": True} +o_treatmentHome_upArrowIcon_ArrowButton = {"container": mainTreatmentScreen, "objectName": "upArrowIcon", "type": "ArrowButton", "visible": True} +o_treatmentHome_downArrowIcon_ArrowButton = {"container": mainTreatmentScreen, "objectName": "downArrowIcon", "type": "ArrowButton", "visible": True} +o_treatmentHome_notification_NotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "_notification", "type": "NotificationBarSmall"} +o_ufVolumeRemoved_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeRemoved", "type": "LabelUnitText", "visible": True} +o_ufVolumeGoal_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeGoal", "type": "LabelUnitText", "visible": True} +o_timeElapsed_LabelUnitText = {"container": o_Overlay, "objectName": "_timeElapsed", "type": "LabelUnitText", "visible": True} +o_newTreatmentDuration_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_newTreatmentDuration", "type": "LabelUnitValueAdjuster", "visible": True} +o_preTreatmentStack_confirmButton_ConfirmButton = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_confirmButton", "type": "ConfirmButton", "visible": True} +o_preTreatmentStack_titleBar_StepNavigationTitleBar = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_titleBar", "type": "StepNavigationTitleBar", "unnamed": 1} +o_preTreatmentStack_mouseArea_MouseArea = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_mouseArea", "occurrence": 2, "type": "MouseArea", "unnamed": 1, "visible": True} +o_ufRate_LabelUnitText = {"container": o_Overlay, "objectName": "_ufRate", "type": "LabelUnitText", "visible": True} +o_newTreatmentDuration_LabelUnitText = {"container": o_Overlay, "objectName": "_newTreatmentDuration", "type": "LabelUnitText", "visible": True} +# o_treatmentHome_upArrowIcon_ArrowButton_2 = {"container": mainTreatmentScreen, "objectName": "upArrowIcon", "occurrence": 2, "type": "ArrowButton", "visible": True} + +""" + +print(format_ui_objects_extended(raw_text)) Index: suite_leahi/shared/scripts/ga_formater.py~ =================================================================== diff -u --- suite_leahi/shared/scripts/ga_formater.py~ (revision 0) +++ suite_leahi/shared/scripts/ga_formater.py~ (revision 0130028593cbcfc6ec7e97af4b4c48f26b96898b) @@ -0,0 +1,60 @@ +import re + +def format_ui_objects_extended(text): + lines = text.strip().split('\n') + formatted_lines = [] + + for line in lines: + # Extract the variable name and the content inside the curly braces + match = re.match(r'^(.*?)\s*=\s*\{(.*)\}', line.strip()) + if match: + var_name = match.group(1).strip() + content = match.group(2).strip() + + # Extract individual key-value pairs + items = [item.strip() for item in content.split(',') if item.strip()] + + # Map specific keys for alignment + parts = {"container": "", "id": "", "objectName": "", "type": "", "unnamed": ""} + for item in items: + if '"container"' in item: parts["container"] = item + "," + elif '"id"' in item: parts["id"] = item + "," + elif '"objectName"' in item: parts["objectName"] = item + "," + elif '"type"' in item: parts["type"] = item + "," + elif '"unnamed"' in item: parts["unnamed"] = item + + # Construction with specific column offsets: + # 1. '=' at 45 (index 44) + line_out = f"{var_name:<44}= {{" + + # 2. 'container' starts immediately after '{ ' + line_out += parts["container"] + + # 3. 'id' at 105 (index 104) + line_out = line_out.ljust(104) + parts["id"] + + # 4. 'objectName' at 129 (index 128) + line_out = line_out.ljust(128) + parts["objectName"] + + # 5. 'type' at 173 (index 172) + line_out = line_out.ljust(172) + parts["type"] + + # 6. 'unnamed' at 205 (index 204) + line_out = line_out.ljust(204) + parts["unnamed"] + + # 7. '}' at 221 (index 220) + line_out = line_out.ljust(220) + "}" + + formatted_lines.append(line_out) + + return '\n'.join(formatted_lines) + +# Input data +raw_text = """ +o_Row_Object = {"id": "_row", "type": "Row", "unnamed": 1 } +o_SettingsBase_SettingsInstitutionalRecord = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsInstitutionalRecord", } +o_SettingsInstitutionalRecord_BackButton = {"container": o_SettingsBase_SettingsInstitutionalRecord, "objectName": + +""" + +print(format_ui_objects_extended(raw_text)) Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -r8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab -r0130028593cbcfc6ec7e97af4b4c48f26b96898b --- suite_leahi/shared/scripts/names.py (.../names.py) (revision 8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 0130028593cbcfc6ec7e97af4b4c48f26b96898b) @@ -225,37 +225,39 @@ o_preTreatmentStack_stepIndicator_StepIndicator = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_stepIndicator", "type": "StepIndicator", "unnamed": 1 } #end treatement -o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_PreTreatmentSampleStack", "type": "PreTreatmentWaterSample", "visible": True} -o_PreTreatmentSampleStack_failContainer_WaterSampleContainer = {"container": o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample, "id": "_failContainer", "type": "WaterSampleContainer", "unnamed": 1, "visible": True} -# o_treatmentHome_editButton_IconButton = {"container": mainTreatmentScreen, "id": "_editButton", "occurrence": 3, "type": "IconButton", "unnamed": 1, "visible": True} -o_arterialWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_arterialWindow", "type": "LabelUnitValueAdjuster", "visible": True} -o_venousWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_venousWindow", "type": "LabelUnitValueAdjuster", "visible": True} -o_venousAsymmetricWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_venousAsymmetricWindow", "type": "LabelUnitValueAdjuster", "visible": True} -o_tmpWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_tmpWindow", "type": "LabelUnitValueAdjuster", "visible": True} -o_PreTreatmentSampleStack_button_TouchRect = {"container": o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample, "id": "_button", "occurrence": 2, "type": "TouchRect", "unnamed": 1, "visible": True} -o_preTreatmentStack_repeater_Repeater = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "repeater", "type": "Repeater", "unnamed": 1, "visible": True} -o_preTreatmentStack_gridSteps_Grid = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_gridSteps", "type": "Grid", "unnamed": 1, "visible": True} -o_preTreatmentStack_gridSteps_Grid_2 = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_gridSteps", "occurrence": 2, "type": "Grid", "unnamed": 1, "visible": True} -o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjusterCustom = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_bpMeasurementIntervalControl", "type": "ValueAdjusterCustom", "unnamed": 1} -o_preTreatmentStack_confirmButton_ConfirmButton = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_confirmButton", "type": "ConfirmButton", "visible": True} -o_preTreatmentStack_Validate_Text = {"container": o_preTreatmentStack_PreTreatmentStack, "text": "Validate", "type": "Text", "unnamed": 1, "visible": True} -o_notification_bar ={"container": o_Overlay, "objectName": "NotificationBar", "type": "NotificationBarSmall"} -# o_treatmentHome_iconImage_Image = {"container": mainTreatmentScreen, "id": "_iconImage", "occurrence": 2, "source": "qrc:/images/iEdit", "type": "Image", "unnamed": 1, "visible": True} -o_treatmentHome_editButton_IconButton = {"container": mainTreatmentScreen, "id": "_editButton", "type": "IconButton", "unnamed": 1 } -o_treatmentHome_treatmentPressures_TreatmentPressures = {"container": mainTreatmentScreen, "objectName": "treatmentPressures", "type": "TreatmentPressures", "visible": True} -o_valueAdjuster_ValueAdjuster = {"container": o_Overlay, "objectName": "_valueAdjuster", "type": "ValueAdjuster", "visible": True} -o_treatmentHome_editButton_IconButton_2 = {"container": mainTreatmentScreen, "id": "_editButton", "type": "IconButton", "unnamed": 1 } -o_treatmentHome_treatmentFlows_TreatmentFlows = {"container": mainTreatmentScreen, "objectName": "treatmentFlows", "type": "TreatmentFlows", "visible": True} -o_dialysateFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateFlowRate", "type": "LabelUnitValueAdjuster", "visible": True} -o_bloodFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_bloodFlowRate", "type": "LabelUnitValueAdjuster", "visible": True} -o_dialysateTemperature_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateTemperature", "type": "LabelUnitValueAdjuster", "visible": True} -o_treatmentHome_upArrowIcon_ArrowButton = {"container": mainTreatmentScreen, "objectName": "upArrowIcon", "type": "ArrowButton", "visible": True} -o_treatmentHome_downArrowIcon_ArrowButton = {"container": mainTreatmentScreen, "objectName": "downArrowIcon", "type": "ArrowButton", "visible": True} -o_treatmentHome_notification_NotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "_notification", "type": "NotificationBarSmall"} -o_ufVolumeRemoved_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeRemoved", "type": "LabelUnitText", "visible": True} -o_ufVolumeGoal_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeGoal", "type": "LabelUnitText", "visible": True} -o_timeElapsed_LabelUnitText = {"container": o_Overlay, "objectName": "_timeElapsed", "type": "LabelUnitText", "visible": True} -o_newTreatmentDuration_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_newTreatmentDuration", "type": "LabelUnitValueAdjuster", "visible": True} -# o_treatmentHome_upArrowIcon_ArrowButton_2 = {"container": mainTreatmentScreen, "objectName": "upArrowIcon", "occurrence": 2, "type": "ArrowButton", "visible": True} +o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_PreTreatmentSampleStack", "type": "PreTreatmentWaterSample" } +o_PreTreatmentSampleStack_failContainer_WaterSampleContainer = {"container": o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample, "id": "_failContainer", "type": "WaterSampleContainer", "unnamed": 1 } +o_arterialWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_arterialWindow", "type": "LabelUnitValueAdjuster" } +o_venousWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_venousWindow", "type": "LabelUnitValueAdjuster" } +o_venousAsymmetricWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_venousAsymmetricWindow", "type": "LabelUnitValueAdjuster" } +o_tmpWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_tmpWindow", "type": "LabelUnitValueAdjuster" } +o_PreTreatmentSampleStack_button_TouchRect = {"container": o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample, "id": "_button", "type": "TouchRect", "unnamed": 1 } +o_preTreatmentStack_repeater_Repeater = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "repeater", "type": "Repeater", "unnamed": 1 } +# o_preTreatmentStack_gridSteps_Grid = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_gridSteps", "type": "Grid", "unnamed": 1, "visible": True} +# o_preTreatmentStack_gridSteps_Grid_2 = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_gridSteps", "occurrence": 2, "type": "Grid", "unnamed": 1, "visible": True} +o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjusterCustom = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_bpMeasurementIntervalControl", "type": "ValueAdjusterCustom", "unnamed": 1 } +# o_preTreatmentStack_Validate_Text = {"container": o_preTreatmentStack_PreTreatmentStack, "text": "Validate", "type": "Text", "unnamed": 1, "visible": True} +o_notification_bar = {"container": o_Overlay, "objectName": "NotificationBar", "type": "NotificationBarSmall" } +o_treatmentHome_editButton_IconButton = {"container": mainTreatmentScreen, "id": "_editButton", "type": "IconButton", "unnamed": 1 } +o_treatmentHome_treatmentPressures_TreatmentPressures = {"container": mainTreatmentScreen, "objectName": "treatmentPressures", "type": "TreatmentPressures" } +o_valueAdjuster_ValueAdjuster = {"container": o_Overlay, "objectName": "_valueAdjuster", "type": "ValueAdjuster", } +o_treatmentHome_editButton_IconButton_2 = {"container": mainTreatmentScreen, "id": "_editButton", "type": "IconButton", "unnamed": 1 } +o_treatmentHome_treatmentFlows_TreatmentFlows = {"container": mainTreatmentScreen, "objectName": "treatmentFlows", "type": "TreatmentFlows" } +o_dialysateFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateFlowRate", "type": "LabelUnitValueAdjuster" } +o_bloodFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_bloodFlowRate", "type": "LabelUnitValueAdjuster" } +o_dialysateTemperature_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateTemperature", "type": "LabelUnitValueAdjuster" } +o_treatmentHome_upArrowIcon_ArrowButton = {"container": mainTreatmentScreen, "objectName": "upArrowIcon", "type": "ArrowButton" } +o_treatmentHome_downArrowIcon_ArrowButton = {"container": mainTreatmentScreen, "objectName": "downArrowIcon", "type": "ArrowButton" } +o_treatmentHome_notification_NotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "_notification", "type": "NotificationBarSmall" } +o_ufVolumeRemoved_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeRemoved", "type": "LabelUnitText" } +o_ufVolumeGoal_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeGoal", "type": "LabelUnitText" } +o_timeElapsed_LabelUnitText = {"container": o_Overlay, "objectName": "_timeElapsed", "type": "LabelUnitText" } +o_newTreatmentDuration_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_newTreatmentDuration", "type": "LabelUnitValueAdjuster" } +o_preTreatmentStack_confirmButton_ConfirmButton = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_confirmButton", "type": "ConfirmButton" , "visible": True } +# o_preTreatmentStack_titleBar_StepNavigationTitleBar = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_titleBar", "type": "StepNavigationTitleBar", "unnamed": 1} +# o_preTreatmentStack_mouseArea_MouseArea = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_mouseArea", "occurrence": 2, "type": "MouseArea", "unnamed": 1, "visible": True} +o_ufRate_LabelUnitText = {"container": o_Overlay, "objectName": "_ufRate", "type": "LabelUnitText" } +o_newTreatmentDuration_LabelUnitText = {"container": o_Overlay, "objectName": "_newTreatmentDuration", "type": "LabelUnitText" } + Index: suite_leahi/tst_edit_parameters/test.py =================================================================== diff -u -r3092de4d51953039ef1a683b8f8708f798996afe -r0130028593cbcfc6ec7e97af4b4c48f26b96898b --- suite_leahi/tst_edit_parameters/test.py (.../test.py) (revision 3092de4d51953039ef1a683b8f8708f798996afe) +++ suite_leahi/tst_edit_parameters/test.py (.../test.py) (revision 0130028593cbcfc6ec7e97af4b4c48f26b96898b) @@ -1,5 +1,44 @@ -# -*- coding: utf-8 -*- +#Subject/Title: LDT-2819 Edit Treatment Parameters During Treatment - SW - 02 - Edit Treatment Parameters During Treatment - Q&R +# Functionalities: Testing all functionalities of Edit treatement parameter in the main treatment screen +#Steps +# Pressure Edit +# 1 Navigate to create treatement set all the parameters and navigate to the main treatement page +# 2 Click on Pressures Edit ->Edit the parameters in the pressure popup and perform confirm +# 3 Send the rejection reasom from FW and verify the message in the UI +# 4 Send the No Rejection from the FW and verify the popup closed and Fw recieved the values +# +# Saline Edit +# 1 Send saline data to main treatment container +# 2 Open Saline edit settings +# 3.Verify Saline Bolus target volume set is populated on saline edit popup +# 4 Change settings and confirm +# 5 Send the rejection reason 1 and populate the error message on the popup +# 6 Send the rejection reason 0 and verify the popup closes and verify FW recieves the values +# Treatement parameters +# 1 Send set point low values i.e blood flow,dialysate flow and dialysate temp low value +# 2 Verify Blood flow rate , dialysate flow rate, dialysate temp are colored red +# 3 Perform any of the arrows and value should change to min and color should change to white +# 4 Verify the rejection reason 1 and check the error message in the UI +# 5 Verify the rejection reason 0 and check FW recieves the values +# 6 On Main treatment screen send values in range and test arrow buttons for each Blood flow, Dialysate flow, dialystae temp +# ex. blood flow set to 70 (Step value is 10) +# Press the up arrow and confirm the fw receives the incremented value 80 +# Test rejection -> rejection banner on maintreatment screen +# 7 Verify the values for non step value for blood flow,dialysate flow and dialysate temp +# +# Treatment Duration Edit +# 1 Set a main treatment duration, elapsed time, Ultrafiltration Set volume, ultrafiltration volume delivered +# 2 Send Param Ranges treatment range ex 50 - 300 min +# 3 Click the treatment duration edit button. +# 4 Verify Top 3 parameters (Volume Delivered, Set Volume, Elapsed time are updated +# 5 Verify min and max values for New Treatment duration and perform continue button +# 6 Send rejection reason 1 and check the message in the popup +# 7 Send the rejection reason 0 and verify the popup closes and verify the fw recieves values +# 8 Verify the Duration Edit FW Response value reflect on the next screen +# 9 Verify the rejection reason 1 and check the error message in the UI +# 10 Verify the rejection reason 0 and check FW recieves the values + import names import squish from leahi_dialin.ui import utils @@ -14,11 +53,20 @@ from leahi_dialin.protocols import CAN td =TD_Messaging() +can_interface = td.can_interface ArtWindow = None -Venouspressurewindow ="0" -venouspressurelimitasymetric ="0" -tmppressurelimut ="0" -salineBolusvalue ="0" +Venouspressurewindow = None +venouspressurelimitasymetric = None +tmppressurelimut = None +saline = None +bloodflowrate = None +dialysateflow = None +dialysatetemp = None +bloodFlowrate = 0 +dialtemperature = None +dialflow = 0 +durationvalue = 0 +durationconfirm = 0 @@ -50,9 +98,10 @@ global dialysateflow dialysateflow = state - val,self.index = conversions.bytearray_to_integer( message, self. Index) - global dialysatetemperature - dialysatetemperature = val + val,self.index = conversions.bytearray_to_integer( message, self. index) + global dialysatetemp + test.log(val) + dialysatetemp = val def handle_pressure_request( message, timestamp = 0.0): @@ -66,9 +115,6 @@ state,index = conversions.bytearray_to_integer( message, index) global ArtWindow ArtWindow = state - test.log("Inside function") - test.log(str(ArtWindow)) - test.log(str(state)) state,index = conversions.bytearray_to_integer( message, index) global Venouspressurewindow @@ -82,32 +128,51 @@ global tmppressurelimut tmppressurelimut = state -def handle_bloodflow_request(): +def handle_bloodflow_request( message, timestamp = 0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ message = message['message'] index = MsgFieldPositions.START_POS_FIELD_1 + state,index = conversions.bytearray_to_integer( message, index) - global bloodflow - bloodflow = state + global bloodFlowrate + bloodFlowrate = state - -def main(): - can_interface = td.can_interface - global Venouspressurewindow +def handle_dialflow_request(message, timestamp = 0.0): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + state,index = conversions.bytearray_to_integer( message, index) + global dialflow + dialflow = state - if can_interface is not None: - channel_id = CAN.DenaliChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST.value - can_interface.register_receiving_publication_function(channel_id, - message_id, - handle_pressure_request) +def handle_dialtmp_request(message, timestamp = 0.0): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + val,index = conversions.bytearray_to_float( message, index) + global dialtemperature + dialtemperature = val +def handle_duration_request(message,timestamp =0.0): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 - utils.tstStart(__file__) - startApplication(config.AUT_NAME) - td.td_operation_mode(TDOpModes.MODE_STAN.value) - # mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect)) - # td.td_operation_mode(TDOpModes.MODE_PRET.value) - # utility.verify_create_treatment_parameters() + state,index = conversions.bytearray_to_integer( message, index) + global durationvalue + durationvalue = state + + +def handle_duration_confirm_request(message,timestamp =0.0): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + + state,index = conversions.bytearray_to_integer( message, index) + global durationconfirm + durationconfirm = state + +def check_pressure_edit_maintreatment(): + test.startSection("Pressure Edit") td.td_tx_state( TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, 0 , 0 , @@ -131,22 +196,30 @@ tmp_min = -640 , tmp_max = 210) - # mouseClick(waitForObject(names.o_treatmentHome_editButton_IconButton)) pressureEdit = waitForObject(names.o_treatmentHome_treatmentPressures_TreatmentPressures) - parent = utility.findObjectById(pressureEdit, "_editButton") - mouseClick(parent) - test.log("Check pressure edit values") - #check the values in edit pressure - + pressureEditButton = utility.findObjectById(pressureEdit, "_editButton") + mouseClick(pressureEditButton) + arterialwindow_value = waitForObject(names.o_arterialWindow_LabelUnitValueAdjuster) + arterial_value =arterialwindow_value.value + test.log(str(arterial_value)) venouswindow_value = waitForObject(names.o_venousWindow_LabelUnitValueAdjuster) - test.log(str(venouswindow_value.value)) + venous_value = venouswindow_value.value + test.log(str(venous_value)) tmpwindow_value = waitForObject(names.o_tmpWindow_LabelUnitValueAdjuster) - test.log(str(tmpwindow_value.value)) + tmp_value =tmpwindow_value.value + test.log(str(tmp_value)) utility.set_value_based_on_target(names.o_arterialWindow_LabelUnitValueAdjuster,80) arterialwindow_value = waitForObject(names.o_arterialWindow_LabelUnitValueAdjuster) - Arterial_Value =arterialwindow_value.value + change_arterialwindow_value =arterialwindow_value.value + test.log(str(change_arterialwindow_value)) utility.set_value_based_on_target(names.o_venousWindow_LabelUnitValueAdjuster,60) + venouswindow_value = waitForObject(names.o_venousWindow_LabelUnitValueAdjuster) + change_venouswindow_value =venouswindow_value.value + test.log(str(change_venouswindow_value)) utility.set_value_based_on_target(names.o_tmpWindow_LabelUnitValueAdjuster,100) + tmpwindow_value = waitForObject(names.o_tmpWindow_LabelUnitValueAdjuster) + change_tmpwindow_value =tmpwindow_value.value + test.log(str(change_tmpwindow_value)) #rejection reason is 1 payload = conversions.integer_to_bytearray(0) @@ -163,8 +236,6 @@ # handle sent messages from UI mouseClick(waitForObject(names.o_confirmButton_TouchRect)) - - #rejection reason 0 payload = conversions.integer_to_bytearray(1) payload += conversions.integer_to_bytearray(0) @@ -174,19 +245,20 @@ is_pure_data = False, has_parameters = True, parameters_payload= payload) - - global ArtWindow - test.verify(waitFor( lambda: ArtWindow == 10, 5000), "Testing lambda this should fail") - test.verify(waitFor( lambda: ArtWindow == arterialwindow_value.value, 5000), "Testing FW received Arterial Window Value") - test.log("Post waitfor() Verify ArtWindow: ") - test.log(str(ArtWindow)) - test.log(str(arterialwindow_value.value)) - - test.verify(Venouspressurewindow == venouswindow_value.value ) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_pressure_request) + test.verify(waitFor( lambda: ArtWindow == change_arterialwindow_value, 5000), "Testing FW received Arterial Window Value") + test.verify(waitFor( lambda: Venouspressurewindow == change_venouswindow_value,5000 ), "Testing Fw received Venous Window values") + test.verify(waitFor( lambda: tmppressurelimut == change_tmpwindow_value,5000 ), "Testing Fw received temp Window values") pressurepopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) test.compare(pressurepopup, True, "Popup is not present") + test.endSection() - +def check_saline_edit_maintreatment(): test.startSection("Saline data") td.td_saline( 100 , # target_volume @@ -199,7 +271,9 @@ fluidbolusvolume_value = waitForObject(names.o_valueAdjuster_ValueAdjuster) test.log(str(fluidbolusvolume_value.value)) utility.set_value_based_on_target(names.o_valueAdjuster_ValueAdjuster,200) - + change_fluidbolusvolume_value = waitForObject(names.o_valueAdjuster_ValueAdjuster).value + test.log(str(change_fluidbolusvolume_value)) + #saline rejection reason is 1 payload = conversions.integer_to_bytearray(0) payload += conversions.integer_to_bytearray(1) td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_BOLUS_VOLUME_CHANGE_RESPONSE.value, @@ -212,8 +286,6 @@ rejectionReason = utility.get_object_from_names(names.o_notification_bar) test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) #rejection reason 0 - - mouseClick(waitForObject(names.o_confirmButton_TouchRect)) payload = conversions.integer_to_bytearray(1) payload += conversions.integer_to_bytearray(0) @@ -231,39 +303,51 @@ message_id, handle_saline_request) - # test.log(str(salineBolusvalue)) + test.verify(waitFor( lambda: saline == change_fluidbolusvolume_value, 5000), "Testing FW received Bolus volumeValue") salinepopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) test.compare(salinepopup, True, "Popup is not present") - #check the recieved values + test.endSection() + +def check_treatement_edit_maintreatment(): test.startSection("Treatment Parameters") td.td_treatment_set_points( blood_flow = 42, dialysate_flow = 43, dialysate_temp = 49) - test.log("Sample") treatmentEdit = waitForObject(names.o_treatmentHome_treatmentFlows_TreatmentFlows) treatmentEditbutton = utility.findObjectById(treatmentEdit, "_editButton") mouseClick(treatmentEditbutton) bloodFlow = waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster) bloodflowvalue = utility.findObjectById(bloodFlow, "_valueAdjuster") test.log(str(bloodflowvalue.value)) - test.log(str(waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + bloodflowcolor = waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(bloodflowcolor),config.RED_COLOR,"Blood flow text color should be:"+str(config.RED_COLOR)) utility.set_value_based_on_target(names.o_bloodFlowRate_LabelUnitValueAdjuster,"50") - test.log(str(bloodflowvalue.value)) - test.log(str(waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + changedbloodflowvalue = bloodflowvalue.value + test.log(str(changedbloodflowvalue)) + changedbloodflowcolor = waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(changedbloodflowcolor), config.WHITE_COLOR, "Blood Flow text color changed to"+ str(config.WHITE_COLOR)) + #dialysate flow dialysateFlow = waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster) dialysateflowvalue = utility.findObjectById(dialysateFlow, "_valueAdjuster") test.log(str(dialysateflowvalue.value)) - test.log(str(waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + dialysateflowcolor = waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(dialysateflowcolor),config.RED_COLOR,"Dialysate flow text color should be"+str(config.RED_COLOR)) utility.set_value_based_on_target(names.o_dialysateFlowRate_LabelUnitValueAdjuster,"50") - test.log(str(dialysateflowvalue.value)) - test.log(str(waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + changeddialysateflowvalue =dialysateflowvalue.value + test.log(str(changeddialysateflowvalue)) + changeddialysateflowcolor = waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(changeddialysateflowcolor),config.WHITE_COLOR,"Dialysate flow text color changed to"+str(changeddialysateflowcolor)) + #dialysate temp dialysateTemp = waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster) dialysatetempvalue = utility.findObjectById(dialysateTemp, "_valueAdjuster") test.log(str(dialysatetempvalue.value)) - test.log(str(waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name)) + dialysatetempcolor = waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(dialysatetempcolor),config.RED_COLOR,"Dialysate temp color should be"+str(dialysatetempcolor)) utility.set_value_based_on_target(names.o_dialysateTemperature_LabelUnitValueAdjuster,"38") - test.log(str(dialysatetempvalue.value)) - test.log(str(waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name)) + changedialysatetemp = dialysatetempvalue.value + test.log(str(changedialysatetemp)) + changeddialysatetempcolor =waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name + test.compare(str(changeddialysatetempcolor),config.WHITE_COLOR,"Dialysate temp text color changed to"+str(config.WHITE_COLOR)) #rejection reason is 1 payload = conversions.integer_to_bytearray(0) payload += conversions.integer_to_bytearray(1) @@ -293,10 +377,13 @@ message_id, handle_treatment_request) - # test.log(str(salineBolusvalue)) + test.verify(waitFor( lambda: bloodflowrate == changedbloodflowvalue, 5000), "Testing FW received blood flow Value") + test.verify(waitFor( lambda: dialysateflow == changeddialysateflowvalue, 5000), "Testing FW received dialysate flow Value") + # test.verify(waitFor( lambda: dialysatetemp == changedialysatetemp, 5000), "Testing FW received dialysate temp Value") treatmentpopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) test.compare(treatmentpopup, True, "Popup is not present") test.endSection() + test.startSection("Main treatment screen check the set points") td.td_treatment_set_points( blood_flow = 70, dialysate_flow = 70, @@ -305,51 +392,85 @@ bloodflowUpArrow = waitForObject(names.o_blood_flow_value) bloodflowUpArrowbutton = utility.findObjectById(bloodflowUpArrow,"_upArrowIcon") mouseClick(bloodflowUpArrowbutton) + bloodFlow = utility.get_object_from_names(names.o_blood_flow_value) + bloodFlow_properties = object.properties(bloodFlow) + changedbloodflow = bloodFlow_properties["value"] + + # handle_bloodflow_request(MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_REQUEST.value) + test.verify(waitFor( lambda: bloodFlowrate == changedbloodflow+10, 10000), "Testing FW received blood flow Value in main treatment screen") + + bloodflowdownArrowbutton = utility.findObjectById(bloodflowUpArrow,"_downArrowIcon") + mouseClick(bloodflowdownArrowbutton) + bloodFlow = utility.get_object_from_names(names.o_blood_flow_value) + bloodFlow_properties = object.properties(bloodFlow) + changedbloodflow = bloodFlow_properties["value"] if can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, handle_bloodflow_request) - - #check the value incremented in blood flow + test.verify(waitFor( lambda: bloodFlowrate == changedbloodflow-10, 5000), "Testing FW received blood flow Value in main treatment screen") - bloodflowdownArrowbutton = utility.findObjectById(bloodflowUpArrow,"_downArrowIcon") - mouseClick(bloodflowdownArrowbutton) - #check the decremented value - dialysateflowuparrow = waitForObject(names.o_dial_flow_value) dialysateflowuparrowbutton = utility.findObjectById(dialysateflowuparrow,"_upArrowIcon") mouseClick(dialysateflowuparrowbutton) + dialFlow = utility.get_object_from_names(names.o_dial_flow_value) + dialFlow_properties = object.properties(dialFlow) + changeddialflow = dialFlow_properties["value"] if can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_DIALYSATE_FLOW_CHANGE_RESPONSE.value + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_FLOW_CHANGE_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, - handle_bloodflow_request) + handle_dialflow_request) - #check the value incremented in dialysate flow value + test.verify(waitFor( lambda: dialflow == changeddialflow+5, 10000), "Testing FW received dial flow Value in main treatment screen") - dialysateflowdownArrowbutton = utility.findObjectById(dialysateflowuparrow,"_downArrowIcon") - mouseClick(dialysateflowdownArrowbutton) - #check the decremented value - - dialysatetempuparrow = waitForObject(names.o_dial_tmp_value) - dialysatetempuparrowbutton = utility.findObjectById(dialysatetempuparrow,"_upArrowIcon") - mouseClick(dialysatetempuparrowbutton) + dialysateflowdownarrowbutton = utility.findObjectById(dialysateflowuparrow,"_downArrowIcon") + mouseClick(dialysateflowdownarrowbutton) + dialFlow = utility.get_object_from_names(names.o_dial_flow_value) + dialFlow_properties = object.properties(dialFlow) + changeddialflow = dialFlow_properties["value"] if can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_DIALYSATE_TEMPERATURE_CHANGE_RESPONSE.value + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_FLOW_CHANGE_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, - handle_bloodflow_request) + handle_dialflow_request) - #check the value incremented in dialysate flow value + test.verify(waitFor( lambda: dialflow == changeddialflow-20, 10000), "Testing FW received dial flow Value in main treatment screen") - dialysatetempdownArrowbutton = utility.findObjectById(dialysatetempuparrow,"_downArrowIcon") - mouseClick(dialysatetempdownArrowbutton) + dialysatetmpuparrow = waitForObject(names.o_dial_tmp_value) + dialysatetmpuparrowbutton = utility.findObjectById(dialysatetmpuparrow,"_upArrowIcon") + mouseClick(dialysatetmpuparrowbutton) + dialtmp = utility.get_object_from_names(names.o_dial_tmp_value) + dialtmp_properties = object.properties(dialtmp) + changeddialtmp = dialtmp_properties["value"] + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_TEMPERATURE_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_dialtmp_request) + + test.verify(waitFor( lambda: dialtemperature == changeddialtmp+0.5, 20000), "Testing FW received dial tmp Value in main treatment screen") + dialysatetmpdownarrowbutton = utility.findObjectById(dialysatetmpuparrow,"_downArrowIcon") + mouseClick(dialysatetmpdownarrowbutton) + dialtmp = utility.get_object_from_names(names.o_dial_tmp_value) + dialtmp_properties = object.properties(dialtmp) + changeddialtmp = dialtmp_properties["value"] + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_DIALYSATE_TEMPERATURE_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_dialtmp_request) + + test.verify(waitFor( lambda: dialtemperature == changeddialtmp-0.5, 30000), "Testing FW received dial tmp Value in main treatment screen") + #rejection reason is 1 payload = conversions.integer_to_bytearray(0) @@ -364,7 +485,7 @@ rejectionReason = utility.get_object_from_names(names.o_treatmentHome_notification_NotificationBarSmall) test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) - #rejection reason is 0 + #rejection reason is 1 payload = conversions.integer_to_bytearray(1) payload += conversions.integer_to_bytearray(0) td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_RESPONSE.value, @@ -374,8 +495,6 @@ has_parameters = True, parameters_payload= payload) - #need to verify the response - td.td_treatment_set_points( blood_flow = 94, dialysate_flow = 94, dialysate_temp = 28) @@ -390,7 +509,7 @@ message_id, handle_bloodflow_request) - #check the value incremented in blood flow + test.verify(waitFor( lambda: bloodFlowrate == 100, 40000), "Testing FW received blood flow Value in main treatment screen") dialysateflowuparrow = waitForObject(names.o_dial_flow_value) dialysateflowuparrowbutton = utility.findObjectById(dialysateflowuparrow,"_upArrowIcon") @@ -402,7 +521,7 @@ message_id, handle_bloodflow_request) - #check the value incremented in dialysate flow value + test.verify(waitFor( lambda: dialflow == 100, 40000), "Testing FW received dial flow Value in main treatment screen") dialysatetempuparrow = waitForObject(names.o_dial_tmp_value) dialysatetempuparrowbutton = utility.findObjectById(dialysatetempuparrow,"_upArrowIcon") @@ -413,10 +532,10 @@ can_interface.register_receiving_publication_function(channel_id, message_id, handle_bloodflow_request) - - #check the value incremented in dialysate flow value + test.verify(waitFor( lambda: dialtemperature == 35, 50000), "Testing FW received dial tmp Value in main treatment screen") test.endSection() - + +def check_duration_edit_maintreatment(): test.startSection("Treatment Duration Edit") td.td_treatment_time( tx_duration_s = 51 , tx_elapsed_s = 5 , @@ -441,37 +560,34 @@ test.log(str(treatmenttimeelapsed)) utility.set_value_based_on_target(names.o_newTreatmentDuration_LabelUnitValueAdjuster,51) utility.set_value_based_on_target(names.o_newTreatmentDuration_LabelUnitValueAdjuster,300) - #rejection reason 0 - # payload = conversions.integer_to_bytearray(1) - # payload += conversions.integer_to_bytearray(0) - # td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_DURATION_CONFIRM_RESPONSE.value, - # reason=0, - # accepted=1, - # is_pure_data = False, - # has_parameters = True, - # parameters_payload= payload) - # - # #need to verify the response - # - # - - #rejection reason is 1 + + mouseClick(names.o_continueButton_TouchRect) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_TD_DURATION_VALIDATE_RESPONSE.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_duration_request) + + + test.verify(waitFor( lambda: durationvalue == 300, 3000), "Testing FW received duration Value in main treatment screen") td.td_duration_validate_response(vRejectionReason =1, - vDuration= 78, - vUFVolume= 0.9, - vUFRate= 0.6) + vDuration= 0, + vUFVolume= 0.0, + vUFRate= 0.0) rejectionReason = utility.get_object_from_names(names.o_notification_bar) test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) - td.td_duration_validate_response(vRejectionReason =0, vDuration= 78, vUFVolume= 0.9, vUFRate= 0.6) + #check the values in the ui + newufrate = waitForObject(names.o_ufRate_LabelUnitText).value + test.compare(newufrate,0.60,"Duration value is updated in"+str(newufrate)) + newduration = waitForObject(names.o_newTreatmentDuration_LabelUnitText).value + test.compare(int(newduration),78,"UF rate value is updated in"+str(newduration)) - - #need to check the request - #rejection reason is 1 payload = conversions.integer_to_bytearray(0) payload += conversions.integer_to_bytearray(1) td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_DURATION_CONFIRM_RESPONSE.value, @@ -493,18 +609,35 @@ is_pure_data = False, has_parameters = True, parameters_payload= payload) - # if can_interface is not None: - # channel_id = CAN.DenaliChannels.ui_to_td_ch_id - # message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINTS_CHANGE_REQUEST.value - # can_interface.register_receiving_publication_function(channel_id, - # message_id, - # handle_treatment_request) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_TD_DURATION_CONFIRM_RESPONSE.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_duration_confirm_request) - + test.verify(waitFor( lambda: durationconfirm == 78, 50000), "Testing FW received duration Value in main treatment screen") treatmentpopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) - test.compare(treatmentpopup, True, "Popup is not present") + test.compare(treatmentpopup, True, "Popup is not present") + +def main(): + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + td.td_operation_mode(TDOpModes.MODE_STAN.value) + mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect)) + td.td_operation_mode(TDOpModes.MODE_PRET.value) + utility.verify_create_treatment_parameters() + check_pressure_edit_maintreatment() + check_saline_edit_maintreatment() + check_treatement_edit_maintreatment() + check_duration_edit_maintreatment() + + + + + \ No newline at end of file