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
    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
Beispiel #3
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)
Beispiel #4
0
 def test_that_clicking_the_amo_logo_loads_home_page(self, base_url, selenium):
     home_page = Home(base_url, selenium)
     assert home_page.is_amo_logo_visible
     home_page = home_page.click_amo_logo()
     assert home_page.is_the_current_page
     assert home_page.is_amo_logo_visible
     assert'%s/en-US/firefox/' % home_page.base_url == home_page.get_url_current_page()
    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)
    def test_that_new_review_is_saved(self, mozwebqa):
        """
        Test for Litmus 22921.
        https://litmus.mozilla.org/show_test.cgi?id=22921
        """
        # Step 1 - Login into AMO
        home_page = Home(mozwebqa)
        home_page.login("browserID")
        Assert.true(home_page.is_the_current_page)
        Assert.true(home_page.header.is_user_logged_in)

        # Step 2 - Load any addon detail page
        details_page = Details(mozwebqa, 'Adblock Plus')

        # Step 3 - Click on "Write review" button
        write_review_block = details_page.click_to_write_review()

        # Step 4 - Write a review
        body = 'Automatic addon review by Selenium tests %s' % datetime.now()
        write_review_block.enter_review_with_text(body)
        write_review_block.set_review_rating(1)
        review_page = write_review_block.click_to_save_review()

        # Step 5 - Assert review
        review = review_page.reviews[0]
        Assert.equal(review.rating, 1)
        Assert.equal(review.author, mozwebqa.credentials['default']['name'])
        date = datetime.now().strftime("%B %d, %Y")
        # there are no leading zero-signs on day so we need to remove them too
        date = date.replace(' 0', ' ')
        Assert.equal(review.date, date)
        Assert.equal(review.text, body)
Beispiel #7
0
def test_bottom_install_button(base_url, selenium, firefox, notifications):
    page = Home(selenium, base_url).open()
    page.bottom_install_button()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
Beispiel #8
0
    def test_create_collection(self, mozwebqa):

        home_page = Home(mozwebqa)
        collections_page = home_page.header.site_navigation_menu("Collections").click()
        create_collection_page = collections_page.click_create_collection_button()
        home_page.login("browserID")

        random_name = "random number following%s" % random.randrange(1, 100)

        create_collection_page.type_name(random_name)
        create_collection_page.type_description(random_name)
        collection = create_collection_page.click_create_collection()

        Assert.equal(collection.notification, "Collection created!")
        Assert.equal(collection.collection_name, random_name)
        collection.delete()
        user_collections = collection.delete_confirmation()
        if len(user_collections.collections) > 0:
            for collection_element in range(
                len(user_collections.collections)
            ):  # If the condition is satisfied, iterate through the collections items on the page
                Assert.true(
                    random_name not in user_collections.collections[collection_element].text
                )  # Check for each collection that the name is not the same as the deleted collections name
        else:
            Assert.equal(
                user_collections.collection_text, "No collections found."
            )  # It means the collection has been deleted and we test for that
Beispiel #9
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)
Beispiel #10
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)
    def test_that_new_review_is_saved(self, mozwebqa, existing_user):
        # Step 1 - Login into AMO
        home_page = Home(mozwebqa)
        home_page.login(existing_user['email'], existing_user['password'])
        assert home_page.is_the_current_page
        assert home_page.header.is_user_logged_in

        # Step 2 - Load any addon detail page
        details_page = Details(mozwebqa, 'Memchaser')

        # Step 3 - Click on "Write review" button
        write_review_block = details_page.click_to_write_review()

        # Step 4 - Write a review
        body = 'Automatic addon review by Selenium tests %s' % datetime.now()
        write_review_block.enter_review_with_text(body)
        write_review_block.set_review_rating(1)
        review_page = write_review_block.click_to_save_review()

        # Step 5 - Assert review
        review = review_page.reviews[0]
        assert review.rating == 1
        assert review.author == existing_user['name']
        date = datetime.now(timezone('US/Pacific')).strftime("%B %d, %Y")
        # there are no leading zero-signs on day so we need to remove them too
        expected_date = date.replace(' 0', ' ')
        assert review.date == expected_date, 'Date of review does not match the expected value. '
                     'Expected: "%s" but found "%s"' % (expected_date, review.date)
