Exemplo n.º 1
0
    def test_searching_for_addon_type_returns_results_of_correct_type(
        self, mozwebqa, addon_type, term, breadcrumb_component
    ):
        amo_home_page = Home(mozwebqa)

        search_results = None

        if (addon_type == 'Complete Themes'):
            search_results = amo_home_page.search_for(term)

            search_results.filter.category.expand_filter_options()
            search_results.filter.category.click_filter_complete_themes()

            search_results.filter.works_with.expand_filter_options()
            search_results.filter.works_with.click_filter_all_versions_of_firefox()
            search_results.filter.works_with.click_filter_all_systems()
        else:
            amo_addon_type_page = amo_home_page.header.site_navigation_menu(addon_type).click()
            search_results = amo_addon_type_page.search_for(term)

        Assert.true(search_results.result_count > 0,
                    'Search did not return results. Search terms: %s' % search_results.selenium.current_url)

        # click through to each result and verify navigation breadcrumbs are correct
        for i in range(search_results.result_count):
            addon = search_results.result(i).click_result()
            Assert.contains(breadcrumb_component, addon.breadcrumb,
                            "Expected to find: '%s' in '%s'. url: %s" %
                            (breadcrumb_component, addon.breadcrumb, addon.selenium.current_url))
            addon.return_to_previous_page()
Exemplo n.º 2
0
    def test_that_search_results_return_20_results_per_page(self, mozwebqa):
        home_page = Home(mozwebqa)
        search_page = home_page.search_for('deutsch')

        first_expected = 1
        second_expected = 20

        while not search_page.paginator.is_next_page_disabled:
            first_count = search_page.paginator.start_item
            second_count = search_page.paginator.end_item

            Assert.equal(first_expected, first_count)
            Assert.equal(second_expected, second_count)
            Assert.equal(search_page.result_count, 20)

            search_page.paginator.click_next_page()

            first_expected += 20
            second_expected += 20

        number = search_page.paginator.total_items % 20

        if number == 0:
            Assert.equal(search_page.result_count, 20)
        else:
            Assert.equal(search_page.result_count, number)
Exemplo n.º 3
0
    def test_that_search_results_return_20_results_per_page(self, mozwebqa):
        """
        Test for Litmus 17346.
        https://litmus.mozilla.org/show_test.cgi?id=17346
        """
        home_page = Home(mozwebqa)
        search_page = home_page.search_for("deutsch")

        first_expected = 1
        second_expected = 20

        while not search_page.paginator.is_next_page_disabled:
            first_count = search_page.paginator.start_item
            second_count = search_page.paginator.end_item

            Assert.equal(first_expected, first_count)
            Assert.equal(second_expected, second_count)
            Assert.equal(search_page.result_count, 20)

            search_page.paginator.click_next_page()

            first_expected += 20
            second_expected += 20

        number = search_page.paginator.total_items % 20

        if number == 0:
            Assert.equal(search_page.result_count, 20)
        else:
            Assert.equal(search_page.result_count, number)
Exemplo n.º 4
0
    def test_that_search_results_return_20_results_per_page(self, base_url, selenium):
        home_page = Home(base_url, selenium)
        search_page = home_page.search_for('deutsch')

        first_expected = 1
        second_expected = 20

        while not search_page.paginator.is_next_page_disabled:
            first_count = search_page.paginator.start_item
            second_count = search_page.paginator.end_item

            assert first_expected == first_count
            assert second_expected == second_count
            assert 20 == search_page.result_count

            search_page.paginator.click_next_page()

            first_expected += 20
            second_expected += 20

        number = search_page.paginator.total_items % 20

        if number == 0:
            assert 20 == search_page.result_count
        else:
            assert number == search_page.result_count
Exemplo n.º 5
0
 def test_that_searching_for_a_tag_returns_results(self, base_url, selenium):
     home_page = Home(base_url, selenium)
     search_page = home_page.search_for('development')
     result_count = search_page.filter.results_count
     assert result_count > 0
     search_page.filter.tag('development').click_tag()
     assert search_page.filter.results_count >= result_count
