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_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_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, 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_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_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_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_leaderboard_layout_for_guest_users(self, mozwebqa): start_page = StartPage(mozwebqa) leaderboard_page = start_page.click_leaderboard_link() Assert.contains('Top Affiliates', leaderboard_page.title) Assert.greater('Leaderboard is empty', 0, leaderboard_page.leaderboard_user_count) for user_row in leaderboard_page.leaderboard_user_rows: Assert.true('Row not visible. Row info: %s' % user_row, user_row.is_row_visible())
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, 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) home_page = start_page.create_new_account() 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() Assert.true(logged_in.is_user_logged_in)
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_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_new_account_creation(self, mozwebqa): start_page = StartPage(mozwebqa) credentials = start_page.get_new_persona_credentials() home_page = start_page.login_with_credentials(credentials) 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_with_credentials(credentials) Assert.true(logged_in.is_user_logged_in)
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, 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 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_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_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_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_login(browser): start_page = StartPage(browser) start_page.open_base_page() start_page.start_page_is_open() first = start_page.get_first_post_src() start_page.open_login_page() login_page = LoginPage(browser) login_page.login_page_is_open() login_page.login(su_name, su_pass) admin_page = AdminPage(browser) admin_page.admin_page_is_open() admin_page.delete_post() admin_page.open_start_page() second = start_page.get_first_post_src() assert first != second, 'error second img equal first img'
def logout(self): self._hover_user_menu() self.selenium.find_element(*self._logout_locator).click() WebDriverWait(self.selenium, self.timeout).until(lambda s: not self.is_user_logged_in) from pages.start_page import StartPage return StartPage(self.testsetup)
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 = "******" % (datetime.now()) start_page = StartPage(mozwebqa) credentials = start_page.get_new_persona_credentials() home_page = start_page.login_with_credentials(credentials) 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_with_credentials(credentials) 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 setup(self): driver = webdriver.Chrome( executable_path= '/home/wing/PycharmProjects/QAComplexApp/drivers/chromedriver') # Open start page driver.get(start_page_constants.START_PAGE_URL) start_page = StartPage(driver) yield start_page driver.close()
def test_edit_profile_change_display_name(self, mozwebqa): new_username = "******" % (datetime.now()) start_page = StartPage(mozwebqa) credentials = start_page.get_new_persona_credentials() home_page = start_page.login_with_credentials(credentials) 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_with_credentials(credentials) 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, 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_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 __init__(self, driver, base_url): self.wd = driver self.wd.implicitly_wait(5) self.wd.get(base_url) self.wait = WebDriverWait(driver, 5) self.wd.maximize_window() self.start_page = StartPage(driver, base_url) self.authent_page = AuthenticationPage(driver, base_url) self.create_acc = CreateAccount(driver, base_url) self.myAcc = MyAccount(driver, base_url)
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 __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) # Container defenition container = tk.Frame(self) container.pack(side="top", fill="both", expand=True) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} frame = StartPage(container, self) self.frames[StartPage] = frame frame.grid(row=0, column=0, sticky="nsew") self.show_frame(StartPage)
class Application: def __init__(self): self.driver = webdriver.Chrome() self.start_page = StartPage(self.driver) self.product_page = ProductPage(self.driver) self.base_page = BasePage(self.driver) self.cart_page = CartPage(self.driver) def quit(self): self.driver.quit() def add_product_to_cart(self): self.start_page.open() self.start_page.open_first_product_page() self.product_page.add_product_to_cart() # self.base_page.go_home() def delete_product_from_cart(self): self.cart_page.open() self.cart_page.remove_product_from_cart()
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_profiles_website(self, mozwebqa): start_page = StartPage(mozwebqa) new_url = 'http://wiki.mozilla.org/' + datetime.utcnow().strftime("%s") credentials = start_page.get_new_persona_credentials() home_page = start_page.login_with_credentials(credentials) 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_with_credentials(credentials) 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_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)