Beispiel #12
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
    def test_hide_email_checkbox_works(self, mozwebqa):
        home_page = Home(mozwebqa)
        home_page.login("browserID")

        Assert.true(home_page.is_the_current_page)
        Assert.true(home_page.header.is_user_logged_in)

        view_profile_page = home_page.header.click_view_profile()
        initial_state = view_profile_page.is_email_field_present

        edit_profile_page = home_page.header.click_edit_profile()
        edit_profile_page.change_hide_email_state()
        edit_profile_page.click_update_account()

        view_profile_page = home_page.header.click_view_profile()
        final_state = view_profile_page.is_email_field_present

        try:
            Assert.not_equal(initial_state, final_state, 'The initial and final states are the same. The profile change failed.')
            if final_state is True:
                credentials = mozwebqa.credentials['default']
                Assert.equal(credentials['email'], view_profile_page.email_value, 'Actual value is not equal with the expected one.')

        except Exception as exception:
            Assert.fail(exception.msg)

        finally:
            if initial_state != final_state:
                edit_profile_page = home_page.header.click_edit_profile()
                edit_profile_page.change_hide_email_state()
                edit_profile_page.click_update_account()
                view_profile_page = home_page.header.click_view_profile()

            Assert.equal(view_profile_page.is_email_field_present, initial_state, 'Could not restore profile to initial state.')
    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()
    def test_that_one_star_rating_increments(self, mozwebqa):
        """
        Test for Litmus 22916.
        https://litmus.mozilla.org/show_test.cgi?id=22916
        """
        # Step 1 - Login into AMO
        home_page = Home(mozwebqa)
        home_page.login("browserID")
        Assert.true(home_page.header.is_user_logged_in)

        # Step 2 - Go to add-ons listing page sorted by rating
        extensions_home_page = home_page.click_to_explore('Top Rated')

        # Step 3 - Pick an addon with no reviews
        extensions_home_page.paginator.click_last_page()
        addon = extensions_home_page.extensions[-1]  # the last one is without rating
        details_page = addon.click()

        # Step 4 - Click on the "Write review" button
        write_review_block = details_page.click_to_write_review()

        # Step 5 - Add review with 1-star rating
        body = 'Automatic addon review by Selenium tests'
        write_review_block.enter_review_with_text(body)
        write_review_block.set_review_rating(1)
        view_reviews = write_review_block.click_to_save_review()

        # Step 6 - Ensure rating increased by one
        view_reviews.breadcrumbs[2].click()
        details_page = Details(mozwebqa)
        new_rating_counter = details_page.get_rating_counter(1)
        Assert.equal(new_rating_counter, 1)
    def test_that_clicking_the_amo_logo_loads_home_page(self, mozwebqa):
        home_page = Home(mozwebqa)

        Assert.true(home_page.is_amo_logo_visible)
        home_page = home_page.click_amo_logo()
        Assert.true(home_page.is_the_current_page)
        Assert.true(home_page.is_amo_logo_visible)
        Assert.equal(home_page.get_url_current_page(), '%s/en-US/firefox/' % home_page.base_url)
    def test_other_applications_thunderbird(self, mozwebqa):
        app_under_test = "Thunderbird"
        home_page = Home(mozwebqa)

        home_page.header.click_other_application(app_under_test)
        Assert.contains(app_under_test.lower(), home_page.get_url_current_page())

        Assert.false(home_page.header.is_other_application_visible(app_under_test))
 def test_that_other_applications_link_has_tooltip(self, mozwebqa):
     """
     Test for Litmus 22925.
     https://litmus.mozilla.org/show_test.cgi?id=29698
     """
     home_page = Home(mozwebqa)
     tooltip = home_page.get_title_of_link("Other applications")
     Assert.equal(tooltip, "Find add-ons for other applications")
    def test_user_can_access_the_view_profile_page(self, base_url, selenium, existing_user):
        home_page = Home(base_url, selenium)
        home_page.login(existing_user['email'], existing_user['password'])
        assert home_page.is_the_current_page
        assert home_page.header.is_user_logged_in

        view_profile_page = home_page.header.click_view_profile()
        assert 'About me' == view_profile_page.about_me
    def test_user_can_login_and_logout(self, base_url, selenium, existing_user):
        home_page = Home(base_url, selenium)
        home_page.login(existing_user['email'], existing_user['password'])
        assert home_page.is_the_current_page
        assert home_page.header.is_user_logged_in

        home_page.header.click_logout()
        assert not home_page.header.is_user_logged_in
