def test_contributor_flow_to_support_forum_post(self, mozwebqa, variables): """ Shows a contributor can start on the home page and move all the way to answering a question in the forum. """ # 1. Start on the home page # 2. Log in # 3. Use the contributor bar to go to the forums. # The questions page should list 20 posts. # 3.1 go to the question page user = variables['users']['default'] questions_page = PageProvider(mozwebqa).questions_page( user['username'], user['password']) questions_page.click_all_products() # 3.2 ensure the size of the list is 20 Assert.greater(questions_page.questions_count, 0, 'There is not at least one question displayed.') # 4. Click on a question. (URL is in the forum of /questions/[some number]) # 4.1 pick up an arbitrary question and click # 4.2 check if it landed on an intended forum page question = questions_page.questions[randrange(questions_page.questions_count)] forum_page = question.click_question_link() # 5. Go to the thread # 6. Scroll to the bottom and click into the text field # 7. Type reply # 7.1 reply the post reply = "reply" forum_page.post_reply(reply) # 7.2 check if posting a reply finishes without an error Assert.true(forum_page.is_reply_text_present(user['username'], reply), u'reply with "%s" text posted by %s is not present' % ( reply, user['username']))
def test_contributor_flow_to_support_forum_post(self, mozwebqa): """ Shows a contributor can start on the home page and move all the way to answering a question in the forum. """ reply_text = "reply" #1. Start on the home page #2. Log in #3. Use the contributor bar to go to the forums. # The questions page should list 20 posts. #3.1 go to the question page questions_page = PageProvider(mozwebqa).questions_page(do_login=True) questions_page.click_all_products() #3.2 ensure the size of the list is 20 Assert.greater(questions_page.questions_count, 0, 'There is not at least one question displayed.') #4. Click on a question. (URL is in the forum of /questions/[some number]) #4.1 pick up an arbitrary question and click #4.2 check if it landed on an intended forum page question = questions_page.questions[randrange(questions_page.questions_count)] forum_page = question.click_question_link() #5. Go to the thread #6. Scroll to the bottom and click into the text field #7. Type reply #7.1 get the login-user name to check the author of the reply username = forum_page.header.login_user_name #7.2 reply the post forum_page.post_reply(reply_text) #7.3 check if posting a reply finishes without an error is_reply_present = forum_page.is_reply_text_present(username, reply_text) Assert.true(is_reply_present, u'reply with "%s" text posted by %s is not present' % (reply_text, username))
def test_that_questions_problem_count_increments(self, mozwebqa): """Checks if the 'I have this problem too' counter increments""" # Can't +1 your own question so will do it logged out questions_page = PageProvider(mozwebqa).questions_page() questions_page.click_all_products() view_question_page = questions_page.click_any_question(1) initial_count = view_question_page.problem_count view_question_page.click_problem_too_button() view_question_page.refresh() post_click_count = view_question_page.problem_count Assert.equal(initial_count + 1, post_click_count)
def test_that_questions_problem_count_increments(self, mozwebqa): """Checks if the 'I have this problem too' counter increments""" # Can't +1 your own question so will do it logged out questions_page = PageProvider(mozwebqa).questions_page() questions_page.click_all_products() view_question_page = questions_page.click_any_question(1) initial_count = view_question_page.problem_count view_question_page.click_problem_too_button() view_question_page.refresh() post_click_count = view_question_page.problem_count Assert.equal(initial_count + 1, post_click_count)
def test_that_questions_sorts_correctly_by_filter_equal_to_unanswered(self, mozwebqa): """ Goes to the /questions page, Verifies the sort filter=unanswered works """ expected_sorted_text = "Unanswered" questions_page = PageProvider(mozwebqa).questions_page() questions_page.click_all_products() questions_page.click_all_questions_tab() questions_page.click_sort_by_unanswered_questions() # if there are no questions in the list then skip the test if not questions_page.are_questions_present: pytest.skip("No questions present for filter=%s" % expected_sorted_text) for question in questions_page.questions: Assert.equal(0, question.number_of_replies)
def test_that_questions_sorts_correctly_by_filter_equal_to_solved(self, mozwebqa): """ Goes to the /questions page, Verifies the sort filter=solved works """ expected_sorted_text = "SOLVED" questions_page = PageProvider(mozwebqa).questions_page() questions_page.click_all_products() questions_page.click_questions_done_tab() questions_page.click_sort_by_solved_questions() # if there are no questions in the list then skip the test if not questions_page.are_questions_present: pytest.skip("No questions present for filter=%s" % expected_sorted_text) for question in questions_page.questions: # if solved mark is highlighted the question is really solved Assert.true('highlighted' in question.solved_questions_filter)
def test_that_questions_sorts_correctly_by_filter_equal_to_unanswered( self, mozwebqa): """ Goes to the /questions page, Verifies the sort filter=unanswered works """ expected_sorted_text = "Unanswered" questions_page = PageProvider(mozwebqa).questions_page() questions_page.click_all_products() questions_page.click_all_questions_tab() questions_page.click_sort_by_unanswered_questions() # if there are no questions in the list then skip the test if not questions_page.are_questions_present: pytest.skip("No questions present for filter=%s" % expected_sorted_text) for question in questions_page.questions: Assert.equal(0, question.number_of_replies)
def test_that_questions_sorts_correctly_by_filter_equal_to_solved( self, mozwebqa): """ Goes to the /questions page, Verifies the sort filter=solved works """ expected_sorted_text = "SOLVED" questions_page = PageProvider(mozwebqa).questions_page() questions_page.click_all_products() questions_page.click_questions_done_tab() questions_page.click_sort_by_solved_questions() # if there are no questions in the list then skip the test if not questions_page.are_questions_present: pytest.skip("No questions present for filter=%s" % expected_sorted_text) for question in questions_page.questions: # if solved mark is highlighted the question is really solved Assert.true('highlighted' in question.solved_questions_filter)
def test_contributor_flow_to_support_forum_post(self, mozwebqa, variables): """ Shows a contributor can start on the home page and move all the way to answering a question in the forum. """ # 1. Start on the home page # 2. Log in # 3. Use the contributor bar to go to the forums. # The questions page should list 20 posts. # 3.1 go to the question page user = variables['users']['default'] questions_page = PageProvider(mozwebqa).questions_page( user['username'], user['password']) questions_page.click_all_products() # 3.2 ensure the size of the list is 20 Assert.greater(questions_page.questions_count, 0, 'There is not at least one question displayed.') # 4. Click on a question. (URL is in the forum of /questions/[some number]) # 4.1 pick up an arbitrary question and click # 4.2 check if it landed on an intended forum page question = questions_page.questions[randrange( questions_page.questions_count)] forum_page = question.click_question_link() # 5. Go to the thread # 6. Scroll to the bottom and click into the text field # 7. Type reply # 7.1 reply the post reply = "reply" forum_page.post_reply(reply) # 7.2 check if posting a reply finishes without an error Assert.true( forum_page.is_reply_text_present(user['username'], reply), u'reply with "%s" text posted by %s is not present' % (reply, user['username']))