def create_region_for_awesome_bar(): """Create region for the awesome bar.""" try: identity_icon_pattern = LocationBar.IDENTITY_ICON page_action_pattern = LocationBar.PAGE_ACTION_BUTTON return RegionUtils.create_region_from_patterns( left=page_action_pattern, right=identity_icon_pattern) except FindError: raise APIHelperError("Could not create region for awesome bar.")
def create_region_for_hamburger_menu(): """Create region for hamburger menu pop up.""" hamburger_menu_pattern = NavBar.HAMBURGER_MENU try: wait(hamburger_menu_pattern, 10) click(hamburger_menu_pattern) sign_in_to_firefox_pattern = Pattern("sign_in_to_firefox.png").similar(0.6) wait(sign_in_to_firefox_pattern, 10) if OSHelper.is_linux(): quit_menu_pattern = Pattern("quit.png").similar(0.6) wait(quit_menu_pattern, 5) return RegionUtils.create_region_from_patterns( None, sign_in_to_firefox_pattern, quit_menu_pattern, None, padding_right=20, ) elif OSHelper.is_mac(): help_menu_pattern = Pattern("help.png") wait(help_menu_pattern, 5) return RegionUtils.create_region_from_patterns( None, sign_in_to_firefox_pattern, help_menu_pattern, None, padding_right=20, ) else: exit_menu_pattern = Pattern("exit.png").similar(0.6) wait(exit_menu_pattern, 5) return RegionUtils.create_region_from_patterns( None, sign_in_to_firefox_pattern, exit_menu_pattern, None, padding_right=20, ) except (FindError, ValueError): raise APIHelperError( "Can't create a region for the hamburger menu, aborting test." )
def create_region_for_url_bar(): """Create region for the right side of the url bar.""" try: hamburger_menu_pattern = NavBar.HAMBURGER_MENU show_history_pattern = LocationBar.HISTORY_DROPMARKER select_location_bar() return RegionUtils.create_region_from_patterns(show_history_pattern, hamburger_menu_pattern, padding_top=20, padding_bottom=20) except FindError: raise APIHelperError("Could not create region for URL bar.")