Beispiel #21
0
 def test_that_clicking_on_addon_name_loads_details_page(self, mozwebqa):
     """
     Test for Litmus 25812.
     https://litmus.mozilla.org/show_test.cgi?id=25812
     """
     home_page = Home(mozwebqa)
     details_page = home_page.click_on_first_addon()
     Assert.true(details_page.is_the_current_page)
Beispiel #22
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
Beispiel #23
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
    def test_user_can_login_and_logout(self, mozwebqa, existing_user):
        home_page = Home(mozwebqa)
        home_page.login(existing_user['email'], existing_user['password'])
        assert home_page.is_the_current_page
        assert home_page.header.is_user_logged_in

        home_page.header.click_logout()
        assert home_page.header.is_user_logged_in is False
    def test_user_can_access_the_view_profile_page(self, mozwebqa, existing_user):
        home_page = Home(mozwebqa)
        home_page.login(existing_user['email'], existing_user['password'])
        assert home_page.is_the_current_page
        assert home_page.header.is_user_logged_in

        view_profile_page = home_page.header.click_view_profile()

        assert view_profile_page.about_me == 'About me'
    def test_user_can_login_and_logout_using_browser_id(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.login("browserID")
        Assert.true(home_page.is_the_current_page)
        Assert.true(home_page.header.is_user_logged_in)

        home_page.header.click_logout()
        Assert.false(home_page.header.is_user_logged_in)
Beispiel #27
0
 def test_sorting_by_newest(self, mozwebqa):
     """
     Test for Litmus 17343.
     https://litmus.mozilla.org/show_test.cgi?id=17343
     """
     search_page = Home(mozwebqa).header.search_for('firebug')
     search_page.sort_by('Newest')
     Assert.true('sort=created' in search_page.get_url_current_page())
     Assert.is_sorted_descending([i.created_date for i in search_page.results])
Beispiel #28
0
 def test_sorting_by_number_of_most_users(self, mozwebqa):
     """
     Test for Litmus 24867.
     https://litmus.mozilla.org/show_test.cgi?id=24867
     """
     search_page = Home(mozwebqa).header.search_for('firebug')
     search_page.sort_by('Most Users')
     Assert.contains('sort=users', search_page.get_url_current_page())
     Assert.is_sorted_descending([i.users for i in search_page.results])
 def test_that_clicking_mozilla_logo_loads_mozilla_dot_org(self, mozwebqa):
     """
     Test for Litmus 22922.
     https://litmus.mozilla.org/show_test.cgi?id=22922
     """
     home_page = Home(mozwebqa)
     Assert.true(home_page.is_mozilla_logo_visible)
     home_page.click_mozilla_logo()
     Assert.equal(home_page.get_url_current_page(), "http://www.mozilla.org/en-US/")
Beispiel #30
0
 def test_that_clicking_see_all_extensions_link_works(self, mozwebqa):
     """
     Test for Litmus 25801.
     https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25801
     """
     home_page = Home(mozwebqa)
     featured_extension_page = home_page.click_featured_extensions_see_all_link()
     Assert.true(featured_extension_page.is_the_current_page)
     Assert.true(featured_extension_page.get_url_current_page().endswith('/extensions/?sort=featured'))
Beispiel #31
0
 def test_that_featured_extensions_exist_on_the_home(self, mozwebqa):
     """
     Test for Litmus 25800.
     https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25800
     """
     home_page = Home(mozwebqa)
     Assert.equal(home_page.featured_extensions_title,
                  'Featured Extensions',
                  'Featured Extensions region title doesn\'t match')
     Assert.equal(home_page.featured_extensions_see_all, u'See all \xbb',
                  'Featured Extensions region see all link is not correct')
     Assert.greater(home_page.featured_extensions_count, 1)
Beispiel #32
0
def test_install_and_enable(base_url, selenium, firefox, notifications):
    Home(selenium, base_url).open()
    experiments = Experiments(selenium, base_url)
    experiment = experiments.find_experiment(experiment='Dev Example')
    experiment.install_and_enable()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
    assert Detail(selenium, base_url).enabled_popup.is_popup_displayed()
Beispiel #33
0
def test_uppercase_has_same_suggestions(base_url, selenium, variables):
    page = Home(selenium, base_url).open()
    term = variables['search_term']
    first_suggestions_list = page.search.search_for(term, execute=False)
    first_results = [item.name for item in first_suggestions_list]
    page.search.search_field.clear()
    second_suggestions_list = page.search.search_for(term.upper(),
                                                     execute=False)
    # Sleep to let autocomplete update.
    time.sleep(2)
    second_results = [item.name for item in second_suggestions_list]
    assert first_results == second_results
 def test_that_checks_if_the_extensions_are_sorted_by_most_user(
         self, base_url, selenium):
     home_page = Home(base_url, selenium)
     featured_extensions_page = home_page.header.site_navigation_menu(
         "Extensions").click()
     featured_extensions_page.sorter.sort_by('most_users')
     assert 'sort=users' in featured_extensions_page.get_url_current_page()
     user_counts = [
         extension.user_count
         for extension in featured_extensions_page.extensions
     ]
     assert sorted(user_counts, reverse=True) == user_counts
Beispiel #35
0
def test_blank_search_loads_results(base_url, selenium):
    page = Home(selenium, base_url).open()
    search_page = page.search.search_for('', execute=True)
    results = search_page.result_list.extensions
    assert len(results) == 25
    for result in results:
        assert result.promoted_badge
    sort = 'users'
    results = [
        getattr(result, sort) for result in search_page.result_list.extensions
    ]
    assert sorted(results, reverse=True) == results
Beispiel #36
0
 def test_pagination(self, base_url, selenium):
     home_page = Home(base_url, selenium)
     featured_extensions_page = home_page.header.site_navigation_menu("Extensions").click()
     featured_extensions_page.sorter.sort_by('most_users')
     featured_extensions_page.paginator.click_next_page()
     assert '&page=2' in featured_extensions_page.get_url_current_page()
     featured_extensions_page.paginator.click_prev_page()
     assert '&page=1' in featured_extensions_page.get_url_current_page()
     featured_extensions_page.paginator.click_last_page()
     assert featured_extensions_page.paginator.is_next_page_disabled
     featured_extensions_page.paginator.click_first_page()
     assert featured_extensions_page.paginator.is_prev_page_disabled
Beispiel #37
0
    def test_that_new_review_is_saved(self, mozwebqa):
        """
        Test for Litmus 22921.
        https://litmus.mozilla.org/show_test.cgi?id=22921
        """
        # Step 1 - Login into AMO
        home_page = Home(mozwebqa)
        home_page.login("browserID")
        Assert.true(home_page.is_the_current_page)
        Assert.true(home_page.header.is_user_logged_in)

        # Step 2 - Load any addon detail page
        details_page = Details(mozwebqa, 'Memchaser')

        # Step 3 - Click on "Write review" button
        write_review_block = details_page.click_to_write_review()

        # Step 4 - Write a review
        body = 'Automatic addon review by Selenium tests %s' % datetime.now()
        write_review_block.enter_review_with_text(body)
        write_review_block.set_review_rating(1)
        review_page = write_review_block.click_to_save_review()

        # Step 5 - Assert review
        review = review_page.reviews[0]
        Assert.equal(review.rating, 1)
        Assert.equal(review.author, mozwebqa.credentials['default']['name'])
        date = datetime.now().strftime("%B %d, %Y")
        # there are no leading zero-signs on day so we need to remove them too
        date = date.replace(' 0', ' ')
        Assert.equal(review.date, date)
        Assert.equal(review.text, body)

        review.delete()

        details_page = Details(mozwebqa, 'Memchaser')
        review_page = details_page.click_all_reviews_link()

        for review in review_page.reviews:
            Assert.false(body in review.text)
Beispiel #38
0
    def test_next_button_is_disabled_on_the_last_page(self, mozwebqa):
        """
        Test for Litmus 29710.
        https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=29710
        """
        home_page = Home(mozwebqa)
        featured_extensions_page = home_page.header.site_navigation_menu(
            "Extensions").click()
        featured_extensions_page.sort_by('most_users')
        featured_extensions_page.paginator.click_last_page()

        Assert.true(featured_extensions_page.paginator.is_next_page_disabled,
                    'Next button is available')
Beispiel #39
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()
Beispiel #40
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.header.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)
Beispiel #41
0
def test_filter_promoted(base_url, selenium, sort_attr, title):
    page = Home(selenium, base_url).open()
    term = ""
    page.search.search_for(term)
    search_page = Search(selenium, base_url)
    select = Select(search_page.filter_by_badging)
    select.select_by_value(sort_attr)
    search_page.wait_for_contextcard_update('results found')
    results = search_page.result_list.extensions
    for result in results:
        assert result.promoted_badge
        if title != 'Reviewed':
            assert title.title() in result.promoted_badge_label
