def test_add_idea(self): base_page = BasePage() base_page.get_url() base_page.click(base_page.button_add_idea) text = 'Shvabra kadabra' base_page.write_text(base_page.name_idea, text) base_page.write_text(base_page.description_ideas, text) base_page.write_text(base_page.expected_effect, text) base_page.write_text(base_page.necessary_resources, text) base_page.write_text(base_page.user_name, text) phone = '0932985505' base_page.write_text(base_page.phone_number, phone) list_select = base_page.check_is_all_elements( base_page.list_select_last_part) work_place = list_select[0] cityes = list_select[1] addres = list_select[2] base_page.click(work_place) base_page.click(cityes) list_cityes = base_page.check_is_all_elements(base_page.list_cities) some_cityes = random.choice(list_cityes) some_cityes.click() base_page.click(addres) time.sleep(5)
def test_present_elements(self): """Test present all element on home page""" home_page = HomePage() base_page = BasePage() '''Lists with locator''' header_element_list_locators = base_page.header_element_list main_nav_bar_list_elements_locator = MainNavigationMenu.main_nav_bar_list_elements launch_interactive_shell_list_locator = home_page.launch_interactive_shell_list first_part_widgets_list_locator = home_page.first_part_widget_list second_part_widget_list_locator = home_page.second_part_widget_list third_part_widget_list_locator = home_page.third_part_widget_list fourth_part_widget_list_locator = home_page.fourth_part_widget_list navigation_menu_in_footer_list_locator = base_page.navigation_menu_in_footer_list lower_part_of_footer_list_locator = base_page.lower_part_of_footer_list '''check present widget in home page''' home_page.check_element_on_page(header_element_list_locators) home_page.check_element_on_page(main_nav_bar_list_elements_locator) home_page.check_element_on_page(launch_interactive_shell_list_locator) home_page.check_element_on_page(first_part_widgets_list_locator) home_page.check_element_on_page(second_part_widget_list_locator) home_page.check_element_on_page(third_part_widget_list_locator) home_page.check_element_on_page(fourth_part_widget_list_locator) home_page.check_element_on_page(navigation_menu_in_footer_list_locator) home_page.check_element_on_page(lower_part_of_footer_list_locator)
def test_navigation_from_main_navigation_bar(self): navigator_menu = MainNavigationMenu() base_page = BasePage() success_stories_item = navigator_menu.tab_success_stories_tob_bar arts_item = navigator_menu.item_arts_locator business_item = navigator_menu.item_business_locator '''Enable drop-down menu''' base_page.enable_drop_down(success_stories_item) '''Click in item in drop-down menu''' item_arts = navigator_menu.enable_drop_down(arts_item) item_arts.click() text = 'success' current_url = base_page.get_current_url() assert (text in current_url), \ '''Check some text in url''' '''If element not fount beck in privies pages''' base_page.back_to_privies_page(business_item) '''Enable drop-down menu''' base_page.enable_drop_down(success_stories_item) '''Click in item in drop-down menu''' item_business = navigator_menu.enable_drop_down(business_item) item_business.click() text = 'business' current_url = base_page.get_current_url() assert (text in current_url), \ '''Check some text in url'''
def test_present_all_elements(self): route_url = '/about/gettingstarted/' self.add_rout_in_url_and_go_to_url(route_url) getting_started_page = GettingStarted() base_page = BasePage() elements_on_getting_started_page_locators = getting_started_page.getting_started_element_list HomePage().check_element_on_page( elements_on_getting_started_page_locators) '''Go to the iframe''' iframe_widget = IframeWidget() '''Locators in tweets widget''' psd_link = iframe_widget.the_psf_link_locator button_load_more_tweets = iframe_widget.button_load_more_tweets_locator tweets_locator = iframe_widget.tweet_locator '''Get list with the tweets''' tweets = base_page.get_list_elements(tweets_locator) len_tweets = len(tweets) print('\n---------len list--------\n' + str(len_tweets)) base_page.scroll_into_view(button_load_more_tweets) base_page.push(button_load_more_tweets) '''Get list with the tweets after click in load more tweet button''' tweets_after = base_page.get_list_elements(tweets_locator) # len_tweets_after_click = len(tweets_after) print('\n-----len after click list------\n' + str(len_tweets_after_click)) assert len_tweets < len_tweets_after_click, \ '''Check the len two list''' base_page.push(psd_link) current_url = base_page.get_current_url() expect_url = 'https://twitter.com' assert (expect_url in current_url) is False, \ '''Check on conformity expected url and current url'''
def test_button_in_top_bar(self): base_page = BasePage() button_python_locator = base_page.button_Python_header button_psf_locator = base_page.button_psf_header button_docs_locator = base_page.button_Docs_header button_pypi_locator = base_page.button_PypI_header button_jobs_locator = base_page.button_Jobs_header button_community_locator = base_page.button_Community_header """Checking top-bar menu is worked""" assert base_page.is_element_present(button_python_locator) is False, \ "Check present button Python in top-menu in main page" base_page.push(button_python_locator) assert base_page.is_element_present(button_psf_locator) is False, \ "Check present button PSF in top-menu in main page" base_page.push(button_psf_locator) assert base_page.is_element_present(button_docs_locator) is False, \ "Check present button Docs in top-menu in main page" base_page.push(button_docs_locator) base_page.back_to_privies_page(button_docs_locator) assert base_page.is_element_present(button_pypi_locator) is False, \ "Check present button PyPI in top-menu in main page" base_page.push(button_pypi_locator) base_page.back_to_privies_page(button_pypi_locator) assert base_page.is_element_present(button_jobs_locator) is False, \ "Check present button Jobs in top-menu in main page" base_page.push(button_jobs_locator) assert base_page.is_element_present(button_community_locator) is False, \ "Check present button Community in top-menu in main page" base_page.push(button_community_locator)
def test_navigation_menu_in_footer(self): base_page = BasePage() getting_started_in_footer_locator = base_page.getting_started_in_footer mac_os_x_in_footer_locator = base_page.mac_os_x_in_footer audio_visual_talks_part_footer_locator = base_page.audio_visual_talks_part_footer diversity_footer_locator = base_page.diversity_footer arts_footer_locator = base_page.arts_footer psf_news_footer_locator = base_page.psf_news_footer core_mentorship_footer_locator = base_page.core_mentorship_footer python_events_footer_locator = base_page.python_events_footer footer_locator = base_page.top_part_footer base_page.scroll_into_view(footer_locator) time.sleep(0.5) base_page.push(getting_started_in_footer_locator) current_url = base_page.get_current_url() text = 'gettingstarted' assert (text in current_url), \ '''Check is there a text in the variable url on the page''' '''---------------------------------------------------------------------------------------''' base_page.scroll_into_view(footer_locator) time.sleep(0.5) base_page.push(mac_os_x_in_footer_locator) current_url = base_page.get_current_url() text = 'mac-osx' assert (text in current_url), \ '''Check is there a text in the variable url on the page''' '''---------------------------------------------------------------------------------------''' base_page.scroll_into_view(footer_locator) time.sleep(0.5) base_page.push(audio_visual_talks_part_footer_locator) current_url = base_page.get_current_url() text = 'av' assert (text in current_url), \ '''Check is there a text in the variable url on the page''' '''---------------------------------------------------------------------------------------''' base_page.scroll_into_view(footer_locator) time.sleep(0.5) base_page.push(diversity_footer_locator) current_url = base_page.get_current_url() text = 'diversity' assert (text in current_url), \ '''Check is there a text in the variable url on the page''' '''---------------------------------------------------------------------------------------''' base_page.scroll_into_view(footer_locator) time.sleep(0.5) base_page.push(arts_footer_locator) current_url = base_page.get_current_url() text = 'arts' assert (text in current_url), \ '''Check is there a text in the variable url on the page''' '''---------------------------------------------------------------------------------------''' base_page.scroll_into_view(footer_locator) time.sleep(0.5) base_page.push(psf_news_footer_locator) current_url = base_page.get_current_url() text = 'blogspot' assert (text in current_url), \ '''Check is there a text in the variable url on the page''' '''---------------------------------------------------------------------------------------''' base_page.back_to_privies_page( core_mentorship_footer_locator ) # if element with 'core_mentorship_footer_locator' not fount back to privies page base_page.scroll_into_view(footer_locator) time.sleep(0.5) base_page.push(core_mentorship_footer_locator) current_url = base_page.get_current_url() text = 'mentorship' assert (text in current_url), \ '''Check is there a text in the variable url on the page''' '''---------------------------------------------------------------------------------------''' base_page.scroll_into_view(footer_locator) time.sleep(0.5) base_page.push(python_events_footer_locator) current_url = base_page.get_current_url() text = 'events' assert (text in current_url), \ '''Check is there a text in the variable url on the page''' '''---------------------------------------------------------------------------------------'''
def test_logo(self): base_page = BasePage() logo_locator = base_page.logo_image_link main_dropdown = MainNavigationMenu() about_in_main_menu_locator = main_dropdown.tab_about_tob_bar download_in_main_menu_locator = main_dropdown.tab_downloads_tob_bar documentation_in_main_menu_locator = main_dropdown.tab_documentation_tob_bar community_in_main_menu_locator = main_dropdown.tab_community_tob_bar success_stories_in_main_menu_locator = main_dropdown.tab_success_stories_tob_bar news_in_main_menu_locator = main_dropdown.tab_news_tob_bar events_in_main_menu_locator = main_dropdown.tab_events_tob_bar '''-----------------------------------------------------------------------------------''' base_page.push(about_in_main_menu_locator) assert base_page.is_element_present(logo_locator) is False, \ '''Check present logo on the page after click in the item About''' base_page.push(logo_locator) home_page = HomePage() launch_shel_locator = home_page.launch_interactive_shell assert base_page.is_element_present(launch_shel_locator) is False, \ '''After click on the logo, check is it the button Lounch Interactiv shell''' '''-----------------------------------------------------------------------------------''' base_page.push(download_in_main_menu_locator) assert base_page.is_element_present(logo_locator) is False, \ '''Check present logo on the page after click in the item Downloads''' base_page.push(logo_locator) home_page = HomePage() launch_shel_locator = home_page.launch_interactive_shell assert base_page.is_element_present(launch_shel_locator) is False, \ '''After click on the logo, check is it the button Lounch Interactiv shell''' '''-----------------------------------------------------------------------------------''' base_page.push(documentation_in_main_menu_locator) assert base_page.is_element_present(logo_locator) is False, \ '''After click on the logo, check present logo on the page after click in the item Documentation''' base_page.push(logo_locator) home_page = HomePage() launch_shel_locator = home_page.launch_interactive_shell assert base_page.is_element_present(launch_shel_locator) is False, \ '''Check is it the button Lounch Interactiv shell''' '''-----------------------------------------------------------------------------------''' base_page.push(community_in_main_menu_locator) assert base_page.is_element_present(logo_locator) is False, \ '''After click on the logo, check present logo on the page after click in the item Community''' base_page.push(logo_locator) home_page = HomePage() launch_shel_locator = home_page.launch_interactive_shell assert base_page.is_element_present(launch_shel_locator) is False, \ '''Check is it the button Lounch Interactiv shell''' '''-----------------------------------------------------------------------------------''' base_page.push(success_stories_in_main_menu_locator) assert base_page.is_element_present(logo_locator) is False, \ '''After click on the logo, check present logo on the page after click in the item Success Stories''' base_page.push(logo_locator) home_page = HomePage() launch_shel_locator = home_page.launch_interactive_shell assert base_page.is_element_present(launch_shel_locator) is False, \ '''Check is it the button Lounch Interactiv shell''' '''-----------------------------------------------------------------------------------''' base_page.push(news_in_main_menu_locator) assert base_page.is_element_present(logo_locator) is False, \ '''After click on the logo, check present logo on the page after click in the item News''' base_page.push(logo_locator) home_page = HomePage() launch_shel_locator = home_page.launch_interactive_shell assert base_page.is_element_present(launch_shel_locator) is False, \ '''Check is it the button Lounch Interactiv shell''' '''-----------------------------------------------------------------------------------''' base_page.push(events_in_main_menu_locator) assert base_page.is_element_present(logo_locator) is False, \ '''After click on the logo, check present logo on the page after click in the item Events''' base_page.push(logo_locator) home_page = HomePage() launch_shel_locator = home_page.launch_interactive_shell assert base_page.is_element_present(launch_shel_locator) is False, \ '''Check is it the button Lounch Interactiv shell''' path_into_screenshot = "C:/My/Projects/Pyscreen/" name_screen = "test" base_page.make_screenshot(path_into_screenshot, name_screen)
def test_drop_down_in_top_bar(self): navigator_menu = MainNavigationMenu() base_page = BasePage() documentation_item = navigator_menu.tab_documentation_tob_bar docs_item = navigator_menu.item_docs_locator talk_item = navigator_menu.item_talks_locator begin_guide_item = navigator_menu.item_begin_guide_locator develop_guide_item = navigator_menu.item_develop_guide_locator faq_item = navigator_menu.item_faq_locator english_docs_item = navigator_menu.item_english_docs_locator pep_index_item = navigator_menu.item_pep_index_locator python_books_item = navigator_menu.item_python_books_locator python_essays_item = navigator_menu.item_python_essays_locator base_page.enable_drop_down(documentation_item) navigator_menu.enable_drop_down(docs_item) assert navigator_menu.is_element_visible(docs_item) is False, \ '''Check on the main page in the main bar, documentation drop-down visible item Docs or not ''' navigator_menu.enable_drop_down(talk_item) assert navigator_menu.is_element_visible(talk_item) is False, \ '''Check on the main page in the main bar, documentation drop-down visible item Talk or not ''' navigator_menu.enable_drop_down(begin_guide_item) assert navigator_menu.is_element_visible(begin_guide_item) is False, \ '''Check on the main page in the main bar, documentation drop-down visible item Begin Guide or not ''' navigator_menu.enable_drop_down(develop_guide_item) assert navigator_menu.is_element_visible(develop_guide_item) is False, \ '''Check on the main page in the main bar, documentation drop-down visible item Guide or not ''' navigator_menu.enable_drop_down(faq_item) assert navigator_menu.is_element_visible(faq_item) is False, \ '''Check on the main page in the main bar, documentation drop-down visible item Faq or not ''' navigator_menu.enable_drop_down(english_docs_item) assert navigator_menu.is_element_visible(english_docs_item) is False, \ '''Check on the main page in the main bar, documentation drop-down visible item English Docs or not ''' navigator_menu.enable_drop_down(pep_index_item) assert navigator_menu.is_element_visible(pep_index_item) is False, \ '''Check on the main page in the main bar, documentation drop-down visible item Index or not ''' navigator_menu.enable_drop_down(python_books_item) assert navigator_menu.is_element_visible(python_books_item) is False, \ '''Check visible item Python Books or not ''' navigator_menu.enable_drop_down(python_essays_item) assert navigator_menu.is_element_visible(python_essays_item) is False, \ '''Check visible item Python Essays or not ''' success_stories_item = navigator_menu.tab_success_stories_tob_bar arts_item = navigator_menu.item_arts_locator business_item = navigator_menu.item_business_locator education_item = navigator_menu.item_education_locator engineering_item = navigator_menu.item_engineering_locator government_item = navigator_menu.item_government_locator scientific_item = navigator_menu.item_scientific_locator development_item = navigator_menu.item_development_locator base_page.enable_drop_down(success_stories_item) navigator_menu.enable_drop_down(arts_item) assert navigator_menu.is_element_visible(arts_item) is False, \ '''Check visible item Arts or not ''' navigator_menu.enable_drop_down(business_item) assert navigator_menu.is_element_visible(business_item) is False, \ '''Check visible item Business or not ''' navigator_menu.enable_drop_down(education_item) assert navigator_menu.is_element_visible(education_item) is False, \ '''Check visible item Education or not ''' navigator_menu.enable_drop_down(engineering_item) assert navigator_menu.is_element_visible(engineering_item) is False, \ '''Check visible item Engineering or not ''' navigator_menu.enable_drop_down(government_item) assert navigator_menu.is_element_visible(government_item) is False, \ '''Check visible item Government or not ''' navigator_menu.enable_drop_down(scientific_item) assert navigator_menu.is_element_visible(scientific_item) is False, \ '''Check visible item Scientific or not ''' navigator_menu.enable_drop_down(development_item) assert navigator_menu.is_element_visible(development_item) is False, \ '''Check visible item Development or not '''