Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r568e97ea04d6b8bd977bf3533980a42b26ec951e -r90872d7586fbd455104384dddf0d81a7ce7c88bc --- shared/scripts/configuration/utility.py (.../utility.py) (revision 568e97ea04d6b8bd977bf3533980a42b26ec951e) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 90872d7586fbd455104384dddf0d81a7ce7c88bc) @@ -109,9 +109,9 @@ -def scroll_to_zone(zone=None, screen_object=None, screen="Main"): +def scroll_to_zone(zone=None, screen_object=None): """ - scroll to the numeric if object is hidden + scroll to the zone if object is hidden Arguments: zone - UI object screen_object - UI object @@ -132,13 +132,39 @@ ScreenObj = squish.waitForObject(screen_object) screenHeight = pyInt(ScreenObj.height) screenWidth = pyInt(ScreenObj.width) - if screen == "pop up": - squish.mouseWheel(ScreenObj, screenWidth-1250, - screenHeight-50, 0, -10, squish.Qt.NoModifier) - else: - squish.mouseWheel(ScreenObj, screenWidth-1000, - screenHeight-10, 0, -50, squish.Qt.NoModifier) + 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 scroll_to_value_on_pop_up(value=None, container=None): + """ + scroll to the to the value if object is hidden + Arguments: + value - value object + container - Container of the value + Return: + bool + """ + counter = 0 + while counter <= 100: + try: + counter += 1 + squish.findObject(value) + squish.snooze(0.5) + if check_if_object_is_within_the_container(obj=value, container=container): + return True + else: + raise RuntimeError + except RuntimeError: + ScreenObj = squish.waitForObject(container) + screenHeight = pyInt(ScreenObj.height) + screenWidth = pyInt(ScreenObj.width) + squish.mouseWheel(ScreenObj, screenWidth//2, + screenHeight//2, 0, -50, squish.Qt.NoModifier) + + raise LookupError("value object is not in view to the user after " + \ + "trying 100 times") \ No newline at end of file Index: shared/scripts/names.py =================================================================== diff -u -r568e97ea04d6b8bd977bf3533980a42b26ec951e -r90872d7586fbd455104384dddf0d81a7ce7c88bc --- shared/scripts/names.py (.../names.py) (revision 568e97ea04d6b8bd977bf3533980a42b26ec951e) +++ shared/scripts/names.py (.../names.py) (revision 90872d7586fbd455104384dddf0d81a7ce7c88bc) @@ -66,6 +66,7 @@ #alarm list +alarm_list_container = {"container": o_Overlay, "id": "_flickable", "type": "Flickable", "unnamed": 1, "visible": True} notification_bar_alarm_list_button = {"container": o_Gui_MainView, "id": "_alarmListImage", "source": "qrc:/images/iList", "type": "Image", "unnamed": 1, "visible": True} maximize_button = {"container": o_Gui_MainView, "gradient": 0, "id": "_updownButton", "type": "UpDownButton", "unnamed": 1, "visible": True} alarm_list_title_text = {"container": o_Overlay, "text": "Alarm list", "type": "Text", "unnamed": 1, "visible": True} Index: tst_ui_alarms_list/test.py =================================================================== diff -u -r568e97ea04d6b8bd977bf3533980a42b26ec951e -r90872d7586fbd455104384dddf0d81a7ce7c88bc --- tst_ui_alarms_list/test.py (.../test.py) (revision 568e97ea04d6b8bd977bf3533980a42b26ec951e) +++ tst_ui_alarms_list/test.py (.../test.py) (revision 90872d7586fbd455104384dddf0d81a7ce7c88bc) @@ -19,7 +19,7 @@ from builtins import int as pyInt from configuration.config import * -from configuration.utility import start_application, scroll_to_zone +from configuration.utility import start_application, scroll_to_value_on_pop_up from dialin.ui.hd_simulator import HDSimulator # from dialin.ui.dg_simulator import DGSimulator from dialin.protocols.CAN import DenaliCanMessenger @@ -52,13 +52,13 @@ mouseClick(waitForObject(names.o_minimizeButton_UpDownButton)) -def set_only_alarm_list_btn(): +def set_only_alarm_list_btn(no_minimize): """ Method to remove the minimize and maximize button @return : flags """ - flags = alarm.cmd_make_alarm_flags(no_minimize=1) + flags = alarm.cmd_make_alarm_flags(no_minimize=no_minimize) return flags @@ -102,8 +102,6 @@ between HIGH, MEDIUM, LOW, NONE @return id_list: list of 10 states """ - state_list = [] - state_count = 0 state_list = choices(list(ALARM_PRIORITIES), k=10) return state_list @@ -165,8 +163,8 @@ alarm_id_parent_list = {} for index, id in enumerate(arranged_alarm_list): - scroll_to_zone(zone=names.get_alarm_id_obj(id=id), - screen_object=names.o_Overlay, screen="pop up") + scroll_to_value_on_pop_up(value=names.get_alarm_id_obj(id=id), + container=names.alarm_list_container) alarm_id = waitForObject(names.get_alarm_id_obj(id=id)) alarm_id_parent = object.parent(alarm_id) alarm_id_parent_list[id] = alarm_id_parent @@ -214,7 +212,7 @@ alarm_id_list = generate_alarm_ids() set_the_alarm(alarm_id_list=alarm_id_list, state_list=generate_states(), - flags=set_only_alarm_list_btn()) + flags=set_only_alarm_list_btn(no_minimize=1)) arranged_alarm_list = arrange_the_alarm_list(alarm_id_list=alarm_id_list, accept=accept,reason_id=reason_id ) snooze(2) @@ -223,14 +221,53 @@ verify_alarm_list(arranged_alarm_list=arranged_alarm_list, accept=accept,reason_id=reason_id ) + +def verify_alarm_list_when_minimize_button_is_available(accept=None, reason_id=None): + """ + Method to set the alarms, arrange them + in a list and verify the correct alarm ID + and its respective message is added to the list + """ + alarm_id_list = generate_alarm_ids() + set_the_alarm(alarm_id_list=alarm_id_list, + state_list=generate_states()) + arranged_alarm_list = arrange_the_alarm_list(alarm_id_list=alarm_id_list, + accept=accept,reason_id=reason_id ) + snooze(2) + minimize() + open_alarm_list_when_only_alarm_list_btn_is_available() + snooze(5) + verify_alarm_list(arranged_alarm_list=arranged_alarm_list, + accept=accept,reason_id=reason_id ) + def main(): utils.tstStart(__file__) startApplication(AUT_NAME) test.log("GIVEN: 10 Alarms are generated") + test.log("AND: Minimize button is Available") + test.log("WHEN: Arranged 10 Alarms under 'Alarm list'") + test.log("AND: 'Alarm list is accepted and 'Alarm Dialogue'" + + "is minimized and 'Alarm list' is opened") + test.log("THEN: All the 10 Alarms is displayed in 'Alarm list' " + + "in defined order") + verify_alarm_list_when_only_alarm_list_button_is_available(accept=ACCEPTED, + reason_id=0) + + test.log("GIVEN: 10 Alarms are generated") + test.log("AND: Minimize button is Available") + test.log("WHEN: Arranged 10 Alarms under 'Alarm list'") + test.log("AND: 'Alarm list is Rejected and 'Alarm Dialogue'" + + "is minimized and 'Alarm list' is opened") + test.log("THEN: Only rejection message should display and " + + "No Alarms should be displayed") + verify_alarm_list_when_only_alarm_list_button_is_available(accept=REJECTED, + reason_id=20) + + test.log("GIVEN: 10 Alarms are generated") test.log("AND: Minimize button is removed") test.log("WHEN: Arranged 10 Alarms under 'Alarm list'") test.log("AND: 'Alarm list is accepted and 'Alarm list'" + @@ -250,6 +287,7 @@ verify_alarm_list_when_only_alarm_list_button_is_available(accept=REJECTED, reason_id=7) + snooze(2) @@ -259,3 +297,6 @@ + + +