Beispiel #42
0
    def test_that_checks_if_the_extensions_are_sorted_by_newest(self, base_url, selenium):
        home_page = Home(base_url, selenium)
        featured_extensions_page = home_page.header.site_navigation_menu("Extensions").click()
        featured_extensions_page.sorter.sort_by('newest')
        assert 'Newest' == featured_extensions_page.sorter.sorted_by
        assert 'sort=created' in featured_extensions_page.get_url_current_page()

        added_dates = [i.added_date for i in featured_extensions_page.extensions]
        assert sorted(added_dates, reverse=True) == added_dates
        featured_extensions_page.paginator.click_next_page()

        added_dates.extend([i.added_date for i in featured_extensions_page.extensions])
        assert sorted(added_dates, reverse=True) == added_dates
Beispiel #43
0
    def test_that_complete_themes_categories_are_not_extensions_categories(
            self, base_url, selenium):
        home_page = Home(base_url, selenium)
        complete_themes_page = home_page.header.click_complete_themes()
        complete_themes_categories = complete_themes_page.get_all_categories

        home_page.header.site_navigation_menu("Extensions").click()
        extensions_categories = complete_themes_page.get_all_categories

        assert not len(complete_themes_categories) == len(
            extensions_categories)
        assert [] == list(
            set(complete_themes_categories) & set(extensions_categories))
    def test_user_can_update_profile_information_in_account_settings_page(self, mozwebqa):
        home_page = Home(mozwebqa)
        home_page.login(user="******")

        Assert.true(home_page.is_the_current_page)
        Assert.true(home_page.header.is_user_logged_in)

        user_edit_page = home_page.header.click_edit_profile()
        Assert.true(user_edit_page.is_the_current_page)

        # save initial values to restore them after the test is finished
        fields_no = len(user_edit_page.profile_fields) - 1
        initial_value = [None] * fields_no
        random_name = "test%s" % random.randrange(1, 100)

        # enter new values
        for i in range(0, fields_no):
            initial_value[i] = deepcopy(user_edit_page.profile_fields[i].field_value)
            user_edit_page.profile_fields[i].clear_field()
            user_edit_page.profile_fields[i].type_value(random_name)

        user_edit_page.click_update_account()
        Assert.equal(user_edit_page.update_message, "Profile Updated")

        # using try finally to ensure that the initial values are restore even if the Asserts fail.
        try:
            for i in range(0, fields_no):
                Assert.contains(random_name, user_edit_page.profile_fields[i].field_value)

        except Exception as exception:
            Assert.fail(exception.msg)

        finally:
            # restore initial values
            for i in range(0, fields_no):
                user_edit_page.profile_fields[i].clear_field()
                user_edit_page.profile_fields[i].type_value(initial_value[i])

            user_edit_page.click_update_account()