Exemplo n.º 6
0
    def test_that_page_with_search_results_has_correct_title(self, mozwebqa):
        home_page = Home(mozwebqa)
        search_keyword = 'Search term'
        search_page = home_page.search_for(search_keyword)

        expected_title = '%s :: Search :: Add-ons for Firefox' % search_keyword
        Assert.equal(expected_title, search_page.page_title)
Exemplo n.º 7
0
    def test_could_install_jetpack(self, mozwebqa):
        """note that this test does not actually *install* the jetpack"""

        home_page = Home(mozwebqa)
        search_page = home_page.search_for("jetpack")
        details_page = search_page.results.pop().click_result()
        Assert.true(details_page.is_version_information_install_button_visible)
Exemplo n.º 8
0
 def test_that_searching_for_a_tag_returns_results(self, mozwebqa):
     home_page = Home(mozwebqa)
     search_page = home_page.search_for("development")
     result_count = search_page.filter.results_count
     assert result_count > 0
     search_page.filter.tag("development").click_tag()
     assert search_page.filter.results_count >= result_count
Exemplo n.º 9
0
def test_that_searching_for_addon_returns_addon_as_first_result(
        base_url, es_test, selenium):
    """Test searching for an addon returns the addon."""
    page = Home(selenium, base_url).open()
    name = page.most_popular.extensions[0].name
    search_page = page.search_for(name)
    assert name in search_page.results[0].name
    assert name in selenium.title
Exemplo n.º 10
0
def test_incompative_extensions_show_as_incompatible(base_url, selenium):
    page = Home(selenium, base_url).open()
    term = 'Ui-Addon-Android'
    items = page.search_for(term)
    for item in items.result_list.extensions:
        if term == item.name:
            detail_page = item.click()
            assert detail_page.is_compatible is False
Exemplo n.º 11
0
def test_sorting_by(
        base_url, selenium, es_test, category, sort_attr):
    """Test searching for an addon and sorting."""
    page = Home(selenium, base_url).open()
    name = page.most_popular.extensions[0].name
    search_page = page.search_for(name)
    search_page.sort_by(category, sort_attr)
    results = [getattr(i, sort_attr) for i in search_page.results]
    assert sorted(results, reverse=True) == results
Exemplo n.º 12
0
def test_that_searching_for_addon_returns_addon_as_first_result(
        my_base_url, es_test, selenium, addon):
    """Test searching for an addon returns the addon."""
    page = Home(selenium, my_base_url).open()
    name = str(
        getattr(addon, 'name', page.featured_extensions.extensions[0].name))
    search_page = page.search_for(name)
    assert name in search_page.results[0].name
    assert name in selenium.title
Exemplo n.º 13
0
    def test_that_searching_for_a_tag_returns_results(self, mozwebqa):

        home_page = Home(mozwebqa)
        search_page = home_page.search_for('development')
        result_count = search_page.filter.results_count
        Assert.greater(result_count, 0)

        search_page.filter.tag('development').click_tag()
        Assert.greater_equal(result_count, search_page.filter.results_count)
Exemplo n.º 14
0
    def test_that_search_all_add_ons_results_have_pagination_that_moves_through_results(self, mozwebqa):
        """
        Test for Litmus 4839 and 17339.
        https://litmus.mozilla.org/show_test.cgi?id=4839
        https://litmus.mozilla.org/show_test.cgi?id=17339
        Open a page with search results.
        1. On the first page, check that "<<" and "previous are not active, but "next" and ">>" are active.
        2. Move forward one page by clicking next, all buttons are active
        3. Click ">>" to go to last page.  Check that "<<" and "previous" are clickable but "next" and ">>" are not.
        4. Assert the page number has incremented or decreased
        5. Click "previous", all buttons are highlighted.
        """
        home_page = Home(mozwebqa)
        search_page = home_page.search_for('addon')

        expected_page = 1

        # On the first page, "<<" and "previous" are not active, but "next" and ">>" are active.
        Assert.true(search_page.paginator.is_prev_page_disabled)
        Assert.true(search_page.paginator.is_first_page_disabled)
        Assert.false(search_page.paginator.is_next_page_disabled)
        Assert.false(search_page.paginator.is_last_page_disabled)
        Assert.equal(search_page.paginator.page_number, expected_page)

        # Move forward one page by clicking next, all buttons should be active.
        search_page.paginator.click_next_page()

        expected_page += 1

        Assert.false(search_page.paginator.is_prev_page_disabled)
        Assert.false(search_page.paginator.is_first_page_disabled)
        Assert.false(search_page.paginator.is_next_page_disabled)
        Assert.false(search_page.paginator.is_last_page_disabled)
        Assert.equal(search_page.paginator.page_number, expected_page)

        # Click ">>" to go to last page. "<<" and "previous" are active, but "next" and ">>" are not.
        search_page.paginator.click_last_page()

        expected_page = search_page.paginator.total_page_number

        Assert.false(search_page.paginator.is_prev_page_disabled)
        Assert.false(search_page.paginator.is_first_page_disabled)
        Assert.true(search_page.paginator.is_next_page_disabled)
        Assert.true(search_page.paginator.is_last_page_disabled)
        Assert.equal(search_page.paginator.page_number, expected_page)

        # Click "previous", all buttons are active.
        search_page.paginator.click_prev_page()

        expected_page -= 1

        Assert.false(search_page.paginator.is_prev_page_disabled)
        Assert.false(search_page.paginator.is_first_page_disabled)
        Assert.false(search_page.paginator.is_next_page_disabled)
        Assert.false(search_page.paginator.is_last_page_disabled)
        Assert.equal(search_page.paginator.page_number, expected_page)
