########################################################################### # # Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file utils.py # # @author (last) Joseph varghese # @date (last) 15-Jan-2022 # ############################################################################ import squish import object import names import test from configuration import config def get_disinfect_bullet_object(id, screen_obj): """ To set a custom object based on item from parameters @param screen_obj (String): provides the custom container for the object @param id (String): provides the custom id for the object @returns a real name object """ names.o_disinfect_dynamic_StepBullet["container"] = screen_obj names.o_disinfect_dynamic_StepBullet["id"] = id return names.o_disinfect_dynamic_StepBullet def verify_page_step_indicator_for_disinfect(screen_obj, treatment_id, 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 screen_obj (Dict) : Parent objject of page step indicator. @param treatment_id (List) : disinfection id's for disinfection types. @param treatment_step (Int) : indicates the Current treatment step. @param treatment_screens(List): Type of disinfection. """ test.startSection("verification of page step indicators") for page in range(len(treatment_screens)): bullet_children = object.children(squish.waitForObjectExists(get_disinfect_bullet_object(treatment_id[page], screen_obj))) bullet_circle_color = bullet_children[0].color.name bullet_border_color = bullet_children[0].border.color.name step_title = squish.waitForObjectExists(get_disinfect_text_object(treatment_screens[page], screen_obj)) #To verify the step indicators of the completed treatment screens if page < treatment_step: test.verify(squish.waitForObjectExists(get_disinfect_bullet_object(treatment_id[page], screen_obj)).complete) test.verify(not squish.waitForObjectExists(get_disinfect_bullet_object(treatment_id[page], screen_obj)).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_disinfect_bullet_object(treatment_id[page], screen_obj)).current) test.verify(not squish.waitForObjectExists(get_disinfect_bullet_object(treatment_id[page], screen_obj)).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_disinfect_bullet_object(treatment_id[page], screen_obj)).current) test.verify(not squish.waitForObjectExists(get_disinfect_bullet_object(treatment_id[page], screen_obj)).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() def get_disinfect_text_object(text, screen_obj): """ To set a custom object based on item from parameters @param screen_obj (String): provides the custom container for the object @param text (String) : provides the custom text for the object @returns a real name object """ names.o_disinfect_dynamic_StepBullet_Text["container"] = screen_obj names.o_disinfect_dynamic_StepBullet_Text["text"] = text return names.o_disinfect_dynamic_StepBullet_Text