Beispiel #45
0
 def test_that_complete_themes_can_be_sorted_by_popularity(self, mozwebqa):
     home_page = Home(mozwebqa)
     complete_themes_page = home_page.header.click_complete_themes()
     complete_themes_page.click_sort_by("weekly downloads")
     addons = complete_themes_page.addon_names
     addons_set = set(addons)
     Assert.equal(len(addons), len(addons_set),
                  "There are duplicates in the names")
     downloads = complete_themes_page.addon_download_number
     Assert.is_sorted_descending(downloads)
     complete_themes_page.paginator.click_next_page()
     downloads.extend(complete_themes_page.addon_download_number)
     Assert.is_sorted_descending(downloads)
    def test_the_displayed_message_for_incompatible_complete_themes(self, mozwebqa):
        home_page = Home(mozwebqa)
        complete_themes_page = home_page.header.click_complete_themes()
        complete_themes_page.clear_hover_cards()

        complete_themes = complete_themes_page.complete_themes

        for complete_theme in complete_themes:
            if complete_theme.is_incompatible:
                assert complete_theme.is_incompatible_flag_visible
                assert 'Not available' in complete_theme.not_available_flag_text
            else:
                assert not complete_theme.is_incompatible_flag_visible
Beispiel #47
0
    def test_addons_author_link(self, mozwebqa):
        """
        https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25815
        """

        home_page = Home(mozwebqa)
        first_addon = home_page.featured_extensions[0]

        first_author = first_addon.author_name
        user_page = first_addon.click_first_author()

        Assert.equal(user_page.username, first_author[0])
        Assert.contains('user', user_page.get_url_current_page())