Exemplo n.º 15
0
    def test_that_searching_for_firebug_returns_firebug_as_first_result(self, mozwebqa):
        """
        Modified for Pivotal 28492671.
        https://www.pivotaltracker.com/projects/477093#!/stories/28492671
        """
        home_page = Home(mozwebqa)
        search_page = home_page.search_for('firebug')
        results = [result.name for result in search_page.results]

        Assert.equal('Firebug', results[0])
Exemplo n.º 16
0
    def test_that_page_with_search_results_has_correct_title(self, mozwebqa):
        """
        Test for Litmus 17338.
        https://litmus.mozilla.org/show_test.cgi?id=17338
        """
        home_page = Home(mozwebqa)
        search_keyword = 'Search term'
        search_page = home_page.search_for(search_keyword)

        expected_title = '%s :: Search :: Add-ons for Firefox' % search_keyword
        Assert.equal(expected_title, search_page.page_title)
Exemplo n.º 17
0
def test_sorting_by(
        transactional_db, es_test, my_base_url, selenium, addon,
        minimal_addon, category, sort_attr):
    """Test searching for an addon and sorting."""
    page = Home(selenium, my_base_url).open()
    name = str(
        getattr(addon, 'name', page.featured_extensions.extensions[0].name))
    search_page = page.search_for(name)
    search_page.sort_by(category, sort_attr)
    results = [getattr(i, sort_attr) for i in search_page.results]
    assert sorted(results, reverse=True) == results
Exemplo n.º 18
0
    def test_that_searching_for_fire_returns_firebug(self, mozwebqa):
        """
        Test for Litmus 15314.
        https://litmus.mozilla.org/show_test.cgi?id=15314
        """
        home_page = Home(mozwebqa)
        search_page = home_page.search_for("fire")

        results = [result.name for result in search_page.results]

        Assert.contains("Firebug", results)
Exemplo n.º 19
0
    def test_could_install_jetpack(self, mozwebqa):
        """note that this test does not actually *install* the jetpack"""

        home_page = Home(mozwebqa)
        search_page = home_page.search_for("jetpack")
        for result in search_page.results:
            # click on the first compatible result
            if result.is_compatible:
                details_page = result.click_result()
                break

        assert details_page.is_version_information_install_button_visible
