# Path: src/factory/pages/menu.py
# class Menu(object):
#     """
#     A couple of menu actions are implemented in Menu class
#     """
#     MENU_BUTTON = '#appbar-guide-button > span > span'
#     TREND_BUTTON = '//*[@id="trending-guide-item"]/a/span/span[2]/span'
#     HISTORY_BUTTON = '//*[@id="history-guide-item"]/a/span/span[2]'
#     BROWSE = '//*[@id="guide_builder-guide-item"]/a/span/span[2]/span'
# 
#     def __init__(self, driver: Union[Chrome, Firefox]):
#         """
# 
#         :param driver: browser driver
#         :type driver: object
#         """
#         self.__driver = driver
# 
#     def menu_button(self):
#         """
#         Click on menu
#         """
#         click_retry(self.__driver, self.MENU_BUTTON, 'css_selector')
# 
#     def filter_by_trend(self):
#         """
#         Sort results by trend
#         """
#         click_retry(self.__driver, self.TREND_BUTTON, 'xpath')
# 
#     def filter_by_history(self):
#         """
#         Sort results by history
#         """
#         click_retry(self.__driver, self.HISTORY_BUTTON, 'xpath')
# 
#     def browse(self):
#         """
#         Browse channels
#         """
#         click_retry(self.__driver, self.BROWSE, 'xpath')
# 
# Path: src/factory/pages/search.py
# class Search(object):
#     """
#     Search page methods implementation
#     """
#     SEARCH_CONTAINER = '//*[@id="masthead-search-term"]'
#     SEARCH_BUTTON = '//*[@id="search-btn"]'
# 
#     def __init__(self, driver: Union[Chrome, Firefox]):
#         """
# 
#         :param driver: browser driver
#         :type driver: object
#         """
#         self.__driver = driver
# 
#     def search(self):
#         """
#         Click on search button
#         """
#         self.__driver.find_element_by_xpath(Search.SEARCH_BUTTON).click()
# 
#     def set_query(self, query):
#         """
#         Set query
#         :return:
#         :rtype:
#         """
#         self.__driver.find_element_by_xpath(Search.SEARCH_CONTAINER).send_keys(query)


from abc import ABCMeta, abstractmethod
from typing import Union
from selenium.webdriver import Chrome, Firefox
from src.factory.pages.menu import Menu
from src.factory.pages.search import Search
"""
Description:
* An interface is defined for creating an object.
* Comparing to simple factory, subclasses decide which class is instantiated.

@author: Paul Bodean
@date: 12/08/2017
"""



class Component(object):
    """
    Abstract class defining how a tested component will look
    """

    @abstractmethod
    def set_name(self):
        pass

    @abstractmethod
    def get_actions(self, *args):
        pass



# Path: src/factory/pages/menu.py
# class Menu(object):
#     """
#     A couple of menu actions are implemented in Menu class
#     """
#     MENU_BUTTON = '#appbar-guide-button > span > span'
#     TREND_BUTTON = '//*[@id="trending-guide-item"]/a/span/span[2]/span'
#     HISTORY_BUTTON = '//*[@id="history-guide-item"]/a/span/span[2]'
#     BROWSE = '//*[@id="guide_builder-guide-item"]/a/span/span[2]/span'
# 
#     def __init__(self, driver: Union[Chrome, Firefox]):
#         """
# 
#         :param driver: browser driver
#         :type driver: object
#         """
#         self.__driver = driver
# 
#     def menu_button(self):
#         """
#         Click on menu
#         """
#         click_retry(self.__driver, self.MENU_BUTTON, 'css_selector')
# 
#     def filter_by_trend(self):
#         """
#         Sort results by trend
#         """
#         click_retry(self.__driver, self.TREND_BUTTON, 'xpath')
# 
#     def filter_by_history(self):
#         """
#         Sort results by history
#         """
#         click_retry(self.__driver, self.HISTORY_BUTTON, 'xpath')
# 
#     def browse(self):
#         """
#         Browse channels
#         """
#         click_retry(self.__driver, self.BROWSE, 'xpath')
# 
# Path: src/factory/pages/search.py
# class Search(object):
#     """
#     Search page methods implementation
#     """
#     SEARCH_CONTAINER = '//*[@id="masthead-search-term"]'
#     SEARCH_BUTTON = '//*[@id="search-btn"]'
# 
#     def __init__(self, driver: Union[Chrome, Firefox]):
#         """
# 
#         :param driver: browser driver
#         :type driver: object
#         """
#         self.__driver = driver
# 
#     def search(self):
#         """
#         Click on search button
#         """
#         self.__driver.find_element_by_xpath(Search.SEARCH_BUTTON).click()
# 
#     def set_query(self, query):
#         """
#         Set query
#         :return:
#         :rtype:
#         """
#         self.__driver.find_element_by_xpath(Search.SEARCH_CONTAINER).send_keys(query)


# Path: src/factory/factory_method.py
from abc import ABCMeta, abstractmethod
from typing import Union
from selenium.webdriver import Chrome, Firefox
from src.factory.pages.menu import Menu
from src.factory.pages.search import Search

"""
Description:
* An interface is defined for creating an object.
* Comparing to simple factory, subclasses decide which class is instantiated.

@author: Paul Bodean
@date: 12/08/2017
"""



class Component(object):
    """
    Abstract class defining how a tested component will look
    """

    @abstractmethod
    def set_name(self):
        pass

    @abstractmethod
    def get_actions(self, *args):
        pass



class SearchComponent(Component, Search):