Beispiel #48
0
def test_filter_by_rating_and_hotness(base_url, selenium, category, sort_attr):
    """Test searching for an addon and sorting."""
    Home(selenium, base_url).open()
    addon_name = 'fox'
    selenium.get('{}/search/?&q={}&sort={}'.format(base_url, addon_name,
                                                   sort_attr))
    search_page = Search(selenium, base_url)
    results = search_page.result_list.extensions
    if sort_attr == 'rating':
        for result in search_page.result_list.extensions:
            assert result.rating > 4
    else:
        assert len(results) == 25
 def test_that_checks_if_the_extensions_are_sorted_by_top_rated(
         self, mozwebqa):
     """
     Test for Litmus 29717
     https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=29717
     """
     home_page = Home(mozwebqa)
     featured_extensions_page = home_page.header.site_navigation_menu(
         "Extensions").click()
     featured_extensions_page.sorter.sort_by("Top Rated")
     Assert.equal(featured_extensions_page.sorter.sorted_by, "Top Rated")
     Assert.contains("sort=rating",
                     featured_extensions_page.get_url_current_page())
Beispiel #50
0
 def test_start_exploring_link_in_the_promo_box(self, mozwebqa):
     """
     Test for Litmus 12037.
     https://litmus.mozilla.org/show_test.cgi?id=12037
     """
     home_page = Home(mozwebqa)
     themes_page = home_page.header.site_navigation_menu("Themes").click()
     Assert.true(themes_page.is_the_current_page)
     Assert.true(themes_page.is_featured_addons_present)
     browse_themes_page = themes_page.click_start_exploring()
     Assert.true(browse_themes_page.is_the_current_page)
     Assert.equal("up-and-coming", browse_themes_page.sort_key)
     Assert.equal("Up & Coming", browse_themes_page.sort_by)
Beispiel #51
0
    def test_that_themes_categories_are_not_extensions_categories(
            self, mozwebqa):
        """Test for Litmus 15343."""
        home_page = Home(mozwebqa)
        themes_page = home_page.header.site_navigation_menu("Themes").click()
        themes_categories = themes_page.get_all_categories

        home_page.header.site_navigation_menu("Extensions").click()
        extensions_categories = themes_page.get_all_categories

        Assert.not_equal(len(themes_categories), len(extensions_categories))
        Assert.equal(list(set(themes_categories) & set(extensions_categories)),
                     [])