Exemplo n.º 20
0
    def test_that_search_all_add_ons_results_have_pagination_that_moves_through_results(self, mozwebqa):
        """
        Open a page with search results.
        1. On the first page, check that "<<" and "previous are not active, but "next" and ">>" are active.
        2. Move forward one page by clicking next, all buttons are active
        3. Click ">>" to go to last page.  Check that "<<" and "previous" are clickable but "next" and ">>" are not.
        4. Assert the page number has incremented or decreased
        5. Click "previous", all buttons are highlighted.
        """
        home_page = Home(mozwebqa)
        search_page = home_page.search_for('addon')

        expected_page = 1

        # On the first page, "<<" and "previous" are not active, but "next" and ">>" are active.
        assert search_page.paginator.is_prev_page_disabled
        assert search_page.paginator.is_first_page_disabled
        assert search_page.paginator.is_next_page_disabled is False
        assert search_page.paginator.is_last_page_disabled is False
        assert search_page.paginator.page_number == expected_page

        # Move forward one page by clicking next, all buttons should be active.
        search_page.paginator.click_next_page()

        expected_page += 1

        assert search_page.paginator.is_prev_page_disabled is False
        assert search_page.paginator.is_first_page_disabled is False
        assert search_page.paginator.is_next_page_disabled is False
        assert search_page.paginator.is_last_page_disabled is False
        assert search_page.paginator.page_number == expected_page

        # Click ">>" to go to last page. "<<" and "previous" are active, but "next" and ">>" are not.
        search_page.paginator.click_last_page()

        expected_page = search_page.paginator.total_page_number

        assert search_page.paginator.is_prev_page_disabled is False
        assert search_page.paginator.is_first_page_disabled is False
        assert search_page.paginator.is_next_page_disabled
        assert search_page.paginator.is_last_page_disabled
        assert search_page.paginator.page_number == expected_page

        # Click "previous", all buttons are active.
        search_page.paginator.click_prev_page()

        expected_page -= 1

        assert search_page.paginator.is_prev_page_disabled is False
        assert search_page.paginator.is_first_page_disabled is False
        assert search_page.paginator.is_next_page_disabled is False
        assert search_page.paginator.is_last_page_disabled is False
        assert search_page.paginator.page_number == expected_page
Exemplo n.º 21
0
    def test_that_searching_for_a_tag_returns_results(self, mozwebqa):
        """
        Test for Litmus 7848.
        https://litmus.mozilla.org/show_test.cgi?id=7848
        """

        home_page = Home(mozwebqa)
        search_page = home_page.search_for('development')
        result_count = search_page.filter.results_count
        Assert.greater(result_count, 0)

        search_page.filter.tag('development').click_tag()
        Assert.greater_equal(result_count, search_page.filter.results_count)
Exemplo n.º 22
0
    def test_that_searching_for_cool_returns_results_with_cool_in_their_name_description(self, mozwebqa):
        home_page = Home(mozwebqa)
        search_term = 'cool'
        search_page = home_page.search_for(search_term)
        Assert.false(search_page.is_no_results_present)

        for i in range(0, len(search_page.results)):
            try:
                Assert.contains(search_term, search_page.results[i].text.lower())
            except:
                devs_comments = ''
                details_page = search_page.results[i].click_result()
                if details_page.is_devs_comments_section_present:
                    details_page.expand_devs_comments()
                    devs_comments = details_page.devs_comments_message
                search_range = details_page.description + devs_comments
                Assert.contains(search_term, search_range.lower())
                details_page.return_to_previous_page()
Exemplo n.º 23
0
    def test_that_searching_for_cool_returns_results_with_cool_in_their_name_description(self, base_url, selenium):
        home_page = Home(base_url, selenium)
        search_term = 'cool'
        search_page = home_page.search_for(search_term)
        assert not search_page.is_no_results_present

        for i in range(0, len(search_page.results)):
            try:
                assert search_term in search_page.results[i].text.lower()
            except:
                devs_comments = ''
                details_page = search_page.results[i].click_result()
                if details_page.is_devs_comments_section_present:
                    details_page.expand_devs_comments()
                    devs_comments = details_page.devs_comments_message
                search_range = details_page.description + devs_comments
                assert search_term in search_range.lower()
                details_page.return_to_previous_page()
Exemplo n.º 24
0
    def test_searching_for_addon_type_returns_results_of_correct_type(
        self, mozwebqa, addon_type, term, breadcrumb_component
    ):
        amo_home_page = Home(mozwebqa)

        search_results = None

        if (addon_type == 'Complete Themes'):
            search_results = amo_home_page.search_for(term)

            search_results.filter.category.expand_filter_options()
            search_results.filter.category.click_filter_complete_themes()

            search_results.filter.works_with.expand_filter_options()
            search_results.filter.works_with.click_filter_all_versions_of_firefox()
            search_results.filter.works_with.click_filter_all_systems()
        else:
            amo_addon_type_page = amo_home_page.header.site_navigation_menu(addon_type).click()
            search_results = amo_addon_type_page.search_for(term)

        assert search_results.result_count > 0,
                    'Search did not return results. Search terms: %s' % search_results.selenium.current_url
