# Path: src/page_object_pattern/home_page.py
# class HomePage(BasePage):
#     """
#     Home page
#     """
#     SEARCH_CONTAINER = 'searchInput'
#     SEARCH_BUTTON = 'searchButton'
#     CREATE_ACCOUNT = 'pt-createaccount'
#     LOGIN = 'pt-login'
# 
#     def set_search_query(self, query: str):
#         """
#         Search for a string
#         :param query: string you are looking for
#         """
#         self._driver.find_element_by_id(HomePage.SEARCH_CONTAINER).send_keys(query)
# 
#     def check_search(self):
#         """
#         Check search button is visible
#         """
#         return self._driver.find_element_by_id(HomePage.SEARCH_BUTTON).is_displayed()
# 
#     def search(self):
#         """
#         Click on search button
#         """
#         self._driver.find_element_by_id(HomePage.SEARCH_BUTTON).click()
# 
#     def check_login(self):
#         """
#         Check Login button is visible
#         """
#         return self._driver.find_element_by_id(HomePage.LOGIN).is_displayed()
# 
#     def login(self):
#         """
#         Press login button
#         """
#         self._driver.find_element_by_id(HomePage.LOGIN).click()
# 
#     def check_create_account(self):
#         """
#         Check create account button available
#         """
#         return self._driver.find_element_by_id(HomePage.CREATE_ACCOUNT).is_displayed()
# 
#     def create_account(self):
#         """
#         Press create account button
#         """
#         self._driver.find_element_by_id(HomePage.CREATE_ACCOUNT).click()
# 
# Path: src/page_object_pattern/search_page.py
# class SearchPage(BasePage):
#     """
#     Search page
#     """
#     HEADING = 'firstHeading'
#     SEE_ALSO = 'See_also'
#     DOMAIN_ARTICLES = 'Domain-specific_articles'
#     READING = 'Further_reading'
#     REF = 'References'
#     EXTERNAL_LINKS = 'External_links'
# 
#     def heading_text(self):
#         """
#         :return: Get the heading text
#         """
#         return self._driver.find_element_by_id(SearchPage.HEADING).text
# 
#     def see_also_text(self):
#         """
#         :return: see also text
#         """
#         return self._driver.find_element_by_xpath(SearchPage.SEE_ALSO).text
# 
#     def domain_articles_text(self):
#         """
#         :return: domain article title
#         """
#         return self._driver.find_element_by_xpath(SearchPage.DOMAIN_ARTICLES).text
# 
#     def reading_text(self):
#         """
#         :return: reading text
#         """
#         return self._driver.find_element_by_xpath(SearchPage.READING).text
# 
#     def ref_text(self):
#         """
#         :return: reference text value
#         """
#         return self._driver.find_element_by_xpath(SearchPage.REF).text
# 
#     def external_links_text(self):
#         """
#         :return: external links text value
#         """
#         return self._driver.find_element_by_xpath(SearchPage.EXTERNAL_LINKS).text
# 
# Path: src/page_object_pattern/test_template.py
# class TestTemplate(unittest.TestCase):
#     def setUp(self):
#         """
#         Open the page to be tested
#         :return: the driver implementation
#         """
# 
#         self.driver = webdriver.Chrome()
#         self.driver.get("https://en.wikipedia.org/wiki/Main_Page")
# 
#     def tearDown(self):
#         """
#         Quit the browser
#         """
#         self.driver.quit()


from src.page_object_pattern.home_page import HomePage
from src.page_object_pattern.search_page import SearchPage
from src.page_object_pattern.test_template import TestTemplate
"""
Description: Test case implementation based on page object pattern and unittest

"""


class TestSearchPage(TestTemplate):
    """
    Test class for testing a search on Youtube
    """

    def test_result_found(self):
        """
        Perform searches
        """
        home_page = HomePage(self.driver)
        home_page.set_search_query("Design patterns")
        home_page.search()

