def test_about_page_has_proper_titles(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() about_page = home_page.click_about_nav_link() Assert.true(about_page.is_the_current_url) Assert.equal(about_page.faq_header, 'Frequently Asked Questions')
def test_about_page_faq_answers_present(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() about_page = home_page.click_about_nav_link() Assert.equal(about_page.questions_count, about_page.answers_count, 'Questions count did not match answers count')
def test_login_logout_works_properly(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() Assert.true(home_page.is_user_logged_in, 'User not logged in') Assert.equal(home_page.header, 'Follow these easy steps to get started:') home_page.click_logout() Assert.false(home_page.is_user_logged_in, 'User logged in') Assert.equal(start_page.header, 'Become a Firefox Affiliate Today!')
def test_login_logout_works_properly(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() Assert.true(home_page.is_user_logged_in, 'User not logged in') Assert.equal(home_page.header, 'Dashboard') home_page.logout() Assert.false(home_page.is_user_logged_in, 'User logged in') Assert.equal(start_page.header, 'Become a Firefox Affiliate today!')
def test_about_page(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() about_page = home_page.click_about_nav_button() Assert.equal(home_page.header, 'About Affiliates') Assert.true(about_page.is_the_current_url) Assert.not_none(about_page.about_text)
def test_login_logout_works_properly(self, base_url, selenium, existing_user): start_page = StartPage(base_url, selenium) home_page = start_page.login(existing_user['email'], existing_user['password']) assert home_page.is_user_logged_in assert 'Dashboard' == home_page.header home_page.logout() assert not home_page.is_user_logged_in assert 'Important Notice: Firefox Affiliates is being discontinued' == start_page.header
def test_about_page(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() about_page = home_page.click_about_nav_button() Assert.equal(home_page.header, "About Affiliates") Assert.true(about_page.is_the_current_url) Assert.not_none(about_page.about_text)
def test_edit_profile_has_proper_display_name(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() username = mozwebqa.credentials["default"]["name"] edit_page = home_page.click_edit_profile() Assert.equal(home_page.header, "Edit your user profile") Assert.equal(edit_page.get_label_text_for("display_name"), "DISPLAY NAME") Assert.equal(edit_page.get_input_text_for("display_name"), username)
def test_change_banner_size_correct(self, mozwebqa): size = '300x250' start_page = StartPage(mozwebqa) home_page = start_page.login() home_page.categories[0].select_category() home_page.categories[0].select_category() home_page.select_size(size) Assert.contains(size, home_page.banner_size_text)
def test_edit_profile_has_proper_display_name(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() username = mozwebqa.credentials['default']['name'] edit_page = home_page.click_edit_profile() Assert.equal(home_page.header, 'Edit your user profile') Assert.equal(edit_page.get_label_text_for('display_name'), 'DISPLAY NAME') Assert.equal(edit_page.get_input_text_for('display_name'), username)
def test_change_banner_size_correct(self, mozwebqa): size = "180x150" start_page = StartPage(mozwebqa) home_page = start_page.login() home_page.categories[0].select_category() home_page.categories[0].select_category() home_page.select_size(size) Assert.contains(size, home_page.banner_html_code)
def test_edit_profile_has_proper_display_name(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() username = mozwebqa.credentials['default']['name'] edit_page = home_page.click_profile() Assert.equal(home_page.header, username) edit_page_modal = edit_page.click_edit_profile() Assert.equal(edit_page_modal.display_name_label, 'DISPLAY NAME') Assert.equal(edit_page_modal.display_name, username)
def test_about_page_has_proper_layout(self, base_url, selenium, existing_user): start_page = StartPage(base_url, selenium) home_page = start_page.login(existing_user['email'], existing_user['password']) about_page = home_page.click_about_nav_link() assert about_page.is_the_current_url assert 'Frequently Asked Questions' == about_page.faq_header assert about_page.about_text is not None, 'about page has no text to display' assert about_page.category_count > 0, 'FAQ category not present' assert about_page.questions_count > 0, 'No faq questions present in about page' about_page = home_page.click_about_nav_link() assert about_page.questions_count == about_page.answers_count, 'Questions count did not match answers count'
def test_about_page_has_proper_layout(self, mozwebqa, existing_user): start_page = StartPage(mozwebqa) home_page = start_page.login(existing_user["email"], existing_user["password"]) about_page = home_page.click_about_nav_link() assert about_page.is_the_current_url assert "Frequently Asked Questions" == about_page.faq_header assert about_page.about_text is not None, "about page has no text to display" assert about_page.category_count > 0, "FAQ category not present" assert about_page.questions_count > 0, "No faq questions present in about page" about_page = home_page.click_about_nav_link() assert about_page.questions_count == about_page.answers_count, "Questions count did not match answers count"
def test_edit_profile_has_proper_display_name(self, mozwebqa): if mozwebqa.base_url == 'https://affiliates-dev.allizom.org': pytest.xfail(reason='Bug 897575 - [dev][traceback] Unable to register new accounts') start_page = StartPage(mozwebqa) home_page = start_page.login() username = mozwebqa.credentials['default']['name'] edit_page = home_page.click_edit_profile() Assert.equal(home_page.header, 'Edit your user profile') Assert.equal(edit_page.get_label_text_for('display_name'), 'DISPLAY NAME') Assert.equal(edit_page.get_input_text_for('display_name'), username)
def test_new_account_creation(self, mozwebqa): start_page = StartPage(mozwebqa) email, password = start_page._create_persona_test_user() home_page = start_page.login(email, password) Assert.true(home_page.is_user_logged_in) logged_out = home_page.logout() Assert.false(logged_out.is_user_logged_in) logged_in = logged_out.login(email, password) Assert.true(logged_in.is_user_logged_in)
def test_verify_layout_logged_in_user(self, base_url, selenium, existing_user): start_page = StartPage(base_url, selenium) home_page = start_page.login(existing_user['email'], existing_user['password']) edit_page = home_page.click_profile() assert edit_page.is_stats_section_visible assert edit_page.is_stats_ranking_visible assert edit_page.stats_ranking is not None assert edit_page.is_stats_banners_visible assert edit_page.stats_banners is not None assert edit_page.is_stats_clicks_visible assert edit_page.stats_clicks is not None assert edit_page.is_milestones_section_visible
def test_verify_layout_logged_in_user(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() edit_page = home_page.click_profile() Assert.true(edit_page.is_stats_section_visible()) Assert.true(edit_page.is_stats_ranking_visible()) Assert.not_none(edit_page.stats_ranking, 'Stats rankings is null') Assert.true(edit_page.is_stats_banners_visible()) Assert.not_none(edit_page.stats_banners, 'Stats banners is null') Assert.true(edit_page.is_stats_clicks_visible()) Assert.not_none(edit_page.stats_clicks, 'Stats clickss is null') Assert.true(edit_page.is_milestones_section_visible()) Assert.true(edit_page.is_newsletter_form_visible())
def test_get_started_3_steps(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() Assert.true(home_page.is_the_current_url) Assert.greater(home_page.category_count, 0, "There is no categories in list") Assert.not_none(home_page.categories[0].name) Assert.true(home_page.is_step_button_selected("first")) # Select first Category in list home_page.categories[0].select_category() Assert.true(home_page.is_step_button_selected("second")) Assert.not_none(home_page.categories[0].name) # Select first Banner in list home_page.categories[0].select_category() Assert.true(home_page.is_step_button_selected("third"))
def test_get_started_3_steps(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() Assert.true(home_page.is_the_current_url) Assert.greater(home_page.category_count, 0, 'There are no categories in the list') Assert.not_none(home_page.categories[0].name) Assert.true(home_page.is_step_button_selected('first')) # select the first category in the list home_page.categories[0].select_category('second') Assert.true(home_page.is_step_button_selected('second')) Assert.not_none(home_page.categories[0].name) # select the first banner in list home_page.categories[0].select_category('third') Assert.true(home_page.is_step_button_selected('third'))
def test_edit_profile_has_proper_display_name(self, mozwebqa): if mozwebqa.base_url == 'https://affiliates-dev.allizom.org': pytest.xfail( reason= 'Bug 897575 - [dev][traceback] Unable to register new accounts' ) start_page = StartPage(mozwebqa) home_page = start_page.login() username = mozwebqa.credentials['default']['name'] edit_page = home_page.click_edit_profile() Assert.equal(home_page.header, 'Edit your user profile') Assert.equal(edit_page.get_label_text_for('display_name'), 'DISPLAY NAME') Assert.equal(edit_page.get_input_text_for('display_name'), username)
def test_faq_page(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() faq_page = home_page.click_faq_nav_button() Assert.equal(home_page.header, "FAQs") Assert.true(faq_page.is_the_current_url) Assert.true(faq_page.questions_count > 0) # Pick one question from each section for i in range(4): i += 1 Assert.not_none(faq_page.questions_text) faq_page.expand_question_by_section(i) Assert.not_none(faq_page.answer(i))
def test_faq_page(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() faq_page = home_page.click_faq_nav_button() Assert.equal(home_page.header, 'FAQs') Assert.true(faq_page.is_the_current_url) Assert.true(faq_page.questions_count > 0) #Pick one question from each section for i in range(4): i += 1 Assert.not_none(faq_page.questions_text) faq_page.expand_question_by_section(i) Assert.not_none(faq_page.answer(i))
def test_about_page_has_proper_layout(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() about_page = home_page.click_about_nav_link() Assert.true(about_page.is_the_current_url) Assert.equal(about_page.faq_header, 'Frequently Asked Questions', 'Expected title: Frequently Asked Questions') Assert.not_none(about_page.about_text, 'about page has no text to display') Assert.true(about_page.category_count > 0, 'FAQ category not present') Assert.true(about_page.questions_count > 0, 'No faq questions present in about page') about_page = home_page.click_about_nav_link() Assert.equal(about_page.questions_count, about_page.answers_count, 'Questions count did not match answers count')
def test_edit_profile_change_display_name(self, mozwebqa): new_username = "******" % \ (mozwebqa.credentials['default']['name'], str(datetime.now())) start_page = StartPage(mozwebqa) home_page = start_page.login() profile_page = home_page.click_profile() # verify changing username, update username to include a timestamp profile_page.update_profile_name(new_username) actual_username = profile_page.profile_username Assert.equal(actual_username , new_username, "Failed: username on profile page failed to update. Expected: '%s' \ , but returned '%s'" % (new_username, actual_username)) leader_board_page = profile_page.click_leaderboard_link() Assert.equal(leader_board_page.username, new_username.upper(), "Failed: username in header of leaderboard failed to update. \ Expected '%s', but returned '%s'" % (new_username.upper(), leader_board_page.username)) # verify username persists after logging out and then logging back in logged_out = profile_page.logout() home_page = logged_out.login() profile_page = home_page.click_profile() actual_username = profile_page.profile_username Assert.equal(actual_username, new_username, "Failed: update to username did not persist after logout. \ Expected '%s', but returned '%s'" % (new_username, actual_username)) # verify user can leave username field empty profile_page.update_profile_name("") actual_username = profile_page.profile_username Assert.equal(actual_username, "Affiliate", "Failed: leaving username blank should default profile username \ to 'Affiliate'. Expected 'Affiliate', but returned '%s'" % actual_username)
def test_edit_profile_change_display_name(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login("technical_debt") username = mozwebqa.credentials["technical_debt"]["name"] edit_page = home_page.click_edit_profile() edit_page.set_input_text_for("display_name", "affiliates_name") edit_page.click_cancel() Assert.equal(home_page.username, username) home_page.click_edit_profile() new_name = "affiliates_test" edit_page.set_input_text_for("display_name", new_name) edit_page.click_save_my_changes() Assert.equal(home_page.username, new_name) # Back changes to normal home_page.click_edit_profile() edit_page.set_input_text_for("display_name", username) edit_page.click_save_my_changes()
def test_edit_profile_change_display_name(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login('technical_debt') username = mozwebqa.credentials['technical_debt']['name'] edit_page = home_page.click_edit_profile() edit_page.set_input_text_for('display_name', 'affiliates_name') edit_page.click_cancel() Assert.equal(home_page.username, username) home_page.click_edit_profile() new_name = 'affiliates_test' edit_page.set_input_text_for('display_name', new_name) edit_page.click_save_my_changes() Assert.equal(home_page.username, new_name) # revert changes home_page.click_edit_profile() edit_page.set_input_text_for('display_name', username) edit_page.click_save_my_changes()
def test_edit_profile_change_display_name(self, mozwebqa, existing_user): start_page = StartPage(mozwebqa) new_username = "******" % (datetime.now()) home_page = start_page.login(existing_user['email'], existing_user['password']) profile_page = home_page.click_profile() # verify changing username, update username to include a timestamp profile_page.update_profile_name(new_username) assert new_username == profile_page.profile_username, 'Username did not update' # verify username persists after logging out and then logging back in logged_out = profile_page.logout() home_page = logged_out.login(existing_user['email'], existing_user['password']) profile_page = home_page.click_profile() assert new_username == profile_page.profile_username, 'Username change did not persist after logout' # verify user can leave username field empty profile_page.update_profile_name("") assert 'Affiliate' == profile_page.profile_username, 'Blank username did not use default value'
def test_edit_profiles_website(self, base_url, selenium, existing_user): start_page = StartPage(base_url, selenium) new_url = 'http://wiki.mozilla.org/' + datetime.utcnow().strftime("%s") home_page = start_page.login(existing_user['email'], existing_user['password']) profile_page = home_page.click_profile() # update profile website to include a timestamp profile_page.update_profile_website(new_url) assert new_url == profile_page.profile_website, 'Website did not update' # verify username persists after logging out and then logging back in logged_out = profile_page.logout() home_page = logged_out.login(existing_user['email'], existing_user['password']) profile_page = home_page.click_profile() assert new_url == profile_page.profile_website, 'Website change did not persist after logout' # verify user can leave website field empty profile_page.update_profile_website("") assert '' == profile_page.profile_website, 'Blank website was not accepted'
def test_edit_profile_set_website(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() edit_page = home_page.click_profile() edit_page_modal = edit_page.click_edit_profile() edit_page_modal.set_website('http://wiki.mozilla.com/') edit_page_modal.click_save_my_changes() Assert.true(edit_page.is_website_visible()) Assert.equal(edit_page.view_website, 'http://wiki.mozilla.com/', "Failed because expected 'http://wiki.mozilla.com' but returned " + edit_page.view_website) # verify user can leave website field empty edit_page_modal = edit_page.click_edit_profile() edit_page_modal.set_website('') edit_page_modal.click_save_my_changes() edit_page_modal = edit_page.click_edit_profile() Assert.equal(edit_page_modal.website, '', 'Clearing the website field failed.')
def test_edit_profile_change_display_name(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login('technical_debt') username = mozwebqa.credentials['technical_debt']['name'] edit_page = home_page.click_profile() edit_page_modal = edit_page.click_edit_profile() edit_page_modal.set_display_name('affiliates_name') edit_page_modal.click_cancel() Assert.equal(home_page.username, username.upper()) edit_page_modal = edit_page.click_edit_profile() new_name = 'affiliates_test' edit_page_modal.set_display_name(new_name) edit_page_modal.click_save_my_changes() Assert.equal(home_page.username, new_name.upper()) # revert changes edit_page_modal = edit_page.click_edit_profile() edit_page_modal.set_display_name(username) edit_page_modal.click_save_my_changes()
def test_edit_profile_set_website(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() edit_page = home_page.click_profile() edit_page_modal = edit_page.click_edit_profile() edit_page_modal.set_website('http://wiki.mozilla.com/') edit_page_modal.click_save_my_changes() Assert.true(edit_page.is_website_visible()) Assert.equal( edit_page.view_website, 'http://wiki.mozilla.com/', "Failed because expected 'http://wiki.mozilla.com' but returned " + edit_page.view_website) # verify user can leave website field empty edit_page_modal = edit_page.click_edit_profile() edit_page_modal.set_website('') edit_page_modal.click_save_my_changes() edit_page_modal = edit_page.click_edit_profile() Assert.equal(edit_page_modal.website, '', 'Clearing the website field failed.')
def test_user_can_create_banner(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() create_banner_page = home_page.click_create_banner() create_banner_page.choose_category() create_banner_page.choose_banner() create_banner_page.select_language('English (US)') create_banner_page.select_size() create_banner_page.select_color() create_banner_page.click_save() Assert.true(create_banner_page.is_embeded_code_generated) # Get the id of the new banner from the page url new_banner_id = create_banner_page.get_url_current_page.split('/')[-2] create_banner_page.go_to_dashboard_page() # Get the id of the last created banner in the list last_banner_id = home_page.banners[len(home_page.banners) - 1].banner_link.split('/')[-2] #Check that the new banner is the last on the list of banners Assert.equal(new_banner_id, last_banner_id)
def test_edit_profiles_website(self, mozwebqa): start_page = StartPage(mozwebqa) new_url = 'http://wiki.mozilla.org/' + datetime.utcnow().strftime("%s") email, password = start_page._create_persona_test_user() home_page = start_page.login(email, password) profile_page = home_page.click_profile() # update profile website to include a timestamp profile_page.update_profile_website(new_url) actual_website = profile_page.profile_website Assert.equal(actual_website, new_url, "update to website on profile edit page. \ Expected '%s' but returned '%s'" % (new_url, actual_website)) # verify username persists after logging out and then logging back in logged_out = profile_page.logout() home_page = logged_out.login(email, password) profile_page = home_page.click_profile() actual_website = profile_page.profile_website Assert.equal(actual_website, new_url, "update to website did not persist after logout. \ Expected '%s', but returned '%s'" % (new_url, actual_website)) # verify user can leave website field empty profile_page.update_profile_website("") actual_website = profile_page.profile_website Assert.equal(actual_website, "", "user can't set website URL to an empty string. \ Expected '', returned '%s'" % actual_website)
def test_edit_profile_change_display_name(self, base_url, selenium, existing_user): new_username = "******" % (datetime.now()) start_page = StartPage(base_url, selenium) home_page = start_page.login(existing_user['email'], existing_user['password']) profile_page = home_page.click_profile() # verify changing username, update username to include a timestamp profile_page.update_profile_name(new_username) assert new_username == profile_page.profile_username, 'Username did not update' # verify username persists after logging out and then logging back in logged_out = profile_page.logout() home_page = logged_out.login(existing_user['email'], existing_user['password']) profile_page = home_page.click_profile() assert new_username == profile_page.profile_username, 'Username change did not persist after logout' # verify user can leave username field empty profile_page.update_profile_name("") assert 'Affiliate' == profile_page.profile_username, 'Blank username did not use default value'
def test_logged_in_user_can_reach_leaderboard(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() leaderboard_page = home_page.click_leaderboard_link() Assert.contains('Top Affiliates', leaderboard_page.title)
def test_about_page_faq_questions_present(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() about_page = home_page.click_about_nav_link() Assert.true(about_page.questions_count > 0)
def test_about_text_present(self, mozwebqa): start_page = StartPage(mozwebqa) home_page = start_page.login() about_page = home_page.click_about_nav_link() Assert.not_none(about_page.about_text)
def test_new_account_creation(self, base_url, selenium, new_user): start_page = StartPage(base_url, selenium) start_page.login(new_user['email'], new_user['password'], error=True) assert start_page.error == 'Login failed. Firefox Affiliates has stopped accepting new users.'