Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r441bbd17451e0afba3c3fe9e22b3afe2f7a9d5e0 -rffa29812cc49397be901378d94e5ac7dadd24d0c --- shared/scripts/configuration/utility.py (.../utility.py) (revision 441bbd17451e0afba3c3fe9e22b3afe2f7a9d5e0) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision ffa29812cc49397be901378d94e5ac7dadd24d0c) @@ -25,55 +25,7 @@ from configuration import config from builtins import int as pyInt - -def verify_page_step_indicator(screen_obj, post_treatment_step): - """ - Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] - @param post_treatment_step : (int) indicates the Current post-treatment step - """ - test.startSection("verification of page step indicators") - for page in range(config.NUM_OF_POST_TREATMENT_BULLETS): - bullet_children = object.children(squish.waitForObjectExists(get_bullet_object(screen_obj, page))) - bullet_circle_color = bullet_children[0].color.name - #test.log() - bullet_border_color = bullet_children[0].border.color.name - step_title = squish.waitForObjectExists(get_text_object(screen_obj, config.POST_TREATMENT_SCREENS[page])) - #To verify the step indicators of the completed post treatment screens - if page < post_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) - #To verify the step indicators of the current post treatment screen - elif page == post_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.COLOR) - test.compare(step_title.color.name,config.ENABLED_COLOR_ONE) - test.verify(step_title.font.bold) - #To verify the step indicators of the remaining post 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.COLOR) - test.compare(bullet_circle_color,config.CURRENT_COLOR) - test.compare(bullet_border_color,config.COLOR) - test.endSection() - -def get_text_object(screen_obj, txt): - """ - To obtain a text object based on text provided - @param screen_obj: provides the container on which the txt must be present - @returns a real name object - """ - names.o_text_object["container"] = screen_obj - names.o_text_object["text"] = txt - return names.o_text_object - - def get_bullet_object(screen_obj, num): """ To obtain a bullet object based on occurrence provided. @@ -124,31 +76,6 @@ return False -def scroll_to_zone(zone=None, screen_object=None): - """ - scroll to the zone if object is hidden - @param zone - (obj) UI object - @param screen_object - (obj) UI object - @return boolean true and 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//2, screenHeight//2, 0, -50, squish.Qt.NoModifier) - raise LookupError("zone object is not in view to the user after trying 100 times") - - def scroll_to_zone(zone=None, screen_object=None, direction = None): """ scroll to the UI, if object is hidden @@ -194,32 +121,7 @@ return min_and_sec -def verify_parameter_from_post_treatment_log(msg_text): - """ - To obtain the details of parameter from post treatment log file. - @param msg_text: parameter to be extracted. - @returns message value and message unit - """ - try: - log_location = str(get_extracted_file()) - with open(log_location, 'r') as csv_file: - - try: - for row in csv_file: - reader = csv.reader(csv_file) - for row in reader: - row_length = sum(1 for values in row) - for row1 in row: - if row[0]!= None and row[0] == msg_text and row_length == 3: - return (row[1],row[2]) - else: - pass - except: - test.fail("Treatment log data is corrupted") - except: - test.fail("Log file is not created or log file is not created based on standard log naming format.") - def get_extracted_file(): """ This function is the handler for getting file from log folder. @@ -292,37 +194,42 @@ def verify_page_step_indicator_post_treatment(screen_obj, post_treatment_step): """ - Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] - @param post_treatment_step : (int) indicates the Current post-treatment step - + Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] + @param pre_treatment_step : indicates the Current pre-treatment step """ test.startSection("verification of page step indicators") for page in range(len(config.POST_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, config.POST_TREATMENT_SCREENS[0])) - #To verify the step indicators of the completed post-treatment screens + step_title = squish.waitForObjectExists(get_text_object(screen_obj, config.POST_TREATMENT_SCREENS[page])) + if page < post_treatment_step: + test.log("To verify the step indicator of the completed post-treatment screen " + config.POST_TREATMENT_SCREENS[page]) 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 post-treatment screen + test.compare(bullet_circle_color, config.COMPLETE_COLOR, " the bullet color must be " + str(config.COMPLETE_COLOR)) + test.compare(bullet_border_color, config.COMPLETE_COLOR," the bullet border color must be " + str(config.COMPLETE_COLOR)) + test.compare(step_title.color.name, config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) + elif page == post_treatment_step: - test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) + test.log("To verify the step indicators of the current post-treatment screen " + config.POST_TREATMENT_SCREENS[page]) + 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) - #To verify the step indicators of the remaining post-treatment screens + test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) + test.compare(bullet_border_color,config.COMPLETE_COLOR, " the bullet border color must be " + str(config.COMPLETE_COLOR)) + test.compare(step_title.color.name,config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) + test.verify(step_title.font.bold, " the current text must be in bold") + else: + test.log("To verify the step indicators of the remaining post-treatment screen " + config.POST_TREATMENT_SCREENS[page]) 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_POST_TREATMENT) - test.compare(bullet_circle_color,config.CURRENT_COLOR) - test.compare(bullet_border_color,config.INCOMPLETE_COLOR) - test.endSection() + test.compare(step_title.color.name,config.INCOMPLETE_COLOR, " the text color must be " + str(config.INCOMPLETE_COLOR)) + test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) + test.compare(bullet_border_color,config.INCOMPLETE_COLOR, " the bullet border color must be " + str(config.INCOMPLETE_COLOR)) + test.endSection() + +