Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rf8943fd4831755c59de02301e92eed5e2dc6eee5 -rfab7cab2b75d46cd086437027099192a06d98f46 --- shared/scripts/configuration/utility.py (.../utility.py) (revision f8943fd4831755c59de02301e92eed5e2dc6eee5) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision fab7cab2b75d46cd086437027099192a06d98f46) @@ -19,49 +19,9 @@ import squish import test -from squish import * - from builtins import int as pyInt from configuration import config from dialin.ui.hd_simulator import HDSimulator - - -def start_application(app_name): - """ - Function to start application and verify application status [running] - If application does not start or running status is false, test stops - Argument: - @param app_name : (str) - Name of the application - @param app_executable : (str) - Actual application - @return: handle for the application if the application is in running state, - or error (exist the application) - """ - counter = 0 - while True: - try: - counter += 1 - test.log("Starting {}".format(app_name)) - squish.startApplication(app_name) - if counter == 1: - test.log("Application launched at the "+str(counter)+" st try.") - elif counter == 2: - test.log("Application launched at the "+str(counter)+" nd try.") - elif counter == 3: - test.log("Application launched at the "+str(counter)+" rd try.") - else: - test.log("Application launched at the "+str(counter)+" th try.") - break - except RuntimeError: - if counter == 1: - test.log("Application failed to launch after "+str(counter)+" try - Please refer logs") - elif counter == 20: - test.log("Exiting after "+str(counter)+ " tries..") - sys.exit(1) - else: - test.log("Application failed to launch after "+str(counter)+ " tries - Please refer logs") - except: - test.log("Failed to start the application") - sys.exit(1) def check_if_object_is_within_the_container(obj=None, container=None): """ @@ -89,8 +49,8 @@ def scroll_to_zone(zone=None, screen_object=None): """ scroll to the zone if object is hidden - @param zone - UI object - @param screen_object - UI object + @param zone - (obj) UI object + @param screen_object - (obj) UI object @return boolean true and false """ counter = 0 Index: tst_ui_alarms_list/test.py =================================================================== diff -u -rcd52d7983bab541caeff70165ec5ba9cc1ca3048 -rfab7cab2b75d46cd086437027099192a06d98f46 --- tst_ui_alarms_list/test.py (.../test.py) (revision cd52d7983bab541caeff70165ec5ba9cc1ca3048) +++ tst_ui_alarms_list/test.py (.../test.py) (revision fab7cab2b75d46cd086437027099192a06d98f46) @@ -22,8 +22,8 @@ from dialin.ui.hd_simulator_alarms import HDAlarmsSimulator from random import randint, choice, choices - -hd = HDSimulator() +hd_simulator = HDSimulator() + logging.basicConfig(filename='log_file.log',level=logging.INFO,\ datefmt='%d-%b-%y %H:%M:%S') logger = logging.getLogger("INFO") @@ -32,7 +32,6 @@ NUM_OF_MSG_ID = 289 - def maximize_alarm_list()-> None: """ Method to maximize the notification bar @@ -49,18 +48,16 @@ def set_only_alarm_list_btn(no_minimize): """ - Method to remove the minimize - and maximize button - @return : flags + Method to remove the minimize and maximize button + @return - flags """ flags = alarm.cmd_make_alarm_flags(no_minimize=no_minimize) return flags def open_alarm_list_when_only_alarm_list_btn_is_available(): """ - Method to open 'Alarm list' when - only 'Alarm list' button is available + Method to open 'Alarm list' when only 'Alarm list' button is available """ test.log("Opening 'Alarm list'") mouseClick(waitForObjectExists(names.o_alarm_list_minimize_maximize_button)) @@ -76,9 +73,8 @@ def generate_alarm_ids(): """ - Method to generate 10 random - alarm IDs - @return alarm_id_list: list of 10 random alarm IDs + Method to generate 10 random alarm IDs + @return alarm_id_list - (list) list of 10 random alarm IDs """ alarm_id_list = [] id_count = 0 @@ -94,9 +90,8 @@ def generate_states(): """ - Method to generate 10 states - between HIGH, MEDIUM, LOW, NONE - @return id_list: list of 10 states + Method to generate 10 states between HIGH, MEDIUM, LOW, NONE + @return id_list- (list) list of 10 states """ state_list = choices(list(ALARM_PRIORITIES), k=10) return state_list @@ -105,16 +100,13 @@ def set_the_alarm(alarm_id_list, state_list, flags=None): """ Method to set the alarm - @param alarm_id_list: List of Alarm IDs - @param state_list: List of Alarm States(HIGH/MEDIUM/LOW) - @flags: (int) See 'cmd_make_alarm_flags' + @param alarm_id_list - (list) List of Alarm IDs + @param state_list - (list)List of Alarm States(HIGH/MEDIUM/LOW) + @flags - (int) See 'cmd_make_alarm_flags' """ test.startSection("Settings Alarms") for index, alarm_id in enumerate(alarm_id_list): - test.log("Setting alarm priority '{priority}'".format(priority=ALARM_PRIORITIES[state_list[index]]) + - " for Alarm ID '{alarm_id}' ".format(alarm_id=alarm_id) + - "and its respective message '{msg}'".format(msg=ALARM_ID_AND_MESSAGES[alarm_id])) - + test.log("Setting alarm priority '{}' for Alarm ID '{}' and its respective message '{}'".format(ALARM_PRIORITIES[state_list[index]], alarm_id, ALARM_ID_AND_MESSAGES[alarm_id])) alarm.cmd_activate_alarm_id(state=state_list[index], alarm=alarm_id, flags=flags) @@ -123,10 +115,9 @@ def arrange_the_alarm_list(alarm_id_list, accept=ACCEPTED, reason_id=0): """ - Method to arrange the alarm list - and Accept or Reject the Alarm list - @param alarm_id_list: list of activated Alarm IDs - @param accept: Bool if the list is Accepted/Rejected + Method to arrange the alarm list and Accept or Reject the Alarm list + @param alarm_id_list - (list) list of activated Alarm IDs + @param accept: (bool) if the list is Accepted/Rejected @param reason: (int) Reason of Rejection """ arranged_alarm_list = [] @@ -147,8 +138,7 @@ def verify_alarm_list(arranged_alarm_list, accept=None, reason_id=0): """ - Method to verify the Messages under - 'Alarm list' + 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 @@ -158,13 +148,12 @@ 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=id), + scroll_to_value_on_pop_up(value=names.get_alarm_id_obj(id), container=names.o_alarm_list_container) - alarm_id = waitForObject(names.get_alarm_id_obj(id=id)) + alarm_id = waitForObject(names.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(names.get_alarm_msg_obj(msg=ALARM_ID_AND_MESSAGES[id])) test.log("Verifying 'Alarm ID'") alarm_id = pyInt(alarm_id.text.toUtf8().constData()) test.compare(alarm_id, id, @@ -233,9 +222,7 @@ 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") + 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) set_the_alarm(alarm_id_list=alarm_id_list,