Beispiel #52
0
    def test_header_site_navigation_menus_are_correct(self, mozwebqa):
        home_page = Home(mozwebqa)

        # compile lists of the expected and actual top level navigation items
        expected_navigation_menu = [
            menu.name for menu in self.expected_header_menus
        ]
        actual_navigation_menus = [
            actual_menu.name
            for actual_menu in home_page.header.site_navigation_menus
        ]

        assert expected_navigation_menu == actual_navigation_menus
Beispiel #53
0
 def test_that_complete_themes_can_be_sorted_by_created_date(self, mozwebqa):
     """Test for Litmus 11638."""
     home_page = Home(mozwebqa)
     complete_themes_page = home_page.header.click_complete_themes()
     complete_themes_page.click_sort_by("newest")
     addons = complete_themes_page.addon_names
     addons_set = set(addons)
     Assert.equal(len(addons), len(addons_set), "There are duplicates in the names")
     created_dates = complete_themes_page.addon_created_dates
     Assert.is_sorted_descending(created_dates)
     complete_themes_page.paginator.click_next_page()
     created_dates.extend(complete_themes_page.addon_created_dates)
     Assert.is_sorted_descending(created_dates)
Beispiel #54
0
def test_number_of_experiments(base_url, selenium):
    """Test current number of experiments"""
    page = Home(selenium, base_url).open()
    url = '{0}/{1}'.format(base_url, 'api/experiments.json')
    # Ping api to get current number of completed experiments
    data = requests.get(url, verify=False).json()
    completed_experiments = len([
        value for value in data['results']
        if 'completed' in value and value['completed'] < str(datetime.utcnow())
    ])
    # Subtract 1 from the experiments found through the api due to locale
    assert len(page.body.experiments
               ) == int(len(data['results']) - completed_experiments) - 1
Beispiel #55
0
def test_number_of_experiments(base_url, selenium):
    """Test current number of experiments"""
    page = Home(selenium, base_url).open()
    url = '{0}/{1}'.format(base_url, 'api/experiments.json')
    # Ping api to get current number of completed experiments
    data = requests.get(url, verify=False).json()
    # add one for dev experiment
    completed_experiments = len([
        value for value in data['results']
        if 'completed' in value and value['completed'] < str(datetime.utcnow())
    ]) + 1
    assert len(page.body.experiments) == int(
        len(data['results']) - completed_experiments)
Beispiel #56
0
    def test_top_three_items_in_each_site_navigation_menu_are_featured(self, mozwebqa):
        home_page = Home(mozwebqa)

        # loop through each actual top level menu
        for actual_menu in home_page.header.site_navigation_menus:
            # 'more' navigation_menu has no featured items so we have a different assertion
            if actual_menu.name == u"MORE\u2026":
                # loop through each of the items in the top level menu and check is_featured property
                [Assert.false(item.is_featured) for item in actual_menu.items]
            else:
                # first 3 are featured, the others are not
                [Assert.true(item.is_featured) for item in actual_menu.items[:3]]
                [Assert.false(item.is_featured) for item in actual_menu.items[3:]]
