Index: shared/scripts/configuration/config.py =================================================================== diff -u -r9bdbb675a824033b1bac4864c32d83fe049d1ccb -r48a93839f9f3aaef88be6c627d43473871f64509 --- shared/scripts/configuration/config.py (.../config.py) (revision 9bdbb675a824033b1bac4864c32d83fe049d1ccb) +++ shared/scripts/configuration/config.py (.../config.py) (revision 48a93839f9f3aaef88be6c627d43473871f64509) @@ -16,7 +16,7 @@ import os from configuration.strings import * -AUT_NAME = "denaliSquish -k -K -S" +AUT_NAME = "denaliSquish -k -K -S -q" COMMON_PATH = os.environ['HOME']+"/Projects" @@ -31,3 +31,10 @@ BLOOD_PRIMING_DEFAULT_VALUE = "0 mL" CREATE_TREATMENT_BUTTON_ACTIVE = "100 3800 4 01000000 " + +CHEMICAL_DISINFECT_TEXT = "Chemical Disinfect" +CHEMICAL_DISINFECT_INSTRUCTION_COUNT = 3 + + + + Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r50a76caec4a97fcdeb026d0ea7ec9c2d3c38bfeb -r48a93839f9f3aaef88be6c627d43473871f64509 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 50a76caec4a97fcdeb026d0ea7ec9c2d3c38bfeb) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 48a93839f9f3aaef88be6c627d43473871f64509) @@ -22,127 +22,43 @@ from builtins import int as pyInt from datetime import datetime -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 - """ - 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 - """ - counter = 0 - while counter <= 100: - try: - counter += 1 - squish.findObject(zone) - squish.snooze(0.5) - if check_if_object_is_within_the_container(obj=zone, container=screen_object): - return True - else: - raise RuntimeError - except RuntimeError: - ScreenObj = squish.waitForObject(screen_object) - screenHeight = pyInt(ScreenObj.height) - screenWidth = pyInt(ScreenObj.width) - squish.mouseWheel(ScreenObj, screenWidth-1000, - screenHeight-10, 0, -50, squish.Qt.NoModifier) - - raise LookupError("zone object is not in view to the user after " + \ - "trying 100 times") +def verify_page_step_indicator(screen_obj, treatment_step, treatment_screens): + """ + Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] + @param treatment_step : indicates the Current treatment step + """ + test.startSection("verification of page step indicators") + for page in range(len(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, treatment_screens[page])) -def pad_message_with_zeros(message): - """ - Returns a packet padded with zeros that guarantees that the packet is a multiple of 8 bytes. + #To verify the step indicators of the completed treatment screens + if page < 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 treatment screen + elif page == 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) + test.verify(step_title.font.bold) + #To verify the step indicators of the remaining 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) + test.compare(bullet_circle_color, config.CURRENT_COLOR) + test.compare(bullet_border_color, config.INCOMPLETE_COLOR) + test.endSection() - @param message: packet that may or may not be multiple of 8 bytes - @return:: packet that is 8-byte multiple - - """ - PACKET_LENGTH = 4 - - message_length = len(message) - - if message_length % PACKET_LENGTH != 0: - add_these_many_zeros = math.ceil(message_length / PACKET_LENGTH) * \ - PACKET_LENGTH - message_length - - message += [0] * add_these_many_zeros - - return message - - -def ui_all_publication_handler(message: dict) -> None: - """ - This function is the default handler of the ui received messages which only prints out the received message - - This function can be used as an example. - - Be careful that there is only one ui publication method - and it will be overwritten on each call to the function set_ui_all_publication of the HDSimulator. - Look into the _init_loader of the Simulator class for example on how to register. - self.interface.hd.set_ui_all_publication(ui_all_publication_handler) - - This function is filtering the two message ID: - MsgIds.MSG_ID_UI_CHECK_IN.value, - MsgIds.MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK.value - for the simplicity of the printed message and as example of how to filter. - That filter can obviously be removed. - - @param message: the ui received message - @return: event binary from simulator - """ - exception_msg_id = { - MsgIds.MSG_ID_UI_CHECK_IN.value, - MsgIds.MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK.value - } - msg_id = DenaliMessage.get_message_id(message) - if msg_id in exception_msg_id: - return - - message_list = DenaliCanMessenger.convert_message_to_string(message) - event_binary = "" + pad_message_with_zeros(message_list) - - return event_binary - - -def cmd_set_create_treatment_click_event(response): - """ - Sends a set RTC response message - - @param response: (int) 0=NO, 1=YES - @return: N - """ - test.log("HD: Sending response {0}".format(response)) - - payload = integer_to_bytearray(response) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.ui_to_hd_ch_id, - message_id=MsgIds.MSG_ID_UI_INITIATE_TREATMENT_REQUEST.value, - payload=payload) - - return message - def get_current_date_and_time(date_format='%Y/%b/%d - %H:%M'): date = datetime.now() Index: shared/scripts/names.py =================================================================== diff -u -r353c3f31d770db01cd2a37421dffef5166d6c20a -r48a93839f9f3aaef88be6c627d43473871f64509 --- shared/scripts/names.py (.../names.py) (revision 353c3f31d770db01cd2a37421dffef5166d6c20a) +++ shared/scripts/names.py (.../names.py) (revision 48a93839f9f3aaef88be6c627d43473871f64509) @@ -50,5 +50,21 @@ +o_DisinfectStack_DisinfectStack = {"container": o_Gui_MainView, "objectName": "_DisinfectStack", "type": "DisinfectStack", "visible": True} +o_DisinfectStack_disinfectHome_TreatmentFlowBase = {"container": o_DisinfectStack_DisinfectStack, "objectName": "_disinfectHome", "type": "TreatmentFlowBase", "visible": True} +o_disinfectHome_TouchRect = {"container": o_DisinfectStack_disinfectHome_TreatmentFlowBase, "type": "TouchRect", "unnamed": 1, "visible": True} +o_disinfectHome_swipeview_SwipeView = {"container": o_DisinfectStack_disinfectHome_TreatmentFlowBase, "id": "_swipeview", "type": "SwipeView", "unnamed": 1, "visible": True} +o_swipeview_Disinfection1_Text = {"container": o_disinfectHome_swipeview_SwipeView, "text": "Disinfection1", "type": "Text", "unnamed": 1, "visible": True} +o_swipeview_Disinfection2_Text = {"container": o_disinfectHome_swipeview_SwipeView, "text": "Disinfection2", "type": "Text", "unnamed": 1, "visible": True} +o_swipeview_Repeater = {"container": o_disinfectHome_swipeview_SwipeView, "index": 0, "type": "Repeater", "unnamed": 1, "visible": True} +o_swipeview_Item = {"container": o_disinfectHome_swipeview_SwipeView, "index": 0, "occurrence": 3, "type": "Item", "unnamed": 1, "visible": True} +o_disinfectHome_Chemical_Disinfect = {"container": o_DisinfectStack_disinfectHome_TreatmentFlowBase, "text": "Chemical Disinfect", "type": "Text", "unnamed": 1, "visible": True} +o_DisinfectStack_disinfectChemical_TreatmentFlowBase = {"container": o_DisinfectStack_DisinfectStack, "objectName": "_disinfectChemical", "type": "TreatmentFlowBase", "visible": True} +o_disinfectChemical_Chemical_Disinfect_Text = {"container": o_DisinfectStack_disinfectChemical_TreatmentFlowBase, "occurrence": 2, "text": "Chemical Disinfect", "type": "Text", "unnamed": 1, "visible": True} +o_disinfectChemical_rightImage_Image = {"container": o_DisinfectStack_disinfectChemical_TreatmentFlowBase, "id": "_rightImage", "source": "qrc:/images/iArrowRight", "type": "Image", "unnamed": 1, "visible": True} +o_disinfectChemical_leftImage_Image = {"container": o_DisinfectStack_disinfectChemical_TreatmentFlowBase, "id": "_leftImage", "source": "qrc:/images/iArrowLeft", "type": "Image", "unnamed": 1, "visible": True} + + + Index: tst_disinfection/test.py =================================================================== diff -u -r9bdbb675a824033b1bac4864c32d83fe049d1ccb -r48a93839f9f3aaef88be6c627d43473871f64509 --- tst_disinfection/test.py (.../test.py) (revision 9bdbb675a824033b1bac4864c32d83fe049d1ccb) +++ tst_disinfection/test.py (.../test.py) (revision 48a93839f9f3aaef88be6c627d43473871f64509) @@ -7,16 +7,109 @@ from dialin.ui.dg_simulator import DGSimulator from configuration import config from configuration import utility +from dialin.utils.conversions import integer_to_bytearray, float_to_bytearray, short_to_bytearray, unsigned_integer_to_bytearray, integer_to_bit_array, unsigned_short_to_bytearray, unsigned_byte_to_bytearray, unsigned_byte_to_bytearray from dialin.common.hd_defs import HDOpModes, HDOpSubModes + hd_simulator = HDSimulator() dg_simulator = DGSimulator() + + +def verify_right_navigation_for_chemical_disinfection(): + """ + The method is used to verify the functionality of the right arrow in the disinfection navigation, as well as the visibility of the two arrows + """ + test.startSection("Rightward navigation") + test.verify(not object.exists(names.o_disinfectChemical_leftImage_Image), "The left navigation arrow should not be present on the first screen of instruction") + for indicator in range(1,num_of_instructions + 1): + verify_bullet_navigation(indicator) + + if indicator != num_of_instructions: + mouseClick(waitForObject(names.o_disinfectChemical_rightImage_Image)) + + test.verify(not object.exists(names.o_disinfectChemical_rightImage_Image), "The right navigation arrow should not be present on the last screen of instruction") + test.endSection() + + +def verify_left_navigation_for_chemical_disinfection(): + """ + The method is used to verify the functionality of the left arrow in the instruction navigation, as well as the visibility of the two arrows + """ + test.startSection("Leftward instruction navigation") + test.verify(not object.exists(names.o_PreTreatmentBase_rightImage_Image), "The right navigation arrow should not be present on the last screen of instruction") + for indicator in range(num_of_instructions, 0, -1): + verify_bullet_navigation(indicator) + + if indicator != 1: + mouseClick(waitForObject(names.o_PreTreatmentBase_leftImage_Image)) + + test.verify(not object.exists(names.o_PreTreatmentBase_leftImage_Image), "The left navigation arrow should not be present on the first screen of instruction") + test.endSection() + + + +def verify_disinfection_states(): + + hd_simulator.cmd_send_hd_disinfection_state(sub_mode = 0, flush_mode = 0, heat_mode = 0, chemical_mode = 1) + + + + + + + +def verify_chemical_disinfect(): + + hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_STAN.value,HDOpSubModes.STANDBY_WAIT_FOR_DISINFECT_STATE.value) + mouseclick(names.o_disinfectHome_Chemical_Disinfect) + + test.compare(waitForObjectExists(names.o_disinfectChemical_Chemical_Disinfect_Text).text, config.CHEMICAL_DISINFECT_TEXT, "Chemical disinfect text should be visible") + + + + # hd_simulator.cmd_send_hd_disinfect_response(accepted = True, reason =1) + payload = integer_to_bytearray(1) + payload += unsigned_integer_to_bytearray(4) + hd_simulator.cmd_send_hd_general_response(message_id=155, accepted=1, reason=1, is_pure_data=False, has_parameters=True, parameters_payload=payload) + + + + + snooze(5) + hd_simulator.cmd_send_hd_disinfection_state(sub_mode = 0, flush_mode = 0, heat_mode = 0, chemical_mode = 1) + snooze(5) + dg_simulator.cmd_send_dg_disinfect_progress_time_flush(total = 120, countdown = 45) + test.log("User navigated to chemical disinfect section") + +def verify_heat_disinfect(): + pass + +def verify_water_flush(): + pass + + def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) - hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_STAN.value,HDOpSubModes.STANDBY_WAIT_FOR_DISINFECT_STATE.value) + #verify_disinfection_states() + verify_chemical_disinfect() + verify_heat_disinfect() + verify_water_flush() + + + + """ + hd_simulator.cmd_send_hd_disinfection_state(self, sub_mode: int, flush_mode: int, heat_mode: int,chemical_mode: int) + hd_simulator.cmd_send_hd_disinfect_response(self, accepted: bool, reason: int) + hd_simulator.cmd_send_hd_disinfect_chemical_confirm(self, accepted: bool, reason: int) + + + + dg_simulator.cmd_send_dg_disinfect_progress_time_flush(self, total: int, countdown: int) + dg_simulator.cmd_send_dg_disinfect_progress_time_heat(self, total: int, countdown: int) + """ utils.waitForGUI(2)