Exemplo n.º 25
0
    def test_that_searching_for_cool_returns_results_with_cool_in_their_name_description(self, mozwebqa):
        """
        Test for Litmus 17353.
        https://litmus.mozilla.org/show_test.cgi?id=17353
        """
        home_page = Home(mozwebqa)
        search_term = "cool"
        search_page = home_page.search_for(search_term)
        Assert.false(search_page.is_no_results_present)

        for i in range(0, len(search_page.results)):
            try:
                Assert.contains(search_term, search_page.results[i].text.lower())
            except:
                devs_comments = ""
                details_page = search_page.results[i].click_result()
                if details_page.is_devs_comments_section_present:
                    details_page.expand_devs_comments()
                    devs_comments = details_page.devs_comments_message
                search_range = details_page.description + devs_comments
                Assert.contains(search_term, search_range.lower())
                details_page.return_to_previous_page()
Exemplo n.º 26
0
    def test_that_searching_for_firebug_returns_firebug_as_first_result(self, mozwebqa):
        home_page = Home(mozwebqa)
        search_page = home_page.search_for('firebug')
        results = [result.name for result in search_page.results]

        Assert.equal('Firebug', results[0])
Exemplo n.º 27
0
def test_search_loads_correct_results(base_url, selenium):
    page = Home(selenium, base_url).open()
    addon_name = page.featured_extensions.list[0].name
    items = page.search_for(addon_name)
    assert addon_name in items.result_list.extensions[0].name
Exemplo n.º 28
0
def test_legacy_extensions_do_not_load(base_url, selenium):
    page = Home(selenium, base_url).open()
    term = 'Video Download Manager'
    items = page.search_for(term)
    for item in items.result_list.extensions:
        assert term not in item.name
Exemplo n.º 29
0
 def test_that_searching_for_firebug_returns_firebug_as_first_result(
         self, mozwebqa):
     home_page = Home(mozwebqa)
     search_page = home_page.search_for('firebug')
     results = [result.name for result in search_page.results]
     assert 'Firebug' == results[0]
Exemplo n.º 30
0
 def test_that_page_with_search_results_has_correct_title(self, mozwebqa):
     home_page = Home(mozwebqa)
     search_keyword = 'Search term'
     search_page = home_page.search_for(search_keyword)
     expected_title = '%s :: Search :: Add-ons for Firefox' % search_keyword
     assert expected_title == search_page.page_title
Exemplo n.º 31
0
 def test_that_searching_for_firebug_returns_firebug_as_first_result(self, base_url, selenium):
     home_page = Home(base_url, selenium)
     search_page = home_page.search_for('firebug')
     results = [result.name for result in search_page.results]
     assert 'Firebug' == results[0]
Exemplo n.º 32
0
 def test_that_page_with_search_results_has_correct_title(self, base_url, selenium):
     home_page = Home(base_url, selenium)
     search_keyword = 'Search term'
     search_page = home_page.search_for(search_keyword)
     expected_title = '%s :: Search :: Add-ons for Firefox' % search_keyword
     assert expected_title == search_page.page_title
Exemplo n.º 33
0
def test_search_loads_correct_results(base_url, selenium):
    page = Home(selenium, base_url).open()
    addon_name = page.featured_extensions.list[0].name
    items = page.search_for(addon_name)
    assert addon_name in items.result_list.extensions[0].name
Exemplo n.º 34
0
 def test_that_searching_for_firebug_returns_firebug_as_first_result(
         self, base_url, selenium):
     home_page = Home(base_url, selenium)
     search_page = home_page.search_for('firebug')
     results = [result.name for result in search_page.results]
     assert 'Firebug' == results[0]
Exemplo n.º 35
0
def test_legacy_extensions_do_not_load(base_url, selenium):
    page = Home(selenium, base_url).open()
    term = 'Video Download Manager'
    items = page.search_for(term)
    for item in items.result_list.extensions:
        assert term not in item.name