Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -re74e550d3abff8c854a63ed41d5b01d78b110094 -redb98c8ca7fbfca12f75abaa7e83cbde98b31e59 --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision e74e550d3abff8c854a63ed41d5b01d78b110094) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision edb98c8ca7fbfca12f75abaa7e83cbde98b31e59) @@ -1,14 +1,58 @@ -from configuration.strings import * - # -S, --disable-sd-card-fail-log-stop disable-sd-card-fail-log-stop # -k, --enable-check-in-log Enables Check-In Log # -K, --enable-acknow-log Enables Acknowledgment Log AUT_NAME = "leahi -k -K -S -q" -AUT_NAME_ONLY = "leahi" # Need only the AUT name for tst_ui_logs, do not add options -HOME_DIR_PATH = "/home/denali" +AUT_NAME_ONLY = "leahi" + +# Configuration application_init.py TMP_DIR = "/tmp/" +APP_POST_LOG_LOCATION = "".join([str(TMP_DIR),'/post.log']) +#Service Export Logs ENABLED = True +DEVICE_SETTINGS_SCREEN_TITLE_TEXT = "Device Settings" +EXPORT_LOG_TEXT = "Export Logs" +EXPORT_LOGS_OPTIONS = ["Application", "Service", "Treatment"] +EXPORT_LOG_STATUS = "Application log export to USB is complete" +EXPORT_LOG_PROGRESS_STATUS = "Service log export to USB in progress ... " +SERVICE_SCREEN_TITLE_TEXT = "Service" -APP_POST_LOG_LOCATION = "".join([str(TMP_DIR),'/post.log']) +# Headerbar_information_popup +INFORMATION_PARAMETERS = [ + "OS Version", "UI Version", "TD Version", "TD FPGA Version", + "TD Serial Number", "DD Version", "DD FPGA Version", "DD Serial Number", +] + +#Device Settings Information Version +INFORMATION_SCREEN_TITLE_TEXT = "Information" +INFORMATION_TITLES = ["Information", "Versions"] +VERSION_PARAMETERS = [ + "Information", "UI Version", "TD Version", "TD FPGA Version", + "TD Serial Number", "DD Version", "DD FPGA Version", "DD Serial Number" +] +SERVICES_PARAMETERS = [ + "TD Last Service Date", "TD Next Service Date", + "DD Last Service Date", "DD Next Service Date" +] +SERIVCES_TITLE = "Service" +WATER_PARAMETERS = ["Water Configuration", "Water Input"] + +# General Alarm Requirements Instruction +NUM_OF_ALARM_PRIORITIES = 4 # Total number of alarm priorities +ALARM_MUTE_FLAG = 0B0000001000000000 +ALARM_UNMUTE_FLAG = 0B0000000000000000 +ALARM_PRIORITY_OPTIONS = { + 0 : 'ALARM_PRIORITY_NONE' , + 1 : 'ALARM_PRIORITY_LOW' , + 2 : 'ALARM_PRIORITY_MEDIUM', + 3 : 'ALARM_PRIORITY_HIGH', +} + +ALARMS_COLORS_HEADER = { + "ALARM_PRIORITY_NONE" : "#438feb", + "ALARM_PRIORITY_LOW" : "#db8f00", + "ALARM_PRIORITY_MEDIUM" : "#db8f00", + "ALARM_PRIORITY_HIGH" : "#c53b33" +} +ALARM_REJECT_NOTIFICATION_TEMPLATE = "No Active Alarm List [{}]" Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -re2c906a7b5fde31d48d168f097fe6a5a2ab0afea -redb98c8ca7fbfca12f75abaa7e83cbde98b31e59 --- suite_leahi/shared/scripts/names.py (.../names.py) (revision e2c906a7b5fde31d48d168f097fe6a5a2ab0afea) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision edb98c8ca7fbfca12f75abaa7e83cbde98b31e59) @@ -40,7 +40,6 @@ o_dialyste_cond_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateCond", "objectName": "dialysateCondComponent", "type": "TreatmentFlowsComponent" } o_treatmentTimeNotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "notification", "type": "NotificationBarSmall" } - # settings_service_export_logs o_listView_ListView = {"container": o_Gui_MainView, "id": "_listView", "type": "ListView", "unnamed": 1 } o_listView_delegateControl = {"container": o_listView_ListView, "index": 2, "objectName": "delegateControl", "type": "Item" } @@ -58,5 +57,32 @@ o_ExportLogsNotificationBar = {"container": o_SettingsExportLogs, "id": "_information", "type": "NotificationBarSmall" } o_DeviceSettingsGrid = {"container": o_SettingsHome, "id": "_grid", "type": "Grid", } +#HeaderBar Information Pop up +o_InformationIconButton = {"container": o_Gui_MainView, "id": "_informationButton", "type": "IconButton", "unnamed": 1 } +o_InformationParameters = {"container": o_Overlay, "type": "Text", "unnamed": 1 } +o_VersionColumn = {"container": o_Overlay, "id": "_versionColumn", "type": "Column", "unnamed": 1 } +# Device Settings Information Version +o_DeviceSettingsInformation = {"container": o_SettingsHome, "id": "_touchItem", "type": "TouchRect", "unnamed": 1 } +o_InformationPageTitleText = {"container": o_SettingsInformation, "id": "_titleText", "type": "Text", "unnamed": 1 } +o_SettingsBase_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase" } +o_SettingsBase_Information_Text = {"container": o_SettingsBase_SettingsInformation, "type": "Text", "unnamed": 1 } +o_SettingsBase_SettingsInformation_2 = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsInformation" } +o_SettingsBase_grid_Grid = {"container": o_SettingsBase_SettingsInformation_2, "id": "_grid", "type": "Grid", "unnamed": 1 } +# General Alarm Requirements Instruction +o_AlarmButton_Mute = {"container": o_Overlay, "id": "_muteButton", "type": "MuteButton" } +o_AlarmButton_Mute_Min = {"container": o_AlarmButton_Mute, "id": "_hourText", "type": "Text" } +o_AlarmButton_Mute_Sec = {"container": o_AlarmButton_Mute, "id": "_minuteText", "type": "Text" } +o_AlarmButton_Mute_Img = {"container": o_AlarmButton_Mute, "id": "_image", "type": "Image", "unnamed": 1 } +o_Alarm_Bar = {"container": o_QQuickView, "id": "_alarmBar", "type": "NotificationBar" } +o_Alarm_Bar_Mute_Img = {"container": o_Alarm_Bar, "id": "_image", "type": "Image" } +o_Alarm_Bar_Mute_Min = {"container": o_Alarm_Bar, "id": "_hourText", "type": "Text" } +o_Alarm_Bar_Mute_Sec = {"container": o_Alarm_Bar, "id": "_minuteText", "type": "Text" } +o_AlarmsList_IconButton = {"container": o_Overlay, "id": "_alarmsList", "type": "IconButton", "unnamed": 1 } +o_AlarmButton_Minimize = {"container": o_Overlay, "id": "_minMaxButton", "type": "ArrowButton", "unnamed": 1 } +o_AlarmButton_Maximize = {"container": o_Gui_MainView, "id": "_minMaxButton", "type": "ArrowButton", "unnamed": 1 } +o_Alarm_Dialog_TitleBar = {"container": o_Overlay , "id": "_titleBar", "type": "Rectangle" } +o_Alarm_List = {"container": o_Overlay, "id": "_grid", "type": "Grid" } +o_Reject_Notification_Description_Text = {"container": o_Overlay, "objectName": "_NotificationDialog_Description", "type": "Text" } + Index: suite_leahi/tst_general_alarm_requirements_instruction/test.py =================================================================== diff -u --- suite_leahi/tst_general_alarm_requirements_instruction/test.py (revision 0) +++ suite_leahi/tst_general_alarm_requirements_instruction/test.py (revision edb98c8ca7fbfca12f75abaa7e83cbde98b31e59) @@ -0,0 +1,291 @@ +# Subject/Title: LDT-1802 General Alarm Requirements - SW - 02 - Instructions with new design - Q&R +# +# Functionalities: Testing all items of General Alarm Requirements +# +# Steps: +# 1 Start Leahi Application +# 2 Trigger an alarm and Click Alarm list icon to navigate to Alarm list screen +# 3 Generate alarms in batches of 10 from 1 to 160 +# 4 Compare Number of Alarms displayed and Alarm IDs +# 5 Compare of Alarm Reject Notification Text +# 6 Set and Compare Alarm Mute condition and timeouts - Compare Timeout delay for alarm, +# Compare Mute minutes button is visible, Compare Mute seconds button is visible, +# Compare of Alarm BellOff, Compare Mute Minutes, Mute seconds, Compare Alarm BellOff After minimized, +# Compare Mute Minutes After minimized and Compare Mute seconds After minimized +# 7 Set and Compare Alarm UnMute condition and timeouts - Compare Timeout delay for alarm, +# Compare Mute minutes button is visible, Compare Mute seconds button is visible, +# Compare of Alarm BellOn, Compare Alarm BellOn After minimized, +# Compare Mute Minutes After minimized and Compare Mute seconds After minimized +# 8 Set and Compare Alarm Dialog box color based on alarm priority +# Compare of Alarm TitleBar Color, Compare of Alarm Bar Color After Alarm minimized + + +import names +import re +from leahi_dialin.ui import utils +from configuration import config, utility +from leahi_dialin.ui.td_messaging_alarms import TD_Messaging_Alarms + + +alarm = TD_Messaging_Alarms() +ALARM_ID_COMBINATION = (2, 3, 5, 7, 10, 15, 20, 25, 30, 50) +ALARM_EXPIRES_TIME = (0, 10, 20, 30, 30, 100) +FLAG_MUTE = 512 +FLAG_UNMUTE = 0 + + +def minimize(): + """ + Method to minimize alarm dialog box + @param N/A + @output N/A + """ + mouseClick(waitForObject(names.o_AlarmButton_Minimize)) + + +def maximize(): + """ + Method to maximize alarm dialog box + @param N/A + @output N/A + """ + mouseClick(waitForObject(names.o_AlarmButton_Maximize)) + + +def findChildByText(parent_object, target_text): + """Recursively finds a child object by its text property.""" + for child in object.children(parent_object): + if hasattr(child, "text") and str(child.text) == target_text: + return child + found = findChildByText(child, target_text) + if found: + return found + return None + + +def test_send_active_list_response_batch_alarms(): + alarm.cmd_activate_alarm_id(state=1, alarm=1, silence_expires=0, flags=0) + mouseClick(names.o_AlarmsList_IconButton) + # Generate alarms in batches of 10 from 1 to 160 + count = 0 + for batch_start in range(1, 161, 10): + count += 1 + alarm.cmd_send_active_list_response( + True, + 0, + batch_start, + batch_start + 1, + batch_start + 2, + batch_start + 3, + batch_start + 4, + batch_start + 5, + batch_start + 6, + batch_start + 7, + batch_start + 8, + batch_start + 9, + ) + + # Get the alarm list grid and verify rows count + alarm_grid = waitForObject(names.o_Alarm_List) + + # Verify 10 alarms are displayed using rows property + test.compare(alarm_grid.rows, 10, "Comparison Number of Alarms displayed") + + test.startSection( + f"Comparison Alarms ID from {batch_start} to { batch_start + 9 } " + ) + # Verify each alarm ID in the batch + for i in range(10): + expected_alarm_id = str(batch_start + i) + + # Using the findChildByText function to find the text object containing the expected alarm ID + # within the alarm grid container. + text_object = findChildByText(alarm_grid, expected_alarm_id) + + if text_object: + test.compare( + text_object.text, + expected_alarm_id, + f"Comparison Alarms ID { expected_alarm_id } ", + ) + + # Finding and Comparison Alarm Reject Notification text + alarm.cmd_send_active_list_response(accept=0, reason=count) + alarm_reject_notification = utility.get_object_from_names( + names.o_Reject_Notification_Description_Text + ) + alarm_reject_notification_text = str(alarm_reject_notification.text) + trimmed_alarm_reject_notification_text = re.sub( + r"\n", " ", alarm_reject_notification_text + ) + trimmed_alarm_reject_notification_text = re.sub( + r"\].*", "]", trimmed_alarm_reject_notification_text + ) + test.compare( + trimmed_alarm_reject_notification_text, + config.ALARM_REJECT_NOTIFICATION_TEMPLATE.format(count), + "Comparison of Alarm Reject Notification Text", + ) + test.endSection() + + +def test_color_based_on_alarm_priority(alarm_priority): + """ + Method to verify alarm dialog box color based on alarm priority + @param alarm_priority - (int) alarm priority level + @output N/A + """ + test.startSection( + "verification of alarm dialog box color based on alarm priority -> " + + str(alarm_priority) + ) + + test.compare( + str(waitForObjectExists(names.o_Alarm_Dialog_TitleBar).color.name), + config.ALARMS_COLORS_HEADER[(config.ALARM_PRIORITY_OPTIONS[alarm_priority])], + "Comparison of Alarm TitleBar Color", + ) + + minimize() + test.compare( + str(waitForObject(names.o_Alarm_Bar).color.name), + config.ALARMS_COLORS_HEADER[(config.ALARM_PRIORITY_OPTIONS[alarm_priority])], + "Comparison of Alarm Bar Color After Alarm minimized", + ) + + maximize() + test.endSection() + + +def test_verify_alarm_mute(alarm_timeout=0, v_flags=0, alarm_status="Mute"): + """ + Method to verify alarm mute and unmute characteristics. + @param alarm_timeout - (int) timeout delay for alarm + @param alarm_status - (str) status of alarm + @param v_flag - (int) flag for mute and unmute operation. + @output N/A + """ + test.startSection( + "verification of alarm " + + str(alarm_status) + + " condition for timeout " + + str(alarm_timeout) + ) + test.compare( + waitForObjectExists(names.o_AlarmButton_Mute).timeout, + alarm_timeout, + "Timeout delay for alarm", + ) + + muted = v_flags == config.ALARM_MUTE_FLAG + test.compare( + waitForObjectExists(names.o_AlarmButton_Mute_Min).visible, + muted, + "Mute minutes button is visible", + ) + test.compare( + waitForObjectExists(names.o_AlarmButton_Mute_Sec).visible, + muted, + "Mute seconds button is visible", + ) + + muteTimeout_min, muteTimeout_sec = divmod(alarm_timeout, 60) + if muted: + test.compare( + str(waitForObjectExists(names.o_AlarmButton_Mute_Img).source.path), + "/images/iBellOff", + "Comparison of Alarm BellOff", + ) + test.compare( + str(waitForObjectExists(names.o_AlarmButton_Mute_Min).text), + "{}".format(muteTimeout_min), + "Comparison of Mute Minutes", + ) + test.compare( + str(waitForObjectExists(names.o_AlarmButton_Mute_Sec).text), + "{0:02}".format(muteTimeout_sec), + "Comparison of Mute seconds", + ) + minimize() + test.compare( + str(waitForObjectExists(names.o_Alarm_Bar_Mute_Img).source.path), + "/images/iBellOff", + "Comparison of Alarm BellOff After minimized", + ) + test.compare( + str(waitForObjectExists(names.o_Alarm_Bar_Mute_Min).text), + "{}".format(muteTimeout_min), + "Comparison of Mute Minutes After minimized", + ) + test.compare( + str(waitForObjectExists(names.o_Alarm_Bar_Mute_Sec).text), + "{0:02}".format(muteTimeout_sec), + "Comparison of Mute seconds After minimized", + ) + + else: + test.compare( + str(waitForObjectExists(names.o_AlarmButton_Mute_Img).source.path), + "/images/iBellOn", + "Comparison of Alarm BellOn", + ) + minimize() + test.compare( + str(waitForObjectExists(names.o_Alarm_Bar_Mute_Img).source.path), + "/images/iBellOn", + "Comparison of Alarm BellOn After minimized", + ) + + maximize() + test.endSection() + + +def verification_of_alarm_parameters(): + """ + Method to verify parameters of the alarm + @param N/A + @output N/A + """ + test.startSection("Verification of alarm parameters") + + for alarm_id in ALARM_ID_COMBINATION: + for alarm_index in range(config.NUM_OF_ALARM_PRIORITIES): + alarm.cmd_activate_alarm_id( + state=alarm_index, + alarm=alarm_id, + silence_expires=ALARM_EXPIRES_TIME[alarm_index], + flags=FLAG_MUTE, + ) + + # verify mute feature in application. + test_verify_alarm_mute( + alarm_timeout=ALARM_EXPIRES_TIME[alarm_index], + v_flags=config.ALARM_MUTE_FLAG, + alarm_status="Mute", + ) + + mouseClick(waitForObjectExists(names.o_AlarmButton_Mute)) + alarm.cmd_activate_alarm_id( + state=alarm_index, alarm=alarm_id, flags=FLAG_UNMUTE + ) + + # verify un-mute feature in application. + test_verify_alarm_mute( + v_flags=config.ALARM_UNMUTE_FLAG, alarm_status="UnMute" + ) + + # verify coloring based on priority. + test_color_based_on_alarm_priority(alarm_index) + + test.endSection() + + +def main(): + + utils.tstStart(__file__) + startApplication(config.AUT_NAME_ONLY) + test.startSection("Verification of General Alarm Requirements ") + # test_send_active_list_response_batch_alarms() + verification_of_alarm_parameters() + test.endSection() + utils.tstDone()