# Path: src/page_object_pattern/home_page.py
# class HomePage(BasePage):
#     """
#     Home page
#     """
#     SEARCH_CONTAINER = 'searchInput'
#     SEARCH_BUTTON = 'searchButton'
#     CREATE_ACCOUNT = 'pt-createaccount'
#     LOGIN = 'pt-login'
# 
#     def set_search_query(self, query: str):
#         """
#         Search for a string
#         :param query: string you are looking for
#         """
#         self._driver.find_element_by_id(HomePage.SEARCH_CONTAINER).send_keys(query)
# 
#     def check_search(self):
#         """
#         Check search button is visible
#         """
#         return self._driver.find_element_by_id(HomePage.SEARCH_BUTTON).is_displayed()
# 
#     def search(self):
#         """
#         Click on search button
#         """
#         self._driver.find_element_by_id(HomePage.SEARCH_BUTTON).click()
# 
#     def check_login(self):
#         """
#         Check Login button is visible
#         """
#         return self._driver.find_element_by_id(HomePage.LOGIN).is_displayed()
# 
#     def login(self):
#         """
#         Press login button
#         """
#         self._driver.find_element_by_id(HomePage.LOGIN).click()
# 
#     def check_create_account(self):
#         """
#         Check create account button available
#         """
#         return self._driver.find_element_by_id(HomePage.CREATE_ACCOUNT).is_displayed()
# 
#     def create_account(self):
#         """
#         Press create account button
#         """
#         self._driver.find_element_by_id(HomePage.CREATE_ACCOUNT).click()
# 
# Path: src/page_object_pattern/search_page.py
# class SearchPage(BasePage):
#     """
#     Search page
#     """
#     HEADING = 'firstHeading'
#     SEE_ALSO = 'See_also'
#     DOMAIN_ARTICLES = 'Domain-specific_articles'
#     READING = 'Further_reading'
#     REF = 'References'
#     EXTERNAL_LINKS = 'External_links'
# 
#     def heading_text(self):
#         """
#         :return: Get the heading text
#         """
#         return self._driver.find_element_by_id(SearchPage.HEADING).text
# 
#     def see_also_text(self):
#         """
#         :return: see also text
#         """
#         return self._driver.find_element_by_xpath(SearchPage.SEE_ALSO).text
# 
#     def domain_articles_text(self):
#         """
#         :return: domain article title
#         """
#         return self._driver.find_element_by_xpath(SearchPage.DOMAIN_ARTICLES).text
# 
#     def reading_text(self):
#         """
#         :return: reading text
#         """
#         return self._driver.find_element_by_xpath(SearchPage.READING).text
# 
#     def ref_text(self):
#         """
#         :return: reference text value
#         """
#         return self._driver.find_element_by_xpath(SearchPage.REF).text
# 
#     def external_links_text(self):
#         """
#         :return: external links text value
#         """
#         return self._driver.find_element_by_xpath(SearchPage.EXTERNAL_LINKS).text
# 
# Path: src/page_object_pattern/test_template.py
# class TestTemplate(unittest.TestCase):
#     def setUp(self):
#         """
#         Open the page to be tested
#         :return: the driver implementation
#         """
# 
#         self.driver = webdriver.Chrome()
#         self.driver.get("https://en.wikipedia.org/wiki/Main_Page")
# 
#     def tearDown(self):
#         """
#         Quit the browser
#         """
#         self.driver.quit()


# Path: tests/page_object_pattern/test_search_page.py
from src.page_object_pattern.home_page import HomePage
from src.page_object_pattern.search_page import SearchPage
from src.page_object_pattern.test_template import TestTemplate

"""
Description: Test case implementation based on page object pattern and unittest

"""


class TestSearchPage(TestTemplate):
    """
    Test class for testing a search on Youtube
    """

    def test_result_found(self):
        """
        Perform searches
        """
        home_page = HomePage(self.driver)
        home_page.set_search_query("Design patterns")
        home_page.search()

        result = SearchPage(self.driver)