Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 52 lines (40 sloc) 2.253 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from unittestzero import Assert
import pytest
from pages.desktop.page_provider import PageProvider
from pages.desktop.search_page import SearchPage


class TestSearch:

    forum_search_term = "Firefox crash"

    @pytest.mark.nondestructive
    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")

    @pytest.mark.nondestructive
    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.")
Something went wrong with that request. Please try again.