Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rfab7cab2b75d46cd086437027099192a06d98f46 -rc7858ffd4c77881ebf25737b47bf079b189744cf --- shared/scripts/configuration/utility.py (.../utility.py) (revision fab7cab2b75d46cd086437027099192a06d98f46) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision c7858ffd4c77881ebf25737b47bf079b189744cf) @@ -14,7 +14,7 @@ # ############################################################################ - +import names import sys import squish import test @@ -100,4 +100,12 @@ raise LookupError("value object is not in view to the user after " + \ "trying 100 times") + +def get_alarm_id_obj(id): + names.o_alarm_id["text"] = id + return names.o_alarm_id + +def get_alarm_msg_obj(msg): + names.o_alarm_message["text"] = msg + return names.o_alarm_message \ No newline at end of file Index: shared/scripts/names.py =================================================================== diff -u -rf8943fd4831755c59de02301e92eed5e2dc6eee5 -rc7858ffd4c77881ebf25737b47bf079b189744cf --- shared/scripts/names.py (.../names.py) (revision f8943fd4831755c59de02301e92eed5e2dc6eee5) +++ shared/scripts/names.py (.../names.py) (revision c7858ffd4c77881ebf25737b47bf079b189744cf) @@ -56,16 +56,7 @@ o_rejected_alarm_list_msg = {"container": o_Overlay, "id": "_desc", "objectName": "_NotificationDialog_Description", "type": "Text", "visible": True} o_alarm_title_text = {"container": o_Overlay, "id": "_title", "type": "Text", "unnamed": 1, "visible": True} o_alarm_dialogue_box_msg = {"container": o_Overlay, "id": "_desc", "objectName": "_NotificationDialog_Description", "type": "Text", "visible": True} - - -def get_alarm_id_obj(id): - o_alarm_id["text"] = id - return o_alarm_id -def get_alarm_msg_obj(msg): - o_alarm_message["text"] = msg - return o_alarm_message - #alarm dialog o_alarm_dialog_content = {"container": o_Overlay , "objectName": "_NotificationDialog" , "type": "ContentItem" } o_alarm_dialog_titleBar = {"container": o_alarm_dialog_content , "id" : "_titleBar" , "type": "Rectangle" } Index: tst_ui_alarms_list/test.py =================================================================== diff -u -rfab7cab2b75d46cd086437027099192a06d98f46 -rc7858ffd4c77881ebf25737b47bf079b189744cf --- tst_ui_alarms_list/test.py (.../test.py) (revision fab7cab2b75d46cd086437027099192a06d98f46) +++ tst_ui_alarms_list/test.py (.../test.py) (revision c7858ffd4c77881ebf25737b47bf079b189744cf) @@ -14,7 +14,7 @@ import names from configuration.config import * -from configuration.utility import scroll_to_value_on_pop_up +from configuration.utility import * from dialin.ui import utils from builtins import int as pyInt from dialin.ui.hd_simulator import HDSimulator @@ -139,35 +139,29 @@ def verify_alarm_list(arranged_alarm_list, accept=None, reason_id=0): """ Method to verify the Messages under 'Alarm list' - @param arranged_alarm_list: list alarm list - @param accept: bool Accepted/Rejected - @param reason_id: Reason for rejecting the alarm list + @param arranged_alarm_list - (list) alarm list + @param accept - (bool) Accepted/Rejected + @param reason_id - (int) Reason for rejecting the alarm list """ test.startSection("Verify the Messages under 'Alarm list'") if accept==ACCEPTED: alarm_id_parent_list = {} for index, id in enumerate(arranged_alarm_list): - scroll_to_value_on_pop_up(value=names.get_alarm_id_obj(id), + scroll_to_value_on_pop_up(value=get_alarm_id_obj(id), container=names.o_alarm_list_container) - alarm_id = waitForObject(names.get_alarm_id_obj(id)) + alarm_id = waitForObject(get_alarm_id_obj(id)) alarm_id_parent = object.parent(alarm_id) alarm_id_parent_list[id] = alarm_id_parent - alarm_msg = waitForObject(names.get_alarm_msg_obj(msg=ALARM_ID_AND_MESSAGES[id])) + alarm_msg = waitForObject(get_alarm_msg_obj(ALARM_ID_AND_MESSAGES[id])) test.log("Verifying 'Alarm ID'") alarm_id = pyInt(alarm_id.text.toUtf8().constData()) test.compare(alarm_id, id, - "Actual 'Alarm ID': {alarm_id} ".format(alarm_id=alarm_id) + - "should be equal to Expected 'Alarm ID': {id}".format(id=id)) - + "Actual 'Alarm ID': {} should be equal to Expected 'Alarm ID': {}".format(alarm_id, id)) test.log("Verifying 'Alarm Message'") - alarm_msg = alarm_msg.text.toUtf8().constData() + alarm_msg = alarm_msg.text test.compare(alarm_msg, ALARM_ID_AND_MESSAGES[id], - "Actual 'Alarm Message': {alarm_msg} ".format(\ - alarm_msg=alarm_msg) + - "should be equal to Expected " + - "'Alarm Message': {expected_msg}".format\ - (expected_msg=ALARM_ID_AND_MESSAGES[id])) + "Actual 'Alarm Message': {} should be equal to Expected 'Alarm Message': {}".format(alarm_msg, ALARM_ID_AND_MESSAGES[id])) test.log("Verifying the Alarm's position in 'Alarm list'") alarm_list_parent = waitForObject(names.o_alarm_list) @@ -176,18 +170,14 @@ for index, alarm_id in enumerate(alarm_id_parent_list): test.compare(alarm_list[index], alarm_id_parent_list[alarm_id], - "Alarm ID: {alarm_id} is at position {index}".format(\ - alarm_id=alarm_id, index=index) ) - elif accept==REJECTED: + "Alarm ID: {} is at position {}".format(alarm_id, index)) + else: expected_message = REJECTION_REASON[0] + "\n" + REJECTION_REASON[reason_id] rejected_alarm_list_msg = waitForObject(names.o_rejected_alarm_list_msg) - rejected_alarm_list_msg = rejected_alarm_list_msg.text.toUtf8().constData() + rejected_alarm_list_msg = rejected_alarm_list_msg.text test.compare(rejected_alarm_list_msg, expected_message, - "When 'Alarm list' is not accepted " + - "then '{expected_message}' should be ".format(\ - expected_message=expected_message) + - "displayed on 'Alarm List' pop up") + "When 'Alarm list' is not accepted then '{}' should be displayed on 'Alarm List' pop up".format(expected_message)) test.endSection() @@ -196,19 +186,19 @@ 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 + @param accept - (bool) Accepted/Rejected + @param reason_id - (int) Reason for rejecting the alarm list """ - test.startSection("Set the alarms, arrange them in a " + - "list and verify the correct Alarm ID and its " + - "respective message is added to the list") + test.startSection("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() - utils.waitForGUI(2) + utils.waitForGUI(1) set_the_alarm(alarm_id_list=alarm_id_list, state_list=generate_states(), flags=set_only_alarm_list_btn(no_minimize=1)) - utils.waitForGUI(2) + utils.waitForGUI(1) arranged_alarm_list = arrange_the_alarm_list(alarm_id_list=alarm_id_list, accept=accept,reason_id=reason_id ) - utils.waitForGUI(2) + utils.waitForGUI(1) open_alarm_list_when_only_alarm_list_btn_is_available() utils.waitForGUI(1) verify_alarm_list(arranged_alarm_list=arranged_alarm_list, @@ -221,10 +211,12 @@ 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 + @param accept - (bool) Accepted/Rejected + @param reason_id - (int) Reason for rejecting the alarm list """ test.startSection("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() - utils.waitForGUI(2) + utils.waitForGUI(1) set_the_alarm(alarm_id_list=alarm_id_list, state_list=generate_states(), flags=set_only_alarm_list_btn(no_minimize=0)) @@ -247,13 +239,12 @@ and verify the respective message displayed """ - test.startSection("Set undefined alarm and verify the " + - "respective message displayed") + test.startSection("Set undefined alarm and verify the respective message displayed") ALARM_IDS = [290, 300, 499] alarm_id_parent_list = {} for index, alarm_id in enumerate(ALARM_IDS): - test.log("Setting alarm ID {alarm_id}".format(alarm_id=alarm_id)) + test.log("Setting alarm ID {}".format(alarm_id)) alarm.cmd_activate_alarm_id(state=2, alarm=alarm_id, @@ -262,29 +253,23 @@ reason=0, a0=ALARM_IDS[0], a1=ALARM_IDS[1], a2=ALARM_IDS[2]) - utils.waitForGUI(2) + utils.waitForGUI(1) open_alarm_list_when_only_alarm_list_btn_is_available() utils.waitForGUI(1) for id in ALARM_IDS: - alarm_id = waitForObject(names.get_alarm_id_obj(id=id)) + alarm_id = waitForObject(get_alarm_id_obj(id)) alarm_id_parent = object.parent(alarm_id) alarm_id_parent_list[id] = alarm_id_parent - expected_msg = "{msg} [{id}]".format(msg=UNDEFINED_ALARM_ID_MSG, - id=str(id)) - alarm_msg = waitForObject(\ - names.get_alarm_msg_obj(msg=expected_msg)) + expected_msg = "{} [{}]".format(UNDEFINED_ALARM_ID_MSG, str(id)) + alarm_msg = waitForObject(get_alarm_msg_obj(msg=expected_msg)) test.log("Verifying 'Alarm ID'") alarm_id = pyInt(alarm_id.text.toUtf8().constData()) - test.compare(alarm_id, id, "Actual 'Alarm ID': {alarm_id} ".format(alarm_id=alarm_id) + - "should be equal to Expected 'Alarm ID': " + - "{id}".format(id=id)) + test.compare(alarm_id, id, "Actual 'Alarm ID': {} should be equal to Expected 'Alarm ID': {}".format(alarm_id, id)) test.log("Verifying 'Alarm Message'") alarm_msg = alarm_msg.text.toUtf8().constData() test.compare(alarm_msg, expected_msg, - "Actual 'Alarm Message': {alarm_msg} ".format(alarm_msg=alarm_msg) + - "should be equal to Expected " + - "'Alarm Message': {expected_msg}".format(expected_msg=expected_msg)) + "Actual 'Alarm Message': {} should be equal to Expected Alarm Message': {}".format(alarm_msg, expected_msg)) test.log("Verifying the Alarm's position in 'Alarm list'") alarm_list_parent = waitForObject(names.o_alarm_list) @@ -293,8 +278,7 @@ for index, alarm_id in enumerate(alarm_id_parent_list): test.compare(alarm_list[index], alarm_id_parent_list[alarm_id], - "Alarm ID: {alarm_id} is at position {index}".format(alarm_id=alarm_id, - index=index) ) + "Alarm ID: {} is at position {}".format(alarm_id, index) ) test.endSection() def verify_alarm_dialogue_is_displayed(id, state): @@ -303,37 +287,29 @@ is opened automatically from 'Alarm list' screen when new non-zero alarm is generated and verify the undefined alarm id message - @param id: Alarm ID - @param state: Alarm priority + @param id - (int) Alarm ID + @param state- (int) Alarm priority """ - test.startSection("Verify the Alarm Dialogue " + - "is opened automatically from 'Alarm list' " + - "screen when new non-zero alarm is generated" + - "and verify the undefined alarm id message") + test.startSection("Verify the Alarm Dialogue is opened automatically from 'Alarm list' screen when new non-zero alarm is generated and verify the undefined alarm id message") alarm.cmd_activate_alarm_id(state=state, alarm=id, flags=set_only_alarm_list_btn(no_minimize=0)) - utils.waitForGUI(2) + utils.waitForGUI(1) if object.exists(names.o_alarm_title_text): alarm_title = waitForObject(names.o_alarm_title_text) alarm_title = alarm_title.text.toUtf8().constData() test.log("Verifying the Alarm title") - expected_title = "{alarm_title} [{id}]".format(\ - alarm_title=ALARM_TITLE, id=id) - test.compare(alarm_title, expected_title, "Alarm Dialogue bar " + - "is displayed upon generation of alarm " + - "and title '{alarm_title}' is displayed".format(\ - alarm_title=ALARM_TITLE, id=id)) + expected_title = "{} [{}]".format(ALARM_TITLE, id) + test.compare(alarm_title, expected_title, + "Alarm Dialogue bar is displayed upon generation of alarm and title '{}' is displayed".format(ALARM_TITLE, id)) test.log("Verifying generated alarm message") alarm_msg = waitForObject(names.o_alarm_dialogue_box_msg) - alarm_msg = alarm_msg.text.toUtf8().constData() - expected_msg = "{msg} [{id}]".format(msg=UNDEFINED_ALARM_ID_MSG, - id=str(id)) + alarm_msg = alarm_msg.text + expected_msg = "{} [{}]".format(UNDEFINED_ALARM_ID_MSG, str(id)) test.compare(alarm_msg, expected_msg, - "Expected message {msg} ".format(msg=expected_msg) + - "should be displayed on alarm dialogue bar") + "Expected message {} should be displayed on alarm dialogue bar".format(expected_msg)) test.endSection() @@ -342,59 +318,21 @@ 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_minimize_button_is_available(accept=ACCEPTED, reason_id=0) utils.waitForGUI(1) - - 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_minimize_button_is_available(accept=REJECTED, reason_id=20) utils.waitForGUI(1) - - 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'" + - "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) utils.waitForGUI(1) - - 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 Rejected 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=7) utils.waitForGUI(1) - - test.log("GIVEN: 3 Undefined Alarms are generated") - test.log("AND: Minimize button is Available") - test.log("WHEN: Arranged 3 Alarms under 'Alarm list'") - test.log("AND: 'Alarm list is Accepted and 'Alarm Dialogue'" + - "is minimized and 'Alarm list' is opened") - test.log("THEN: Undefined Alarm ID message is displayed along with ID") verify_alarm_msg_for_undefined_alarm_id() utils.waitForGUI(1)