def test_click_buttons(button, get_webdriver_relative_path): """ @ID: 003 @Category: integration @Description: Test buttons click and return correct page with correct title @tcmethod: automated Steps: 1. Click to each button in main page Expected: 1. Click return correct page 2. Click return correct page title """ driver = webdriver.Chrome(executable_path=get_webdriver_relative_path()) driver.get(URL) explicit_wait(TIMEOUT) driver.find_element(By.ID, button).click() static_title_from_page = driver.find_element(By.ID, ID_TEXT_TITLE).text if button == POHIRTSI_SPACE_BUTTONS_IDS.about: assert static_title_from_page == POHIRTSI_SPACE_PAGE_TITLES.about, \ f'Page title {static_title_from_page} is not correct!' elif button == POHIRTSI_SPACE_BUTTONS_IDS.history: assert static_title_from_page == POHIRTSI_SPACE_PAGE_TITLES.history, \ f'Page title {static_title_from_page} is not correct!' elif button == POHIRTSI_SPACE_BUTTONS_IDS.kindergarten: assert static_title_from_page == POHIRTSI_SPACE_PAGE_TITLES.kindergarten,\ f'Page title {static_title_from_page} is not correct!' elif button == POHIRTSI_SPACE_BUTTONS_IDS.school: assert static_title_from_page == POHIRTSI_SPACE_PAGE_TITLES.school,\ f'Page title {static_title_from_page} is not correct!' elif button == POHIRTSI_SPACE_BUTTONS_IDS.lyceum: assert static_title_from_page == POHIRTSI_SPACE_PAGE_TITLES.lyceum, \ f'Page title {static_title_from_page} is not correct!' elif button == POHIRTSI_SPACE_BUTTONS_IDS.religion: assert static_title_from_page == POHIRTSI_SPACE_PAGE_TITLES.religion, \ f'Page title {static_title_from_page} is not correct!' elif button == POHIRTSI_SPACE_BUTTONS_IDS.restaurant: assert static_title_from_page == POHIRTSI_SPACE_PAGE_TITLES.restaurant,\ f'Page title {static_title_from_page} is not correct!' elif button == POHIRTSI_SPACE_BUTTONS_IDS.news: assert static_title_from_page == POHIRTSI_SPACE_PAGE_TITLES.news,\ f'Page title {static_title_from_page} is not correct!' elif button == POHIRTSI_SPACE_BUTTONS_IDS.contacts: assert static_title_from_page == POHIRTSI_SPACE_PAGE_TITLES.contacts,\ f'Page title {static_title_from_page} is not correct!'
def test_main_images(pages, get_webdriver_url, get_image): """ @ID: 006 @Category: ui @Description: Test that all pages returns correct main image TODO: add correct images to desktop app, now this case is FAIL @tcmethod: automated Steps: 1. Click to each page in site Expected: 1. In each page main image is visible and correct """ try: for page in pages: get_webdriver_url(page=page) explicit_wait(TIMEOUT) title = get_image(page=page) if page == POHIRTSI_SPACE_TABS_LINKS.about: assert POHIRTSI_SPACE_TABS_TITLES.about == title elif page == POHIRTSI_SPACE_TABS_LINKS.history: assert POHIRTSI_SPACE_TABS_TITLES.history == title elif page == POHIRTSI_SPACE_TABS_LINKS.kindergarten: assert POHIRTSI_SPACE_TABS_TITLES.kindergarten == title elif page == POHIRTSI_SPACE_TABS_LINKS.school: assert POHIRTSI_SPACE_TABS_TITLES.school == title elif page == POHIRTSI_SPACE_TABS_LINKS.lyceum: assert POHIRTSI_SPACE_TABS_TITLES.lyceum == title elif page == POHIRTSI_SPACE_TABS_LINKS.religion: assert POHIRTSI_SPACE_TABS_TITLES.religion == title elif page == POHIRTSI_SPACE_TABS_LINKS.restaurant: assert POHIRTSI_SPACE_TABS_TITLES.restaurant == title elif page == POHIRTSI_SPACE_TABS_LINKS.news: assert POHIRTSI_SPACE_TABS_TITLES.news == title elif page == POHIRTSI_SPACE_TABS_LINKS.contacts: assert POHIRTSI_SPACE_TABS_TITLES.contacts == title else: return f'{page} is not found!' except Exception as e: print('Exception in test_main_images, ', e)
def test_logo_src(button, get_webdriver_relative_path): """ @ID: 005 @Category: ui @Description: Test that logo has correct image link in each page @tcmethod: automated Steps: 1. Click to each button in menu bar Expected: 1. In each page logo button returns correct src """ driver = webdriver.Chrome(executable_path=get_webdriver_relative_path()) driver.get(URL) explicit_wait(TIMEOUT) driver.find_element(By.ID, button).click() explicit_wait(TIMEOUT) logo = driver.find_element(By.ID, ID_LOGO_IMG) src_link = logo.get_attribute("src") explicit_wait(TIMEOUT) assert src_link == SRC_LOGO, f'SRC link {src_link} is not correct!'
def test_main_words(url, get_webdriver_relative_path): """ @ID: 007 @Category: ui @Description: Test that all pages returns correct main words @tcmethod: automated Steps: 1. Click to each page in site Expected: 1. In each page main words (Про нас/Історія/Садок..) is visible and correct """ driver = webdriver.Chrome(executable_path=get_webdriver_relative_path()) driver.get(url) explicit_wait(TIMEOUT * 2) title = driver.find_element(By.ID, ID_TEXT_TITLE) if POHIRTSI_SPACE_TABS_LINKS.about in url or url == URL: assert POHIRTSI_SPACE_PAGE_TITLES.about == title.text elif POHIRTSI_SPACE_TABS_LINKS.history in url: assert POHIRTSI_SPACE_PAGE_TITLES.history == title.text elif POHIRTSI_SPACE_TABS_LINKS.kindergarten in url: assert POHIRTSI_SPACE_PAGE_TITLES.kindergarten == title.text elif POHIRTSI_SPACE_TABS_LINKS.school in url: assert POHIRTSI_SPACE_PAGE_TITLES.school == title.text elif POHIRTSI_SPACE_TABS_LINKS.lyceum in url: assert POHIRTSI_SPACE_PAGE_TITLES.lyceum == title.text elif POHIRTSI_SPACE_TABS_LINKS.religion in url: assert POHIRTSI_SPACE_PAGE_TITLES.religion == title.text elif POHIRTSI_SPACE_TABS_LINKS.restaurant in url: assert POHIRTSI_SPACE_PAGE_TITLES.restaurant == title.text elif POHIRTSI_SPACE_TABS_LINKS.news in url: assert POHIRTSI_SPACE_PAGE_TITLES.news == title.text elif POHIRTSI_SPACE_TABS_LINKS.contacts in url: assert POHIRTSI_SPACE_PAGE_TITLES.contacts == title.text else: return f'{url} is not found!'
def test_navigation_table(url, get_webdriver_relative_path): """ @ID: 004 @Category: integration @Description: Test that all pages returns correct navigation bar @tcmethod: automated Steps: 1. Click to each button in main page Expected: 1. In each page navigation bar returns all buttons """ driver = webdriver.Chrome(executable_path=get_webdriver_relative_path()) explicit_wait(TIMEOUT) driver.get(url=url) explicit_wait(TIMEOUT * 2) elements = driver.find_element(By.ID, ID_MENU_BAR).text new_elements = elements.rstrip() assert new_elements == MENU_BAR_STR
def test_titles(get_webdriver_url, get_title): """ @ID: 009 @Category: ui @Description: Test that all pages returns correct title at the top in browser menu @tcmethod: automated Steps: 1. Click to each page in site Expected: 1. In each page title is correct """ for page in PAGES: get_webdriver_url(page=page) explicit_wait(TIMEOUT // 2) title = get_title(page=page) if page == POHIRTSI_SPACE_TABS_LINKS.about: assert POHIRTSI_SPACE_TABS_TITLES.about == title elif page == POHIRTSI_SPACE_TABS_LINKS.history: assert POHIRTSI_SPACE_TABS_TITLES.history == title elif page == POHIRTSI_SPACE_TABS_LINKS.kindergarten: assert POHIRTSI_SPACE_TABS_TITLES.kindergarten == title elif page == POHIRTSI_SPACE_TABS_LINKS.school: assert POHIRTSI_SPACE_TABS_TITLES.school == title elif page == POHIRTSI_SPACE_TABS_LINKS.lyceum: assert POHIRTSI_SPACE_TABS_TITLES.lyceum == title elif page == POHIRTSI_SPACE_TABS_LINKS.religion: assert POHIRTSI_SPACE_TABS_TITLES.religion == title elif page == POHIRTSI_SPACE_TABS_LINKS.restaurant: assert POHIRTSI_SPACE_TABS_TITLES.restaurant == title elif page == POHIRTSI_SPACE_TABS_LINKS.news: assert POHIRTSI_SPACE_TABS_TITLES.news == title elif page == POHIRTSI_SPACE_TABS_LINKS.contacts: assert POHIRTSI_SPACE_TABS_TITLES.contacts == title else: return f'{page} is not found!'