def test_demo_account_link_wrong_password(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) login_page.go() login_page.demo_account_link.click() assert login_page.oAuth_login_link.text == "OAuth Login?", "Wrong text" browser.quit()
def test_interest_search_box_then_edit(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) leaderboard_page = LeaderboardPage(driver=browser) interest_page = InterestPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) interest_page.edit_interest_link.find() assert interest_page.edit_interest_link.text == "Edit Interests", "Can't find element or wrong text." interest_page.edit_interest_link.click() interest_page.interests_header_text.find() assert interest_page.interests_header_text.text == "Interests", "Can't find element or wrong text." interest_page.interest_search_box.find() interest_page.interest_search_box.input_text("science") assert interest_page.interest_catagory_science.text == "Arts & Entertainment > Movies > Science Fiction & " \ "Fantasy Films", \ "Can't find element or wrong text." interest_page.edit_interest_button_link.find() assert interest_page.edit_interest_button_link.text == "Edit Interest", "Can't find text." interest_page.edit_interest_button_link.click() # interest stats interest_page.suggest_tags_button_link.find() assert interest_page.suggest_tags_button_link.text == "Suggest Tags", "Can't find text." browser.quit()
def test_logout_elements_from_rate_videos(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) login_page.go() login_page.nom_logo_link.find() login_page.open_oAuth.find() login_page.google_auth_btn_txt.find() assert login_page.google_auth_btn_txt.text == 'Google Auth', 'Cannot find element' login_page.demo_account_link.find() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) login_page.nom_logo_link.find() # assert login_page.dashboard_link.text == 'Brand Unsafe', 'Incorrect text' logout_page = LogoutPage(driver=browser) logout_page.logout_link.find() assert logout_page.logout_link.text == 'Logout', 'Not correct text' logout_page.logout_link.click() assert logout_page.logout_text.text == 'Google Auth', 'Unexpected text' browser.quit()
def test_navigate_to_leaderboard_page(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) leaderboard_page = LeaderboardPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) # assert login_page.dashboard_link.text == 'Brand Unsafe', 'Incorrect text' leaderboard_page.leaderboard_link.click() assert leaderboard_page.leaderboard_last_7_days_text.text == 'Leaderboard - Last 7 Days', 'Incorrect text' leaderboard_page.two_days_icon.find() assert leaderboard_page.two_days_icon.text == '2 DAYS', 'Incorrect element text' leaderboard_page.two_day_amount.find() leaderboard_page.two_day_rating_txt.find() assert leaderboard_page.two_day_rating_txt.text == 'Ratings', 'Incorrect element text' leaderboard_page.svn_days_icon.find() assert leaderboard_page.svn_days_icon.text == '7 DAYS', 'Incorrect element text' leaderboard_page.svn_day_amount.find() leaderboard_page.svn_day_rating_txt.find() assert leaderboard_page.svn_day_rating_txt.text == 'Ratings', 'Incorrect element text' leaderboard_page.thirty_days_icon.find() assert leaderboard_page.thirty_days_icon.text == '30 DAYS', 'Incorrect element text' leaderboard_page.thirty_day_amount.find() leaderboard_page.thirty_day_rating_txt.find() assert leaderboard_page.thirty_day_rating_txt.text == 'Ratings', 'Incorrect element text' leaderboard_page.all_time_icon.find() assert leaderboard_page.all_time_icon.text == 'ALL-TIME', 'Incorrect element text' leaderboard_page.all_time_amount.find() leaderboard_page.all_time_rating_txt.find() assert leaderboard_page.all_time_rating_txt.text == 'Ratings', 'Incorrect element text' leaderboard_page.avatar_img.find() leaderboard_page.profile_name.find() leaderboard_page.user_rating_last_7_days.find() leaderboard_page.activities_header.find() assert leaderboard_page.activities_header.text == 'Activities', 'Incorrect element text' # Navigate to Edit Interests # Navigate to Video Rating # Navigate to Profile page # Logout browser.quit()
def test_demo_account_wrong_password(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) login_page.go() login_page.demo_account_link.click() assert login_page.oAuth_login_link.text == "OAuth Login?", "Wrong text" login_page.demo_account_password.input_text("test fail") login_page.demo_login_button.click() assert login_page.unknown_account_error.text == "Unknown account", "Text not found" browser.quit()
def test_all_interests_elements(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) leaderboard_page = LeaderboardPage(driver=browser) interest_page = InterestPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) interest_page.edit_interest_link.find() assert interest_page.edit_interest_link.text == "Edit Interests", "Can't find element or wrong text." interest_page.edit_interest_link.click() interest_page.interests_header_text.find() assert interest_page.interests_header_text.text == "Interests", "Can't find element or wrong text." interest_page.nom_logo.find() interest_page.leaderboard_lnk_from_interest.find() assert interest_page.leaderboard_lnk_from_interest.text == "Leaderboard", "Can't find element or wrong text." interest_page.rate_videos_lnk_from_interest.find() assert interest_page.rate_videos_lnk_from_interest.text == "Rate Videos", "Can't find element or wrong text." interest_page.edit_interests_from_interest.find() assert interest_page.edit_interests_from_interest.text == "Edit Interests", "Can't find element or wrong text" interest_page.edit_profile_from_interest.find() assert interest_page.edit_profile_from_interest.text == "Edit Profile", "Can't find element or wrong text." interest_page.logout_from_interest.find() assert interest_page.logout_from_interest.text == "Logout", "Can't find element or wrong text." interest_page.create_new_interest_btn.find() assert interest_page.create_new_interest_btn.text == "Create New Interest", "Can't find element or wrong text." interest_page.create_interest_dropdown.find() interest_page.interest_search_box.find() interest_page.interest_datatable_header.find() assert interest_page.interest_datatable_header.text == "Interest", "Can't find element or wrong text." interest_page.interest_datatable_sort.find() interest_page.edit_interest_button_link.find() assert interest_page.edit_interest_button_link.text == "Edit Interest", "Can't find element or wrong text." interest_page.showing_entries.find() interest_page.previous_button.find() assert interest_page.previous_button.text == "Previous", "Can't find element or wrong text." interest_page.next_button.find() assert interest_page.next_button.text == "Next", "Can't find element or wrong text." interest_page.second_page_button.find() assert interest_page.second_page_button.text == "2", "Can't find element or wrong text." interest_page.first_page_button.find() assert interest_page.first_page_button.text == "1", "Cant' find element or wrong text." browser.quit()
def test_login_success(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) assert login_page.brand_unsafe_text.text == 'Brand Unsafe', 'Unexpected dashboard link text' browser.quit()
def test_interest_dropdown(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) leaderboard_page = LeaderboardPage(driver=browser) interest_page = InterestPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) interest_page.edit_interest_link.find() assert interest_page.edit_interest_link.text == "Edit Interests", "Can't find element or wrong text." interest_page.edit_interest_link.click() interest_page.interests_header_text.find() assert interest_page.interests_header_text.text == "Interests", "Can't find element or wrong text." #add entries viewed from dropdown interest_page.create_interest_dropdown.find() interest_page.interest_show_entries_choose_10.find() interest_page.interest_show_entries_choose_10.click() # assert interest_page.interest_show_entries_amount_results.text == "Showing 1 to 10 of 1,086 entries", "Error." #prod assert interest_page.interest_show_entries_amount_results.text == "Showing 1 to 10 of 1,096 entries", "Error." #stage interest_page.interest_show_entries_choose_25.find() interest_page.interest_show_entries_choose_25.click() # assert interest_page.interest_show_entries_amount_results.text == "Showing 1 to 25 of 1,086 entries", "Error." #prod assert interest_page.interest_show_entries_amount_results.text == "Showing 1 to 25 of 1,096 entries", "Error." #stage interest_page.interest_show_entries_choose_50.find() interest_page.interest_show_entries_choose_50.click() # assert interest_page.interest_show_entries_100_results.text == "Showing 1 to 50 of 1,086 entries", "Error." #prod assert interest_page.interest_show_entries_amount_results.text == "Showing 1 to 50 of 1,096 entries", "Error." #stage interest_page.interest_show_entries_choose_100.find() interest_page.interest_show_entries_choose_100.click() interest_page.interest_show_entries_amount_results.find() # assert interest_page.interest_show_entries_amount_results.text == "Showing 1 to 100 of 1,086 entries", "Error." #prod assert interest_page.interest_show_entries_amount_results.text == "Showing 1 to 100 of 1,096 entries", "Error." #stage browser.quit()
def test_navigate_to_edit_profile(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) # assert login_page.dashboard_link.text == 'Brand Unsafe', 'Incorrect text' profile_page = ProfilePage(driver=browser) profile_page.edit_profile_link.click() assert profile_page.select_an_avatar_text.text == "Select an Avatar", "Bad locator" browser.quit()
def test_navigate_to_rate_videos_page(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) # add assertion rate_videos_page = RateVideosPage(driver=browser) rate_videos_page.rate_videos_link.click() # add assertion browser.quit()
def test_logout_from_edit_profile(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) # assert login_page.dashboard_link.text == 'Brand Unsafe', 'Incorrect text' logout_page = LogoutPage(driver=browser) profile_page = ProfilePage(driver=browser) profile_page.edit_profile_link.click() logout_page.logout_link.click() browser.quit()
def test_all_elements_login(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) login_page.go() # login login_page.nom_logo_link.find() login_page.open_oAuth.find() login_page.google_auth_btn_txt.find() assert login_page.google_auth_btn_txt.text == 'Google Auth', 'Cannot find element' login_page.demo_account_link.find() assert login_page.demo_account_link.text == 'Demo Account?', 'Cannot find element' login_page.demo_account_link.click() # demo account? login_page.password_text.find() assert login_page.password_text.text == 'Password', 'Cannot find element' login_page.demo_account_password.find() login_page.demo_login_button.find() assert login_page.demo_login_button.text == 'Demo Login', 'Cannot find element' login_page.oAuth_login_link.find() assert login_page.oAuth_login_link.text == 'OAuth Login?', 'Cannot find element' browser.quit()
def test_navigate_to_interest_page(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) leaderboard_page = LeaderboardPage(driver=browser) interest_page = InterestPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) interest_page.edit_interest_link.find() assert interest_page.edit_interest_link.text == "Edit Interests", "Can't find element or wrong text." interest_page.edit_interest_link.click() interest_page.interests_header_text.find() assert interest_page.interests_header_text.text == "Interests", "Can't find element or wrong text." browser.quit()
def test_logout_from_edit_interest(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) # assert login_page.dashboard_link.text == 'Brand Unsafe', 'Incorrect text' logout_page = LogoutPage(driver=browser) leaderboard_page = LeaderboardPage(driver=browser) interest_page = InterestPage(driver=browser) leaderboard_page.leaderboard_link.click() assert leaderboard_page.leaderboard_last_7_days_text.text == 'Leaderboard - Last 7 Days', 'Unexpeceted text not found' logout_page.logout_link.click() browser.quit()
def test_all_interests_elements_sugg_tags(): browser = webdriver.Chrome() login_page = LoginPage(driver=browser) leaderboard_page = LeaderboardPage(driver=browser) interest_page = InterestPage(driver=browser) login_page.go() login_page.open_oAuth.click() time.sleep(2) frst_win = login_page.driver.window_handles[0] sec_win = login_page.driver.window_handles[1] login_page.driver.switch_to.window(sec_win) login_page.enter_email.input_text("*****@*****.**") login_page.click_email_nxt.click() login_page.enter_pass.input_text("thisisnom1983") login_page.click_pass_nxt.click() login_page.driver.switch_to.window(frst_win) interest_page.edit_interest_link.find() assert interest_page.edit_interest_link.text == "Edit Interests", "Can't find element or wrong text." interest_page.edit_interest_link.click() interest_page.interests_header_text.find() assert interest_page.interests_header_text.text == "Interests", "Can't find element or wrong text." interest_page.nom_logo.find() interest_page.leaderboard_lnk_from_interest.find() assert interest_page.leaderboard_lnk_from_interest.text == "Leaderboard", "Can't find element or wrong text." interest_page.rate_videos_lnk_from_interest.find() assert interest_page.rate_videos_lnk_from_interest.text == "Rate Videos", "Can't find element or wrong text." interest_page.edit_interests_from_interest.find() assert interest_page.edit_interests_from_interest.text == "Edit Interests", "Can't find element or wrong text" interest_page.edit_profile_from_interest.find() assert interest_page.edit_profile_from_interest.text == "Edit Profile", "Can't find element or wrong text." interest_page.logout_from_interest.find() assert interest_page.logout_from_interest.text == "Logout", "Can't find element or wrong text." interest_page.create_new_interest_btn.find() assert interest_page.create_new_interest_btn.text == "Create New Interest", "Can't find element or wrong text." interest_page.create_interest_dropdown.find() interest_page.interest_search_box.find() interest_page.interest_datatable_header.find() assert interest_page.interest_datatable_header.text == "Interest", "Can't find element or wrong text." interest_page.interest_datatable_sort.find() interest_page.edit_interest_button_link.find() assert interest_page.edit_interest_button_link.text == "Edit Interest", "Can't find element or wrong text." interest_page.showing_entries.find() interest_page.previous_button.find() assert interest_page.previous_button.text == "Previous", "Can't find element or wrong text." interest_page.next_button.find() assert interest_page.next_button.text == "Next", "Can't find element or wrong text." interest_page.second_page_button.find() assert interest_page.second_page_button.text == "2", "Can't find element or wrong text." interest_page.first_page_button.find() assert interest_page.first_page_button.text == "1", "Cant' find element or wrong text." # interest page stats interest_page.edit_interest_button_link.click() interest_page.suggest_tags_button_link.find() interest_page.interest_title.find() interest_page.datatable_tag_name_header.find() assert interest_page.datatable_tag_name_header.text == "Tag Name", "Can't find element or wrong text." interest_page.datatable_system_tag_header.find() assert interest_page.datatable_system_tag_header.text == "System Tag", "Can't find element or wrong text." interest_page.nom_logo.find() interest_page.leaderboard_lnk_from_interest.find() assert interest_page.leaderboard_lnk_from_interest.text == "Leaderboard", "Can't find element or wrong text." interest_page.rate_videos_lnk_from_interest.find() assert interest_page.rate_videos_lnk_from_interest.text == "Rate Videos", "Can't find element or wrong text." interest_page.edit_interests_from_interest.find() assert interest_page.edit_interests_from_interest.text == "Edit Interests", "Can't find element or wrong text" interest_page.edit_profile_from_interest.find() assert interest_page.edit_profile_from_interest.text == "Edit Profile", "Can't find element or wrong text." interest_page.logout_from_interest.find() assert interest_page.logout_from_interest.text == "Logout", "Can't find element or wrong text." # suggest tags page interest_page.suggest_tags_button_link.click() interest_page.interest_title_header.find() interest_page.interest_text_instructions.find() interest_page.go_back_button.find() interest_page.interest_current_tags.find() interest_page.tags_research_title.find() interest_page.tags_research_text_instructions.find() interest_page.tags_research_text_box.find() interest_page.tags_research_clear_list_btn.find() interest_page.tags_suggest_tags_btn.find() interest_page.suggested_tags_header.find() interest_page.suggested_dropdown.find() interest_page.suggested_tags_search_box.find() interest_page.suggested_tags_tag_name_datatable_header.find() interest_page.suggested_tags_system_tag_datatable_header.find() interest_page.suggested_tags_score_datatable_header.find() interest_page.suggested_tags_matched_datatable_header.find() interest_page.suggested_tags_top_matches_datatable_header.find() interest_page.suggested_tags_show_entries_results.find() interest_page.suggested_tags_previous_btn.find() interest_page.suggested_tags_next_btn.find() interest_page.nom_logo.find() interest_page.leaderboard_lnk_from_interest.find() assert interest_page.leaderboard_lnk_from_interest.text == "Leaderboard", "Can't find element or wrong text." interest_page.rate_videos_lnk_from_interest.find() assert interest_page.rate_videos_lnk_from_interest.text == "Rate Videos", "Can't find element or wrong text." interest_page.edit_interests_from_interest.find() assert interest_page.edit_interests_from_interest.text == "Edit Interests", "Can't find element or wrong text" interest_page.edit_profile_from_interest.find() assert interest_page.edit_profile_from_interest.text == "Edit Profile", "Can't find element or wrong text." interest_page.logout_from_interest.find() assert interest_page.logout_from_interest.text == "Logout", "Can't find element or wrong text." browser.quit()