Beispiel #57
0
    def test_that_checks_all_categories_side_navigation(self, mozwebqa):
        """
        Test for Litmus 25792.
        https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25792
        """
        home_page = Home(mozwebqa)
        category_region = home_page.get_category()

        Assert.equal('CATEGORIES',
                     category_region.categories_side_navigation_header_text)
        Assert.equal('Alerts & Updates',
                     category_region.categories_alert_updates_header_text)
        Assert.equal('Appearance',
                     category_region.categories_appearance_header_text)
        Assert.equal('Bookmarks',
                     category_region.categories_bookmark_header_text)
        Assert.equal(
            'Download Management',
            category_region.categories_download_management_header_text)
        Assert.equal('Feeds, News & Blogging',
                     category_region.categories_feed_news_blog_header_text)
        Assert.equal(
            'Games & Entertainment',
            category_region.categories_games_entertainment_header_text)
        Assert.equal('Language Support',
                     category_region.categories_language_support_header_text)
        Assert.equal('Photos, Music & Videos',
                     category_region.categories_photo_music_video_header_text)
        Assert.equal('Privacy & Security',
                     category_region.categories_privacy_security_header_text)
        Assert.equal('Shopping',
                     category_region.categories_shopping_header_text)
        Assert.equal(
            'Social & Communication',
            category_region.categories_social_communication_header_text)
        Assert.equal('Tabs', category_region.categories_tabs_header_text)
        Assert.equal('Web Development',
                     category_region.categories_web_development_header_text)
        Assert.equal('Other', category_region.categories_other_header_text)
Beispiel #58
0
    def test_that_new_review_is_saved(self, mozwebqa):
        # Step 1 - Login into AMO
        home_page = Home(mozwebqa)
        home_page.login()
        Assert.true(home_page.is_the_current_page)
        Assert.true(home_page.header.is_user_logged_in)

        # Step 2 - Load any addon detail page
        details_page = Details(mozwebqa, 'Memchaser')

        # Step 3 - Click on "Write review" button
        write_review_block = details_page.click_to_write_review()

        # Step 4 - Write a review
        body = 'Automatic addon review by Selenium tests %s' % datetime.now()
        write_review_block.enter_review_with_text(body)
        write_review_block.set_review_rating(1)
        review_page = write_review_block.click_to_save_review()

        # Step 5 - Assert review
        review = review_page.reviews[0]
        Assert.equal(review.rating, 1)
        Assert.equal(review.author, mozwebqa.credentials['default']['name'])
        date = datetime.now().strftime("%B %d, %Y")
        # there are no leading zero-signs on day so we need to remove them too
        expected_date = date.replace(' 0', ' ')
        Assert.equal(review.date, expected_date, 'Date of review does not match the expected value. '
                     'Expected: "%s" but found "%s"' % (expected_date, review.date))
        Assert.equal(review.text, body, 'Review text does not match expected value. '
                     'Expected: "%s", but found "%s"' % (body, review.text))

        review.delete()

        details_page = Details(mozwebqa, 'Memchaser')
        review_page = details_page.click_all_reviews_link()

        for review in review_page.reviews:
            Assert.false(body in review.text)
Beispiel #59
0
def test_install_of_test_pilot_addon(base_url, selenium, firefox,
                                     notifications):
    """Check that the testpilot addon is installable and installs."""
    page = Home(selenium, base_url).open()
    selenium.execute_script(
        "document.querySelector('.landing-experiments').scrollIntoView();")
    if not page.featured.is_displayed:
        page.header.click_install_button()
        firefox.browser.wait_for_notification(
            notifications.AddOnInstallComplete).close()
    else:
        page.featured.click_install_button()
        firefox.browser.wait_for_notification(
            notifications.AddOnInstallComplete).close()
Beispiel #60
0
    def test_that_checks_other_applications_menu(self, mozwebqa):
        home_page = Home(mozwebqa)

        # Thunderbird
        assert home_page.header.is_other_application_visible('Thunderbird')
        home_page.header.click_other_application('Thunderbird')
        current_page_url = home_page.get_url_current_page()
        assert current_page_url.endswith('/thunderbird/')
        assert 'Thunderbird Add-ons' in home_page.amo_logo_title

        # Android
        assert home_page.header.is_other_application_visible('Android')
        home_page.header.click_other_application('Android')
        current_page_url = home_page.get_url_current_page()
        assert current_page_url.endswith('/android/')
        assert 'Android Add-ons' in home_page.amo_logo_title

        # Seamonkey
        assert home_page.header.is_other_application_visible('Seamonkey')
        home_page.header.click_other_application('Seamonkey')
        current_page_url = home_page.get_url_current_page()
        assert current_page_url.endswith('/seamonkey/')
        assert 'SeaMonkey Add-ons' in home_page.amo_logo_title