Example #1
0
    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_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']))
Example #3
0
    def test_that_article_can_be_translated(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Translate article
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()
        article_info_dict = self._create_new_generic_article(kb_new_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box()

        # translating
        kb_translate_pg = kb_article_history.navigation.click_translate_article()
        kb_translate_pg.click_translate_language('Esperanto (eo)')

        timestamp = datetime.datetime.now()
        kb_translate_pg.type_title('artikolo_titolo%s' % timestamp)
        kb_translate_pg.type_slug('artikolo_limako_%s' % timestamp)
        kb_translate_pg.click_submit_review()

        change_comment = 'artikolo sangoj %s' % timestamp
        kb_translate_pg.type_modal_describe_changes(change_comment)
        kb_article_history = kb_translate_pg.click_modal_submit_changes_button()

        # verifying
        Assert.equal(change_comment, kb_article_history.most_recent_revision_comment)
        Assert.equal('Esperanto', kb_article_history.revision_history)

        # deleting
        kb_article_history.delete_entire_article_document()
Example #4
0
    def test_logout(self, mozwebqa):
        home_page = PageProvider(mozwebqa).home_page(do_login=True, user='******')
        Assert.true(home_page.header.is_user_logged_in, 'User not shown to be logged in')

        # sign out
        home_page.sign_out()
        Assert.false(home_page.header.is_user_logged_in)
Example #5
0
    def test_that_article_can_be_translated(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Translate article
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()
        article_info_dict = self._create_new_generic_article(kb_new_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box()

        # translating
        kb_translate_pg = kb_article_history.navigation.click_translate_article()
        kb_translate_pg.click_translate_language('Esperanto (eo)')

        if not kb_translate_pg.is_type_title_visible:
            pytest.xfail(reason='Bug 790626 - [STAGE] translating a question sometimes returns 500 page')

        timestamp = datetime.datetime.now()
        kb_translate_pg.type_title('artikolo_titolo%s' % timestamp)
        kb_translate_pg.type_slug('artikolo_limako_%s' % timestamp)
        kb_translate_pg.type_search_result_summary('artikolo_serco_rezulto_resumo_%s' % timestamp)
        kb_translate_pg.click_submit_review()

        change_comment = 'artikolo sangoj %s' % timestamp
        kb_translate_pg.type_modal_describe_changes(change_comment)
        kb_article_history = kb_translate_pg.click_modal_submit_changes_button()

        # verifying
        Assert.equal(change_comment, kb_article_history.most_recent_revision_comment)
        Assert.equal('Esperanto', kb_article_history.revision_history)

        # deleting
        kb_article_history.delete_entire_article_document()
Example #6
0
    def test_cant_find_what_youre_looking_for_test(self, mozwebqa, search_term):
        search_page_obj = PageProvider(mozwebqa).search_page()
        search_page_obj.do_search_on_search_box(search_term)

        expected_text = "Can't find what you're looking for?"
        Assert.contains(expected_text, search_page_obj.ask_a_question_text)
        Assert.true(search_page_obj.is_ask_a_question_present, "Ask question link not present")
    def test_login(self, mozwebqa, variables):
        user = variables['users']['default']
        home_page = PageProvider(mozwebqa).home_page()
        home_page.sign_in(user['username'], user['password'])

        Assert.true(home_page.header.is_user_logged_in,
                    'User not shown to be logged in')
Example #8
0
    def test_logout_from_new_kb_article_page(self, mozwebqa):
        new_kb_page = PageProvider(mozwebqa).new_kb_article_page()
        Assert.true(new_kb_page.header.is_user_logged_in, 'User not shown to be logged in')

        # sign out
        login_page = new_kb_page.sign_out()
        login_page.is_the_current_page
        Assert.true(login_page.header.is_user_logged_out)
    def test_logout_from_new_kb_article_page(self, mozwebqa):
        new_kb_page = PageProvider(mozwebqa).new_kb_article_page()
        Assert.true(new_kb_page.header.is_user_logged_in, 'User not shown to be logged in')

        # sign out
        register_page = new_kb_page.sign_out()
        register_page.is_the_current_page
        Assert.true(register_page.header.is_user_logged_out)
Example #10
0
    def test_that_article_can_be_previewed_before_submitting(self, mozwebqa):

        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()
        article_info_dict = self._create_new_generic_article(kb_new_article)

        kb_new_article.click_article_preview_button()
        actual_preview_text = kb_new_article.article_preview_text

        Assert.equal(article_info_dict['content'], actual_preview_text)
 def test_that_thank_you_page_is_displayed_after_successful_registration(self, mozwebqa):
     """
        Register a new user using random username.
        Verify registration by checking the page title
     """
     register_pg = PageProvider(mozwebqa).new_user_registration_page()
     register_pg.register_new_user()
     actual_page_title = register_pg.page_title
     expected_page_title = register_pg._page_title_after_registration
     Assert.contains(expected_page_title, actual_page_title)
    def test_logout_from_new_kb_article_page(self, mozwebqa, variables):
        user = variables['users']['default']
        new_kb_page = PageProvider(mozwebqa).new_kb_article_page(
            user['username'], user['password'])
        Assert.true(new_kb_page.header.is_user_logged_in, 'User not shown to be logged in')

        # sign out
        register_page = new_kb_page.sign_out()
        register_page.is_the_current_page
        Assert.true(register_page.header.is_user_logged_out)
 def test_that_thank_you_page_is_displayed_after_successful_registration(
         self, mozwebqa):
     """
        Register a new user using random username.
        Verify registration by checking the page title
     """
     register_pg = PageProvider(mozwebqa).new_user_registration_page()
     register_pg.register_new_user()
     actual_page_title = register_pg.page_title
     expected_page_title = register_pg._page_title_after_registration
     Assert.contains(expected_page_title, actual_page_title)
    def test_logout_from_new_kb_article_page(self, mozwebqa, variables):
        user = variables['users']['default']
        new_kb_page = PageProvider(mozwebqa).new_kb_article_page(
            user['username'], user['password'])
        Assert.true(new_kb_page.header.is_user_logged_in,
                    'User not shown to be logged in')

        # sign out
        register_page = new_kb_page.sign_out()
        register_page.is_the_current_page
        Assert.true(register_page.header.is_user_logged_out)
Example #15
0
    def test_no_query_adv_forum_search(self, mozwebqa):
        refine_search_pg = PageProvider(mozwebqa).refine_search_page()

        # do test
        refine_search_pg.click_support_questions_tab()
        refine_search_pg.type_in_asked_by_box(refine_search_pg.get_user_name('default'))
        refine_search_pg.click_search_button_support()

        Assert.true(refine_search_pg.search_result_count > 0, "No search results not found")

        # sign out
        refine_search_pg.sign_out()
Example #16
0
    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_pg = PageProvider(mozwebqa).questions_page()
        view_question_pg = questions_pg.click_any_question(1)

        initial_count = view_question_pg.problem_count
        view_question_pg.click_problem_too_button()
        view_question_pg.refresh()
        post_click_count = view_question_pg.problem_count

        Assert.equal(initial_count + 1, post_click_count)
Example #17
0
    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()
        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)
Example #18
0
    def test_that_article_can_be_previewed_before_submitting(self, mozwebqa):
        """
            Start a new knowledge base article.
            Preview.
            Verify the contents in the preview
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)

        kb_new_article.click_article_preview_button()
        actual_preview_text = kb_new_article.article_preview_text

        Assert.equal(mock_article["content"], actual_preview_text)
Example #19
0
    def test_user_flow_to_forum_post(self, mozwebqa):

        if mozwebqa.base_url == 'https://support-dev.allizom.org':
            pytest.skip(
                'Search results are not guaranteed to exist on support-dev.allizom.org'
            )

        # 1. start on the home page
        PageProvider(mozwebqa).home_page()

        # 2. type "Firefox crashed"
        # 3. hit Enter
        search_pg = SearchPage(mozwebqa)
        search_pg.do_search_on_search_query(self.forum_search_term + "ed")

        # 4. In the results list there are two types of results:
        #    Forum and KB. Click on a forum result.
        #    (Url is in the forum of /questions/[some number])
        # 5. A complete forum thread should be displayed.
        Assert.true(search_pg.is_result_present, "result page is not present.")
        result_thread_title = search_pg.result_question_text()
        Assert.contains(self.forum_search_term, result_thread_title)
        is_reached_right_page = search_pg.click_question_link(
            self.forum_search_term)
        Assert.true(is_reached_right_page,
                    "a form thread page is not displayed.")
Example #20
0
    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_pg = PageProvider(mozwebqa).questions_page()
        questions_pg.click_sort_by_solved_questions()
        # if there are no questions in the list then skip the test
        if not questions_pg.are_questions_present:
            pytest.skip("No questions present for filter=%s" % expected_sorted_text)
        num_of_questions = questions_pg.questions_count

        for counter in range(num_of_questions):
            actual_sorted_text = questions_pg.sorted_list_filter_text(counter + 1)
            Assert.equal(actual_sorted_text, expected_sorted_text)
Example #21
0
    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_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)
Example #22
0
    def test_logout_from_pages(self, mozwebqa, page_method):
        page_under_test = getattr(PageProvider(mozwebqa), page_method)(do_login=True, user='******')
        Assert.true(page_under_test.header.is_user_logged_in, 'User not shown to be logged in')

        # sign out
        page_under_test.sign_out()
        page_under_test.is_the_current_page
        Assert.true(page_under_test.header.is_user_logged_out)
Example #23
0
    def test_that_article_can_be_deleted(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Deletes the article.
           Verifies the deletion.
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(
            mock_article['comment'])

        # go to article and get URL
        kb_article = kb_article_history.navigation.click_article()
        article_url = kb_article.url_current_page

        # delete the same article
        kb_article_history = kb_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()

        kb_article_history.selenium.get(article_url)
        actual_page_title = kb_article_history.page_title
        Assert.contains("Page Not Found", actual_page_title)
Example #24
0
    def test_that_article_can_be_created(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(
            mock_article['comment'])

        # verify article contents
        kb_edit_article = kb_article_history.navigation.click_edit_article()

        actual_summary_text = kb_edit_article.article_summary_text
        Assert.equal(mock_article['summary'], actual_summary_text)

        actual_contents_text = kb_edit_article.article_contents_text
        Assert.equal(mock_article['content'], actual_contents_text)

        # delete the same article
        kb_article_history = kb_edit_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()
Example #25
0
    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_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)
Example #26
0
    def test_that_posting_question_works(self, mozwebqa):
        """Posts a question to /questions"""
        timestamp = datetime.datetime.today()
        q_to_ask = "automation test question %s" % (timestamp)
        q_details = "This is a test. %s" % (timestamp)

        # go to the /questions/new page and log in
        ask_new_questions_page = PageProvider(mozwebqa).new_question_page()

        # post a question
        ask_new_questions_page.click_firefox_product_link()
        ask_new_questions_page.click_category_problem_link()
        ask_new_questions_page.type_question(q_to_ask)
        ask_new_questions_page.click_none_of_these_solve_my_problem_button()
        view_question_pg = ask_new_questions_page.fill_up_questions_form(q_to_ask, q_details)

        Assert.equal(view_question_pg.question, q_to_ask)
        Assert.equal(view_question_pg.question_detail, q_details)
Example #27
0
    def test_that_questions_sorts_correctly_by_filter_equal_to_no_replies(self, mozwebqa):
        """
           Goes to the /questions page,
           Verifies the sort filter=noreplies works
        """
        expected_sorted_text = "No replies"

        questions_page = PageProvider(mozwebqa).questions_page()
        questions_page.click_to_expand_sort_and_filter_box()
        Assert.true(questions_page.is_sort_and_filter_box_expanded)

        questions_page.click_sort_by_no_replies_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_article_can_be_previewed_before_submitting(self, mozwebqa, variables):
        """
            Start a new knowledge base article.
            Preview.
            Verify the contents in the preview
        """
        user = variables['users']['default']
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)

        kb_new_article.click_article_preview_button()
        actual_preview_text = kb_new_article.article_preview_text

        Assert.equal(mock_article['content'], actual_preview_text)
Example #29
0
    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_to_expand_sort_and_filter_box()
        Assert.true(questions_page.is_sort_and_filter_box_expanded)

        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:
            actual_sorted_text = question.sorted_list_filter_text
            Assert.equal(actual_sorted_text, expected_sorted_text)
Example #30
0
    def test_view_helpfulness_chart(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article
        """
        sumo_homepage = PageProvider(mozwebqa).home_page(do_login=True)
        contrib_page = sumo_homepage.click_knowledge_base_dashboard_link()
        contrib_page.is_the_current_page
        contrib_page.click_all_time()
        kb_article = contrib_page.click_top_visited_article_link()

        # vote on article to artificially inflate data
        kb_article.vote()

        kb_article_history = kb_article.navigation.click_show_history()

        kb_article_history.click_show_helpfulness_chart()
        Assert.true(kb_article_history.is_helpfulness_chart_visible)
Example #31
0
    def test_view_helpfulness_chart(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article.
        """
        sumo_homepage = PageProvider(mozwebqa).home_page(do_login=True)
        sumo_homepage.header.dismiss_staging_site_warning_if_present()
        contrib_page = sumo_homepage.click_knowledge_base_dashboard_link()
        contrib_page.is_the_current_page
        contrib_page.click_all_time()
        kb_article = contrib_page.click_top_visited_article_link()

        # vote on article to artificially inflate data
        kb_article.vote()

        kb_article_history = kb_article.navigation.click_show_history()

        kb_article_history.click_show_helpfulness_chart()
        Assert.true(kb_article_history.is_helpfulness_chart_visible)
Example #32
0
    def test_no_query_adv_forum_search(self, mozwebqa):
        if mozwebqa.base_url in ['https://support-dev.allizom.org',
                                 'https://support.mozilla.org']:
            pytest.skip('Search results are not guaranteed to exist on %s' % mozwebqa.base_url)

        refine_search_pg = PageProvider(mozwebqa).refine_search_page()

        # do test
        refine_search_pg.click_support_questions_tab()
        refine_search_pg.type_in_asked_by_box(refine_search_pg.get_user_name('default'))
        refine_search_pg.click_search_button_support()

        Assert.true(refine_search_pg.search_result_count > 0, "No search results not found")
    def test_logout_from_pages(self, mozwebqa, variables, page_method):
        user = variables['users']['default']
        page_under_test = getattr(PageProvider(mozwebqa),
                                  page_method)(user['username'],
                                               user['password'])
        Assert.true(page_under_test.header.is_user_logged_in,
                    'User not shown to be logged in')

        # sign out
        page_under_test.sign_out()
        page_under_test.is_the_current_page
        Assert.true(page_under_test.header.is_user_logged_out)
Example #34
0
    def test_that_article_can_be_translated(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Translate article
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article["comment"])

        # translating
        kb_translate_pg = kb_article_history.navigation.click_translate_article()
        kb_translate_pg.click_translate_language("Esperanto (eo)")

        # enter the tranlation
        mock_article_esperanto = MockArticle(suffix="_esperanto")
        kb_translate_pg.type_title(mock_article_esperanto["title"])
        kb_translate_pg.type_slug(mock_article_esperanto["slug"])
        kb_translate_pg.type_search_result_summary(mock_article_esperanto["summary"])
        kb_translate_pg.click_submit_review()

        change_comment = mock_article_esperanto["comment"]
        kb_translate_pg.type_modal_describe_changes(change_comment)
        kb_article_history = kb_translate_pg.click_modal_submit_changes_button()

        # verifying
        Assert.equal(change_comment, kb_article_history.most_recent_revision_comment)
        Assert.contains("Esperanto", kb_article_history.revision_history)

        # deleting
        kb_article_history.delete_entire_article_document()
Example #35
0
    def test_that_article_can_be_deleted(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Deletes the article.
           Verifies the deletion.
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article["comment"])

        # go to article and get URL
        kb_article = kb_article_history.navigation.click_article()
        article_url = kb_article.url_current_page

        # delete the same article
        kb_article_history = kb_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()

        kb_article_history.selenium.get(article_url)
        actual_page_title = kb_article_history.page_title
        Assert.contains("Page Not Found", actual_page_title)
    def test_that_article_can_be_created(self, mozwebqa, variables):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article
        """
        user = variables['users']['admin']
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article['comment'])

        # verify article contents
        kb_edit_article = kb_article_history.navigation.click_edit_article()

        actual_summary_text = str(kb_edit_article.article_summary_text)
        Assert.equal(mock_article['summary'], actual_summary_text)

        actual_contents_text = str(kb_edit_article.article_contents_text)
        Assert.equal(mock_article['content'], actual_contents_text)

        # delete the same article
        kb_article = kb_edit_article.navigation.click_show_history()
        kb_article.delete_entire_article_document()
Example #37
0
    def test_that_article_can_be_created(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article["comment"])

        # verify article contents
        kb_edit_article = kb_article_history.navigation.click_edit_article()

        actual_summary_text = kb_edit_article.article_summary_text
        Assert.equal(mock_article["summary"], actual_summary_text)

        actual_contents_text = kb_edit_article.article_contents_text
        Assert.equal(mock_article["content"], actual_contents_text)

        # delete the same article
        kb_article_history = kb_edit_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()
Example #38
0
    def test_no_query_adv_forum_search(self, mozwebqa):
        if mozwebqa.base_url in [
                'https://support-dev.allizom.org',
                'https://support.mozilla.org'
        ]:
            pytest.skip('Search results are not guaranteed to exist on %s' %
                        mozwebqa.base_url)

        refine_search_pg = PageProvider(mozwebqa).refine_search_page()

        # do test
        refine_search_pg.click_support_questions_tab()
        refine_search_pg.type_in_asked_by_box(
            refine_search_pg.get_user_name('default'))
        refine_search_pg.click_search_button_support()

        Assert.true(refine_search_pg.search_result_count > 0,
                    "No search results not found")
Example #39
0
    def test_that_article_can_be_edited(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Edits the article, verifies the edition.
           Deletes the article
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()
        article_info_dict = self._create_new_generic_article(kb_new_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box()

        # edit that same article
        timestamp = datetime.datetime.now()
        edited_article_summary = "this is an automated summary__%s_edited" % timestamp
        edited_article_content = "automated content__%s_edited" % timestamp
        article_info_dict_edited = {'title': article_info_dict['title'],\
                                    'category': 'How to', 'keyword': 'test',\
                                    'summary': edited_article_summary, 'content': edited_article_content}

        kb_edit_article = kb_article_history.navigation.click_edit_article()
        kb_article_history = kb_edit_article.edit_article(article_info_dict_edited)

        kb_edit_article = kb_article_history.navigation.click_edit_article()

        # verify the contents of the edited article
        actual_page_title = kb_edit_article.page_title
        Assert.contains(article_info_dict_edited['title'], actual_page_title)

        actual_summary_text = kb_edit_article.article_summary_text
        Assert.equal(edited_article_summary, actual_summary_text)

        actual_content_text = kb_edit_article.article_contents_text
        Assert.equal(edited_article_content, actual_content_text)

        # delete the same article
        kb_article_history = kb_edit_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()
Example #40
0
    def test_that_article_can_be_created(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()
        article_info_dict = self._create_new_generic_article(kb_new_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box()

        # verify article contents
        kb_edit_article = kb_article_history.navigation.click_edit_article()

        actual_summary_text = kb_edit_article.article_summary_text
        Assert.equal(article_info_dict['summary'], actual_summary_text)

        actual_contents_text = kb_edit_article.article_contents_text
        Assert.equal(article_info_dict['content'], actual_contents_text)

        # delete the same article
        kb_article_history = kb_edit_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()
Example #41
0
    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']))
Example #42
0
    def test_search_returns_either_term(self, mozwebqa):
        """Search looks for either of two search terms

        Search using a good search term with a junk search term
        should return same as only the good search term

        """

        good_search_term = "firefox"
        junk_search_term = "werpadfjka"

        search_page_obj = PageProvider(mozwebqa).search_page()

        # search with good search term only.  save first search result.
        search_page_obj.do_search_on_search_box(good_search_term)
        Assert.true(search_page_obj.is_result_present, "1st search has no results")
        result_search_1 = search_page_obj.get_result_text

        # search with junk search term following the good search term
        search_page_obj.do_search_on_search_box(" " + junk_search_term)
        Assert.true(search_page_obj.is_result_present, "Similar 2nd search has no results")

        result_search_2 = search_page_obj.get_result_text
        Assert.equal(result_search_1, result_search_2, "Similar searches have different results")
Example #43
0
    def test_logout_from_edit_kb_article_page(self, mozwebqa):
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article['comment'])

        kb_edit_article = kb_article_history.navigation.click_edit_article()

        # sign out
        login_page = kb_edit_article.sign_out()
        login_page.is_the_current_page
        Assert.true(login_page.header.is_user_logged_out)
Example #44
0
    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)
Example #45
0
    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_logout_from_edit_kb_article_page(self, mozwebqa, variables):
        user = variables['users']['default']
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(
            mock_article['comment'])

        kb_edit_article = kb_article_history.navigation.click_edit_article()

        # sign out
        register_page = kb_edit_article.sign_out()
        register_page.is_the_current_page
        Assert.true(register_page.header.is_user_logged_out)
    def test_logout_from_edit_kb_article_page(self, mozwebqa):
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article['comment'])

        kb_edit_article = kb_article_history.navigation.click_edit_article()

        # sign out
        register_page = kb_edit_article.sign_out()
        register_page.is_the_current_page
        Assert.true(register_page.header.is_user_logged_out)
    def test_logout_from_translate_kb_article_page(self, mozwebqa):
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(
            mock_article['comment'])

        kb_translate_pg = kb_article_history.navigation.click_translate_article(
        )
        kb_translate_pg.click_translate_language('Deutsch (de)')

        # sign out
        register_page = kb_translate_pg.sign_out()
        register_page._page_title = 'Anmelden / Registrieren | Mozilla-Hilfe'
        register_page.is_the_current_page
        Assert.true(register_page.header.is_user_logged_out)
Example #49
0
    def test_that_article_can_be_previewed_before_submitting(self, mozwebqa):
        """
            Start a new knowledge base article.
            Preview.
            Verify the contents in the preview
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)

        kb_new_article.click_article_preview_button()
        actual_preview_text = kb_new_article.article_preview_text

        Assert.equal(mock_article['content'], actual_preview_text)
Example #50
0
    def test_that_article_can_be_translated(self, mozwebqa, variables):
        """
           Creates a new knowledge base article.
           Translate article
        """
        user = variables['users']['admin']
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(
            mock_article['comment'])

        # translating
        kb_translate_pg = kb_article_history.navigation.click_translate_article(
        )
        kb_translate_pg.click_translate_language('Deutsch (de)')

        # enter the translation
        mock_article_deutsch = MockArticle(suffix="_deutsch")
        kb_translate_pg.type_title(mock_article_deutsch['title'])
        kb_translate_pg.type_slug(mock_article_deutsch['slug'])
        kb_translate_pg.type_search_result_summary(
            mock_article_deutsch['summary'])
        kb_translate_pg.click_submit_review()

        change_comment = mock_article_deutsch['comment']
        kb_translate_pg.type_modal_describe_changes(change_comment)
        kb_article_history = kb_translate_pg.click_modal_submit_changes_button(
        )

        # verifying
        Assert.equal(change_comment,
                     kb_article_history.most_recent_revision_comment)
        Assert.contains('Deutsch', kb_article_history.revision_history)

        # deleting
        kb_article_history.delete_entire_article_document()
Example #51
0
    def test_that_article_can_be_edited(self, mozwebqa, variables):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Edits the article, verifies the edition.
           Deletes the article
        """
        user = variables['users']['admin']
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(
            mock_article['comment'])

        # edit that same article (keep the title the same as original)
        mock_article_edited = MockArticle(suffix="_edited",
                                          title=mock_article['title'])

        kb_edit_article = kb_article_history.navigation.click_edit_article()
        kb_article_history = kb_edit_article.edit_article(mock_article_edited)

        kb_edit_article = kb_article_history.navigation.click_edit_article()

        # verify the contents of the edited article
        actual_page_title = kb_edit_article.page_title
        Assert.contains(mock_article_edited['title'], actual_page_title)

        actual_summary_text = kb_edit_article.article_summary_text
        Assert.equal(mock_article_edited['summary'], actual_summary_text)

        actual_content_text = kb_edit_article.article_contents_text
        Assert.equal(mock_article_edited['content'], actual_content_text)

        # delete the same article
        kb_article_history = kb_edit_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()
Example #52
0
    def test_that_article_can_be_translated(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Translate article
        """
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page()

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(
            mock_article['comment'])

        # translating
        kb_translate_pg = kb_article_history.navigation.click_translate_article(
        )
        kb_translate_pg.click_translate_language('Esperanto (eo)')

        #enter the tranlation
        mock_article_esperanto = MockArticle(suffix="_esperanto")
        kb_translate_pg.type_title(mock_article_esperanto['title'])
        kb_translate_pg.type_slug(mock_article_esperanto['slug'])
        kb_translate_pg.type_search_result_summary(
            mock_article_esperanto['summary'])
        kb_translate_pg.click_submit_review()

        change_comment = mock_article_esperanto['comment']
        kb_translate_pg.type_modal_describe_changes(change_comment)
        kb_article_history = kb_translate_pg.click_modal_submit_changes_button(
        )

        # verifying
        Assert.equal(change_comment,
                     kb_article_history.most_recent_revision_comment)
        Assert.contains('Esperanto', kb_article_history.revision_history)

        # deleting
        kb_article_history.delete_entire_article_document()
Example #53
0
    def test_that_article_can_be_previewed_before_submitting(
            self, mozwebqa, variables):
        """
            Start a new knowledge base article.
            Preview.
            Verify the contents in the preview
        """
        user = variables['users']['default']
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)

        kb_new_article.click_article_preview_button()
        actual_preview_text = kb_new_article.article_preview_text

        Assert.equal(mock_article['content'], actual_preview_text)
Example #54
0
    def test_that_questions_sorts_correctly_by_filter_equal_to_no_replies(
            self, mozwebqa):
        """
           Goes to the /questions page,
           Verifies the sort filter=noreplies works
        """
        expected_sorted_text = "No replies"

        questions_page = PageProvider(mozwebqa).questions_page()
        questions_page.click_to_expand_sort_and_filter_box()
        Assert.true(questions_page.is_sort_and_filter_box_expanded)

        questions_page.click_sort_by_no_replies_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)
Example #55
0
    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_to_expand_sort_and_filter_box()
        Assert.true(questions_page.is_sort_and_filter_box_expanded)

        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:
            actual_sorted_text = question.sorted_list_filter_text
            Assert.equal(actual_sorted_text, expected_sorted_text)
Example #56
0
    def test_login(self, mozwebqa):
        home_page = PageProvider(mozwebqa).home_page()
        home_page.sign_in(user='******')

        Assert.true(home_page.header.is_user_logged_in, 'User not shown to be logged in')
Example #57
0
    def test_switch_to_mobile_view(self, mozwebqa):
        home = PageProvider(mozwebqa).home_page()
        home.switch_to_mobile_view()

        mobile = MobilePageProvider(mozwebqa).home_page()
        Assert.true(mobile.is_mobile_view_displayed)
Example #58
0
    def test_that_posting_question_works(self, mozwebqa):
        """Posts a question to /questions"""
        timestamp = datetime.datetime.today()
        q_to_ask = "automation test question %s" % (timestamp)
        q_details = "This is a test. %s" % (timestamp)

        # go to the /questions/new page and log in
        ask_new_questions_page = PageProvider(mozwebqa).new_question_page()

        # post a question
        ask_new_questions_page.click_firefox_product_link()
        ask_new_questions_page.click_category_problem_link()
        ask_new_questions_page.type_question(q_to_ask)
        ask_new_questions_page.close_stage_site_banner()
        ask_new_questions_page.click_none_of_these_solve_my_problem_button()
        view_question_pg = ask_new_questions_page.fill_up_questions_form(
            q_to_ask, q_details)

        Assert.equal(view_question_pg.question, q_to_ask)
        Assert.equal(view_question_pg.question_detail, q_details)