def test_that_checks_content_in_json_endpoints_from_statistics_urls(self, mozwebqa):
        """https://github.com/mozilla/Addon-Tests/issues/621"""

        # make statistics url template
        base_url = mozwebqa.base_url
        temp_url = "/firefox/addon/firebug/statistics/overview-day-%(start)s-%(end)s.json"
        statistics_url_template = base_url + temp_url

        # set statistics timeframe
        last_date = datetime.today().date() - timedelta(days=1)
        first_date = datetime.today().date() - timedelta(days=30)

        # convert datetime objects to required string representation
        end = str(last_date).replace("-", "")
        start = str(first_date).replace("-", "")

        # make request and assert that status code is OK
        r = requests.get(statistics_url_template % locals())
        Assert.equal(r.status_code, 200, "request to %s failed with %s status code" % (r.url, r.status_code))

        # decode response and assert it's not empty
        response = json.loads(r.content)
        Assert.equal(len(response), 30, "some dates (or all) dates are missing in response")

        dates = []
        for value in response:
            dates.append(value["date"])
            downloads, updates = value["data"].values()
            # check that download and update values are equal or greater than zero
            Assert.greater_equal(downloads, 0)
            Assert.greater_equal(updates, 0)

        # ensure that response contains all dates for given timeframe
        Assert.equal(dates, [str(last_date - timedelta(days=i)) for i in xrange(30)], "wrong dates in response")
    def test_feedback_can_be_filtered_by_platform(self, mozwebqa):
        """This testcase covers # 15215 in Litmus.

        1. Verify that the selected platform is the only one to appear in the list and is selected
        2. Verify that the number of messages in the platform list is plus or minus 15 for the number of messages returned
        3. Verify that the platform appears in the URL
        4. Verify that the platform for all messages on the first page of results is correct

        """
        feedback_pg = FeedbackPage(mozwebqa)

        feedback_pg.go_to_feedback_page()
        feedback_pg.product_filter.select_product('firefox')

        platform_name = "OS X"
        platform = feedback_pg.platform_filter.platform(platform_name)
        platform_message_count = platform.message_count
        platform_code = platform.code
        platform.click()

        total_message_count = feedback_pg.total_message_count
        message_count_difference = total_message_count - platform_message_count

        Assert.equal(len(feedback_pg.platform_filter.platforms), 1)
        Assert.true(
            feedback_pg.platform_filter.platform(platform_name).is_selected)
        # TODO refactor if unittest-zero receives an Assert.within_range method
        Assert.less_equal(message_count_difference, 15)
        Assert.greater_equal(message_count_difference, -15)
        Assert.equal(feedback_pg.platform_from_url, platform_code)
        [
            Assert.equal(message.platform, platform_name)
            for message in feedback_pg.messages
        ]
    def update_app_data(self, mock_app):
        # update the default app data with the custom mock app information

        data = {
            'name': mock_app.name,
            'summary': mock_app.summary,
            'categories': [],
            'support_email': mock_app.support_email,
            'device_types': [],
            'payment_type': mock_app.payment_type,
            'premium_type': 'free',
            'privacy_policy': mock_app.privacy_policy,
            'description': mock_app.description,
            'homepage': mock_app.homepage,
            'support_url': mock_app.support_website
        }

        # device_types: a list of the device types at least one of: 'desktop', 'android-tablet', 'android-mobile', 'firefoxos'
        data['device_types'] = [device[0] for device in mock_app['device_type'] if device[1]]

        Assert.true(data['device_types'],  'insufficient data added device_types')

        # categories: a list of the categories, at least two of the category ids provided from the category api
        data['categories'] = [category['id'] for category in self._categories
                              if category['name'] in [mock_category[0] for mock_category in mock_app.categories]]

        Assert.greater_equal(len(data['categories']), 2,
                             'Insufficient data added categories == %s\n Minimum 2 categories required' % data['categories'])

        response = self._client.update(mock_app.id, data)

        Assert.equal(response.status_code, 202, "Update app data failed.\n Status code %s" % response.status_code)
    def test_filtering_apps_by_price(self, mozwebqa, search_filter):
        home_page = Home(mozwebqa)

        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)
        search_page = home_page.header.search("")

        result_count_before_filter = search_page.results_count

        Assert.greater(result_count_before_filter, 0, "No results on the page")

        search_page.filter_by(search_filter).click()
        result_count_after_filter = search_page.results_count

        Assert.greater_equal(result_count_before_filter,
                             result_count_after_filter)
        Assert.contains(search_filter, search_page.applied_filters)

        if search_filter == "Free Only":
            [
                Assert.equal("FREE", result.price)
                for result in search_page.results
            ]
        elif search_filter == "Premium Only":
            for result in search_page.results:
                Assert.not_none(re.match("\$\d+.\d+", result.price))
    def test_feedback_can_be_filtered_by_platform(self, mozwebqa):
        """This testcase covers # 15215 in Litmus.

        1. Verify that the selected platform is the only one to appear in the list and is selected
        2. Verify that the number of messages in the platform list is plus or minus 15 for the number of messages returned
        3. Verify that the platform appears in the URL
        4. Verify that the platform for all messages on the first page of results is correct

        """
        feedback_pg = FeedbackPage(mozwebqa)

        feedback_pg.go_to_feedback_page()
        feedback_pg.product_filter.select_product('firefox')
        feedback_pg.product_filter.select_version('--')

        platform_name = "Mac OS X"
        platform = feedback_pg.platform_filter.platform(platform_name)
        platform_message_count = platform.message_count
        platform_code = platform.code
        platform.click()

        total_message_count = feedback_pg.total_message_count.replace(',', '')
        message_count_difference = int(total_message_count) - int(platform_message_count)

        Assert.equal(len(feedback_pg.platform_filter.platforms), 1)
        Assert.true(feedback_pg.platform_filter.platform(platform_name).is_selected)
        # TODO refactor if unittest-zero receives an Assert.within_range method
        Assert.less_equal(message_count_difference, 15)
        Assert.greater_equal(message_count_difference, -15)
        Assert.equal(feedback_pg.platform_from_url, platform_code)
        [Assert.equal(message.platform, platform_name) for message in feedback_pg.messages]
Example #6
0
    def update_app_data(self, mock_app):
        # update the default app data with the custom mock app information

        data = {
            'name': mock_app.name,
            'summary': mock_app.summary,
            'categories': [],
            'support_email': mock_app.support_email,
            'device_types': [],
            'payment_type': mock_app.payment_type,
            'premium_type': 'free',
            'privacy_policy': mock_app.privacy_policy,
            'description': mock_app.description,
            'homepage': mock_app.homepage,
            'support_url': mock_app.support_website
        }

        # device_types: a list of the device types at least one of: 'desktop', 'android-tablet', 'android-mobile', 'firefoxos'
        data['device_types'] = [device[0] for device in mock_app['device_type'] if device[1]]

        Assert.true(data['device_types'], 'insufficient data added device_types')

        # categories: a list of the categories, at least two of the category ids provided from the category api
        data['categories'] = [category['slug'] for category in self._categories
                              if category['name'] in [mock_category[0] for mock_category in mock_app.categories]]

        Assert.greater_equal(len(data['categories']), 2,
                             'Insufficient data added categories == %s\n Minimum 2 categories required' % data['categories'])

        response = self._client.update(mock_app.id, data)

        Assert.equal(response.status_code, 202, "Update app data failed.\n Status code %s" % response.status_code)
Example #7
0
 def test_that_featured_themes_exist_on_the_home(self, mozwebqa):
     """
     Test for Litmus29698.
     https://litmus.mozilla.org/show_test.cgi?id=29698
     """
     home_page = Home(mozwebqa)
     Assert.equal(home_page.featured_themes_title, u'Featured Themes See all \xbb', 'Featured Themes region title doesn\'t match')
     Assert.greater_equal(home_page.featured_themes_count, 6)
Example #8
0
    def test_filter_TV_screen_size_should_succeed(self):
        home_page = HomePage(self.driver).open_home_page()
        TV_page = home_page.header.open_TV_page()
        TV_page.filter_TV_screen_size()
        sleep(2)
        WebDriverWait(self.driver, 30).until(EC.invisibility_of_element_located(TV_page._processing_info))

        Assert.greater_equal(TV_page.text_screen_size_first_product(), TV_page._screen_size_from_text)
        Assert.greater_equal(TV_page._screen_size_to_text, TV_page.text_screen_size_first_product())
Example #9
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)
Example #10
0
 def test_that_last_themes_page_is_not_empty(self, mozwebqa):
     """
     Test for Litmus 15359.
     https://litmus.mozilla.org/show_test.cgi?id=15359
     """
     home_page = Home(mozwebqa)
     themes_page = home_page.header.site_navigation_menu("Themes").click()
     themes_page.paginator.click_last_page()
     Assert.greater_equal(themes_page.addon_count, 1)
Example #11
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)
Example #12
0
 def test_that_last_complete_themes_page_is_not_empty(self, mozwebqa):
     """
     Test for Litmus 15359.
     https://litmus.mozilla.org/show_test.cgi?id=15359
     """
     home_page = Home(mozwebqa)
     complete_themes_page = home_page.header.click_complete_themes()
     complete_themes_page.paginator.click_last_page()
     Assert.greater_equal(complete_themes_page.addon_count, 1)
Example #13
0
 def test_that_last_themes_page_is_not_empty(self, mozwebqa):
     """
     Test for Litmus 15359.
     https://litmus.mozilla.org/show_test.cgi?id=15359
     """
     home_page = Home(mozwebqa)
     themes_page = home_page.header.site_navigation_menu("Themes").click()
     themes_page.paginator.click_last_page()
     Assert.greater_equal(themes_page.addon_count, 1)
 def test_that_news_items_are_sorted_in_reverse_chronological_order(self, mozwebqa):
     home_page = HomePage(mozwebqa)
     home_page.go_to_page()
     news_items = home_page.news_items
     most_recent_date = datetime.date.today()
     for news_item in news_items:
         if news_item.is_post:
             news_item_date = news_item.date_posted
             Assert.greater_equal(most_recent_date, news_item_date, 'News items are out of sequence. %s is not after %s.' % (most_recent_date, news_item_date))
             most_recent_date = news_item_date
Example #15
0
 def test_that_featured_themes_exist_on_the_home(self, mozwebqa):
     """
     Test for Litmus29698.
     https://litmus.mozilla.org/show_test.cgi?id=29698
     """
     home_page = Home(mozwebqa)
     Assert.equal(home_page.featured_themes_title,
                  u'Featured Themes See all \xbb',
                  'Featured Themes region title doesn\'t match')
     Assert.greater_equal(home_page.featured_themes_count, 6)
Example #16
0
def home_page_logged_in(duckwebqa):
    """Log in to the appliance and return the home page."""
    window_size = duckwebqa.selenium.get_window_size()
    Assert.greater_equal(window_size['width'], 1280, _width_errmsg)
    from pages.login import LoginPage
    login_pg = LoginPage(duckwebqa)
    login_pg.go_to_login_page()
    home_pg = login_pg.login()
    Assert.true(home_pg.is_logged_in, 'Could not determine if logged in')
    return home_pg
Example #17
0
def home_page_logged_in(mozwebqa):
    """Log in to the appliance and return the home page."""
    maximized(mozwebqa)
    window_size = mozwebqa.selenium.get_window_size()
    Assert.greater_equal(window_size['width'], 1280, _width_errmsg)
    from pages.login import LoginPage
    login_pg = LoginPage(mozwebqa)
    login_pg.go_to_login_page()
    home_pg = login_pg.login()
    Assert.true(home_pg.is_logged_in, 'Could not determine if logged in')
    return home_pg
Example #18
0
    def test_that_searching_for_a_tag_returns_results(self, mozwebqa):
        """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()
        Assert.greater_equal(result_count, search_page.filter.results_count)
    def test_open_unclassified_failure_log(self, mozwebqa):
        # Open the job log and verify there is content
        resultset_page = ResultsetPage(mozwebqa)
        resultset_page.go_to_page()
        Assert.greater_equal(resultset_page.unclassified_failure_count, 1)

        resultset_page.open_next_unclassified_failure()
        logviewer_page = resultset_page.open_logviewer()
        logviewer_page = LogviewerPage(mozwebqa)

        Assert.true(logviewer_page.is_job_status_visible)
Example #20
0
    def test_that_verifies_the_search_suggestions_list_under_the_search_field(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)

        home_page.header.type_search_term_in_search_field(self.search_term)
        Assert.true(home_page.header.is_search_suggestion_list_visible)
        Assert.greater_equal(len(home_page.header.search_suggestions), 0)

        for suggestion in home_page.header.search_suggestions:
            Assert.contains(self.search_term, suggestion.app_name)
Example #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)
    def test_unclassified_failure(self, mozwebqa):
        # Open resultset page and search for next unclassified failure
        resultset_page = ResultsetPage(mozwebqa)
        resultset_page.go_to_page()
        Assert.greater_equal(resultset_page.unclassified_failure_count, 1)

        resultset_page.open_next_unclassified_failure()

        teststatus = resultset_page.job_result_status
        jobstatus = ["busted", "testfailed", "exception"]

        for i in range(len(jobstatus)):
            assert jobstatus in teststatus
Example #23
0
 def test_that_news_items_are_sorted_in_reverse_chronological_order(
         self, mozwebqa):
     home_page = HomePage(mozwebqa)
     home_page.go_to_page()
     news_items = home_page.news_items
     most_recent_date = datetime.date.today()
     for news_item in news_items:
         if news_item.is_post:
             news_item_date = news_item.date_posted
             Assert.greater_equal(
                 most_recent_date, news_item_date,
                 'News items are out of sequence. %s is not after %s.' %
                 (most_recent_date, news_item_date))
             most_recent_date = news_item_date
Example #24
0
    def test_that_verifies_the_search_suggestions_list_under_the_search_field(self, mozwebqa):

        home_page = self._take_random_new_app_name(mozwebqa)

        Assert.true(home_page.is_the_current_page)

        search_term = self._take_first_free_app_name(mozwebqa)

        home_page.header.type_search_term_in_search_field(search_term)
        Assert.true(home_page.header.is_search_suggestion_list_visible)
        Assert.greater_equal(len(home_page.header.search_suggestions), 0)

        for suggestion in home_page.header.search_suggestions:
            Assert.contains(search_term, suggestion.app_name)
    def test_that_verifies_the_search_suggestions_list_under_the_search_field(
            self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)

        home_page.header.type_search_term_in_search_field(self.search_term)
        Assert.true(home_page.header.is_search_suggestion_list_visible)
        Assert.greater_equal(len(home_page.header.search_suggestions), 0)

        for suggestion in home_page.header.search_suggestions:
            Assert.contains(self.search_term, suggestion.app_name)
Example #26
0
    def test_that_checks_rss_feed(self, mozwebqa):

        feed = RSSFeed(mozwebqa)

        # check basic values of channel element
        Assert.equal(feed.title, u'QMO - quality.mozilla.org')
        Assert.equal(feed.description, u'The Home of Mozilla QA')
        Assert.equal(feed.link, mozwebqa.base_url)
        Assert.greater_equal(feed.items_count, 10, 'where are all published articles?')

        # check that items in feed have some content
        for item in feed.items:
            Assert.true(all(len(item[key]) >= 5 for key in item),
                        u'some content of "%s" item is missing or is too short' % item['title'])
Example #27
0
    def test_that_verifies_the_search_suggestions_list_under_the_search_field(
            self, mozwebqa):

        home_page = self._take_random_new_app_name(mozwebqa)

        Assert.true(home_page.is_the_current_page)

        search_term = self._take_first_free_app_name(mozwebqa)

        home_page.header.type_search_term_in_search_field(search_term)
        Assert.true(home_page.header.is_search_suggestion_list_visible)
        Assert.greater_equal(len(home_page.header.search_suggestions), 0)

        for suggestion in home_page.header.search_suggestions:
            Assert.contains(search_term, suggestion.app_name)
    def test_that_checks_apps_are_sorted_by_date(self, mozwebqa, login):
        dev_home = Home(mozwebqa)
        dev_submissions = dev_home.header.click_my_submissions()
        dev_submissions.sorter.sort_by('Created')

        import time
        previous_app_date = time.gmtime()

        pages_to_test = 10 if dev_submissions.paginator.total_page_number >= 10 else dev_submissions.paginator.total_page_number
        for i in range(1, pages_to_test):
            for app in dev_submissions.submitted_apps:
                if app.has_date:
                    Assert.greater_equal(previous_app_date, app.date, 'Apps are not sorted ascending. According to Created date.')
                    previous_app_date = app.date
            dev_submissions.paginator.click_next_page()
    def test_that_checks_apps_are_sorted_by_date(self, mozwebqa):
        dev_home = Home(mozwebqa)
        dev_home.go_to_developers_homepage()
        dev_home.login(user="******")

        dev_submissions = dev_home.header.click_my_submissions()

        dev_submissions.sorter.sort_by('Created')

        import time
        previous_app_date = time.gmtime()

        for i in range(1, dev_submissions.paginator.total_page_number):
            for app in dev_submissions.submitted_apps:
                    Assert.greater_equal(previous_app_date, app.date, 'Apps are not sorted ascending. According to Created date.')
            dev_submissions.paginator.click_next_page()
Example #30
0
    def test_that_checks_apps_are_sorted_by_date(self, mozwebqa_devhub_logged_in):
        dev_home = Home(mozwebqa_devhub_logged_in)

        dev_submissions = dev_home.header.click_my_submissions()

        dev_submissions.sorter.sort_by('Created')

        import time
        previous_app_date = time.gmtime()

        pages_to_test = 10 if dev_submissions.paginator.total_page_number >= 10 else dev_submissions.paginator.total_page_number
        for i in range(1, pages_to_test):
            for app in dev_submissions.submitted_apps:
                if app.has_date:
                    Assert.greater_equal(previous_app_date, app.date, 'Apps are not sorted ascending. According to Created date.')
                    previous_app_date = app.date
            dev_submissions.paginator.click_next_page()
    def test_that_verifies_the_search_suggestions_list_under_the_search_field(self, mozwebqa):
        """
        Test for Litmus 66531
        https://litmus.mozilla.org/show_test.cgi?id=66531
        """
        home_page = Home(mozwebqa)

        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)

        home_page.header.type_search_term_in_search_field(self.search_term)
        Assert.true(home_page.header.is_search_suggestion_list_visible)
        Assert.greater_equal(len(home_page.header.search_suggestions), 0)

        for suggestion in home_page.header.search_suggestions:
            Assert.contains(self.search_term, suggestion.app_name)
Example #32
0
    def test_that_checks_rss_feed(self, mozwebqa):

        feed = RSSFeed(mozwebqa)

        # check basic values of channel element
        Assert.equal(feed.title, u'QMO - quality.mozilla.org')
        Assert.equal(feed.description, u'The Home of Mozilla QA')
        Assert.equal(feed.link, mozwebqa.base_url)
        Assert.greater_equal(feed.items_count, 10,
                             'where are all published articles?')

        # check that items in feed have some content
        for item in feed.items:
            Assert.true(
                all(len(item[key]) >= 5 for key in item),
                u'some content of "%s" item is missing or is too short' %
                item['title'])
Example #33
0
    def test_that_verifies_the_search_suggestions_list_under_the_search_field(self, mozwebqa):
        """
        Test for Litmus 66531
        https://litmus.mozilla.org/show_test.cgi?id=66531
        """
        if mozwebqa.base_url == 'https://marketplace-dev.allizom.org' or mozwebqa.base_url == 'https://marketplace.allizom.org' or mozwebqa.base_url == 'https://marketplace.firefox.com':
            pytest.skip('Search suggestions not available yet.')
        home_page = Home(mozwebqa)

        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)

        home_page.header.type_search_term_in_search_field(self.search_term)
        Assert.true(home_page.header.is_search_suggestion_list_visible)
        Assert.greater_equal(len(home_page.header.search_suggestions), 0)

        for suggestion in home_page.header.search_suggestions:
            Assert.contains(self.search_term, suggestion.app_name)
Example #34
0
    def test_search_partial_library_name_returns_library(self, mozwebqa):
        homepage_obj = HomePage(mozwebqa)

        homepage_obj.go_to_home_page()
        searchpage_obj = homepage_obj.header.click_search()

        # get library name, split string in half and search with it
        # results should be returned including the original addon

        top_library_name = searchpage_obj.library(1).name
        search_string = top_library_name[:4]
        searchpage_obj.type_search_term(search_string)
        searchpage_obj.click_search()

        if searchpage_obj.is_see_all_matching_libraries_visible:
            searchpage_obj.click_see_all_matching_libraries()

        Assert.greater_equal(searchpage_obj.library_element_count, 1)
        Assert.true(searchpage_obj.library(top_library_name).is_displayed, 'Library \'%s\' not found' % top_library_name)
    def test_that_verifies_the_search_suggestions_list_under_the_search_field(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.header.is_search_visible)

        for letter in self.search_term[:2]:
            home_page.header.type_in_search_field(letter)
            Assert.false(home_page.header.is_search_suggestions_visible)

        home_page.header.type_in_search_field(self.search_term[2])
        home_page.header.wait_for_suggestions()
        Assert.true(home_page.header.is_search_suggestions_visible)

        Assert.equal(home_page.header.search_suggestions_title, 'Search apps for "%s"' % self.search_term[:3])
        Assert.greater_equal(len(home_page.header.search_suggestions), 0)

        for suggestion in home_page.header.search_suggestions:
            Assert.contains(self.search_term[:3], suggestion.name)
            Assert.true(suggestion.is_icon_visible)
    def test_that_checks_apps_are_sorted_by_date(self, mozwebqa):
        dev_hub = DeveloperHub(mozwebqa)
        dev_hub.go_to_developer_hub()
        dev_hub.login(user="******")

        dev_hub.sorter.sort_by('Created')

        incomplete_apps = False
        import time
        previous_app_date = time.gmtime()

        while not dev_hub.paginator.is_next_page_disabled:
            for app in dev_hub.submited_apps:
                if app.is_incomplete:
                    incomplete_apps = True
                else:
                    if not incomplete_apps:
                        Assert.greater_equal(previous_app_date, app.date, 'Apps are not sorted ascending. According to Created date.')
                    else:
                        Assert.fail('Apps with a finished submission process are found after apps with the submission process unfinished')
            dev_hub.paginator.click_next_page()
Example #37
0
    def test_feedback_can_be_filtered_by_locale(self, mozwebqa):
        """Tests locale filtering in dashboard

        1. Verify we see at least one locale
        2. Select that locale
        3. Verify number of messages in locale is less than total number of messages
        4. Verify locale short code appears in the URL
        5. Verify that the locale for all messages on the first page of results is correct

        """
        dashboard_pg = DashboardPage(mozwebqa)

        dashboard_pg.go_to_dashboard_page()
        total_messages = dashboard_pg.total_message_count

        locales = dashboard_pg.locale_filter.locales
        locale_names = [locale.name for locale in locales]

        Assert.greater_equal(len(locales), 1)

        for name in locale_names[:2]:
            locale = dashboard_pg.locale_filter.locale(name)

            locale_name = locale.name
            locale_code = locale.code
            locale_count = locale.message_count
            Assert.greater(total_messages, locale_count)

            dashboard_pg.locale_filter.select_locale(locale_code)

            Assert.greater(total_messages, dashboard_pg.total_message_count)
            Assert.equal(len(dashboard_pg.locale_filter.locales), 1)
            Assert.equal(dashboard_pg.locale_filter.selected_locale.name,
                         locale_name)
            Assert.equal(dashboard_pg.locale_from_url, locale_code)

            for message in dashboard_pg.messages:
                Assert.equal(message.locale, locale_name)

            dashboard_pg.locale_filter.unselect_locale(locale_code)
Example #38
0
    def test_that_checks_content_in_json_endpoints_from_statistics_urls(
            self, mozwebqa):
        """https://github.com/mozilla/Addon-Tests/issues/621"""

        # make statistics url template
        base_url = mozwebqa.base_url
        temp_url = '/firefox/addon/firebug/statistics/overview-day-%(start)s-%(end)s.json'
        statistics_url_template = base_url + temp_url

        # set statistics timeframe
        last_date = datetime.today().date() - timedelta(days=1)
        first_date = datetime.today().date() - timedelta(days=30)

        # convert datetime objects to required string representation
        end = str(last_date).replace('-', '')
        start = str(first_date).replace('-', '')

        # make request and assert that status code is OK
        r = requests.get(statistics_url_template % locals())
        Assert.equal(
            r.status_code, 200, 'request to %s failed with %s status code' %
            (r.url, r.status_code))

        # decode response and assert it's not empty
        response = json.loads(r.content)
        Assert.equal(len(response), 30,
                     'some dates (or all) dates are missing in response')

        dates = []
        for value in response:
            dates.append(value['date'])
            downloads, updates = value['data'].values()
            # check that download and update values are equal or greater than zero
            Assert.greater_equal(downloads, 0)
            Assert.greater_equal(updates, 0)

        # ensure that response contains all dates for given timeframe
        Assert.equal(dates,
                     [str(last_date - timedelta(days=i)) for i in xrange(30)],
                     'wrong dates in response')
    def test_that_verifies_the_search_suggestions_list_under_the_search_field(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.scroll_down
        Assert.true(home_page.header.is_search_visible)

        for letter in self.search_term[:2]:
            home_page.header.type_in_search_field(letter)
            Assert.false(home_page.header.is_search_suggestions_visible)

        home_page.header.type_in_search_field(self.search_term[2])
        home_page.header.wait_for_suggestions()
        Assert.true(home_page.header.is_search_suggestions_visible)

        Assert.equal(home_page.header.search_suggestions_title, 'Search apps for "%s"' % self.search_term[:3])
        Assert.greater_equal(len(home_page.header.search_suggestions), 0)

        for suggestion in home_page.header.search_suggestions:
            Assert.contains(self.search_term[:3], suggestion.name)
            Assert.true(suggestion.is_icon_visible)
    def test_that_verifies_the_search_suggestions_list_under_the_search_field(
            self, mozwebqa):
        """
        Test for Litmus 66531
        https://litmus.mozilla.org/show_test.cgi?id=66531
        """

        home_page = Home(mozwebqa)

        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)

        home_page.header.type_search_term_in_search_field(self.search_term)
        Assert.true(home_page.header.is_search_suggestion_list_visible)
        Assert.equal(home_page.header.search_suggestion_title,
                     'Search apps for "%s"' % self.search_term)
        Assert.greater_equal(len(home_page.header.search_suggestions), 0)

        for suggestion in home_page.header.search_suggestions:
            Assert.contains(self.search_term, suggestion.app_name)
            Assert.true(suggestion.is_app_icon_displayed)
Example #41
0
    def test_feedback_can_be_filtered_by_locale(self, mozwebqa):
        """Tests locale filtering in dashboard

        1. Verify we see at least one locale
        2. Select that locale
        3. Verify number of messages in locale is less than total number of messages
        4. Verify locale short code appears in the URL
        5. Verify that the locale for all messages on the first page of results is correct

        """
        dashboard_pg = DashboardPage(mozwebqa)

        dashboard_pg.go_to_dashboard_page()
        total_messages = dashboard_pg.total_message_count

        locales = dashboard_pg.locale_filter.locales
        locale_names = [locale.name for locale in locales]

        Assert.greater_equal(len(locales), 1)

        for name in locale_names[:2]:
            locale = dashboard_pg.locale_filter.locale(name)

            locale_name = locale.name
            locale_code = locale.code
            locale_count = locale.message_count
            Assert.greater(total_messages, locale_count)

            dashboard_pg.locale_filter.select_locale(locale_code)

            Assert.greater(total_messages, dashboard_pg.total_message_count)
            Assert.equal(len(dashboard_pg.locale_filter.locales), 1)
            Assert.equal(dashboard_pg.locale_filter.selected_locale.name, locale_name)
            Assert.equal(dashboard_pg.locale_from_url, locale_code)

            for message in dashboard_pg.messages:
                Assert.equal(message.locale, locale_name)

            dashboard_pg.locale_filter.unselect_locale(locale_code)
    def test_filtering_apps_by_price(self, mozwebqa, search_filter):
        home_page = Home(mozwebqa)

        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)
        search_page = home_page.header.search("")

        result_count_before_filter = search_page.results_count

        Assert.greater(result_count_before_filter, 0, "No results on the page")

        search_page.filter_by(search_filter).click()
        result_count_after_filter = search_page.results_count

        Assert.greater_equal(result_count_before_filter, result_count_after_filter)
        Assert.contains(search_filter, search_page.applied_filters)

        if search_filter == "Free Only":
            [Assert.equal("FREE", result.price) for result in search_page.results]
        elif search_filter == "Premium Only":
            for result in search_page.results:
                Assert.not_none(re.match("\$\d+.\d+", result.price))
    def test_that_checks_apps_are_sorted_by_date(self, mozwebqa):
        dev_home = Home(mozwebqa)
        dev_home.go_to_developers_homepage()
        dev_home.login(user="******")

        dev_submissions = dev_home.header.click_my_apps()

        dev_submissions.sorter.sort_by('Created')

        incomplete_apps = False
        import time
        previous_app_date = time.gmtime()

        for i in range(1, dev_submissions.paginator.total_page_number):
            for app in dev_submissions.submitted_apps:
                if app.is_incomplete:
                    incomplete_apps = True
                else:
                    if not incomplete_apps:
                        Assert.greater_equal(previous_app_date, app.date, 'Apps are not sorted ascending. According to Created date.')
                    else:
                        Assert.fail('Apps with a finished submission process are found after apps with the submission process unfinished')
            dev_submissions.paginator.click_next_page()
    def test_that_checks_apps_are_sorted_by_date(self, mozwebqa):
        dev_home = Home(mozwebqa)
        dev_home.go_to_developers_homepage()
        dev_home.login(user="******")

        dev_submissions = dev_home.header.click_my_submissions()

        dev_submissions.sorter.sort_by('Created')

        incomplete_apps = False
        import time
        previous_app_date = time.gmtime()

        for i in range(1, dev_submissions.paginator.total_page_number):
            for app in dev_submissions.submitted_apps:
                if app.is_incomplete:
                    incomplete_apps = True
                else:
                    if not incomplete_apps:
                        Assert.greater_equal(previous_app_date, app.date, 'Apps are not sorted ascending. According to Created date.')
                    else:
                        Assert.fail('Apps with a finished submission process are found after apps with the submission process unfinished')
            dev_submissions.paginator.click_next_page()
Example #45
0
def test_generate_random_int_args():
    maxvalue = 1
    random_int = randomness.generate_random_int(maxvalue)
    Assert.greater_equal(random_int, 0)
    Assert.less_equal(random_int, maxvalue)
Example #46
0
 def test_that_featured_themes_exist_on_the_home(self, mozwebqa):
     home_page = Home(mozwebqa)
     Assert.equal(home_page.featured_themes_title, u'Featured Themes See all \xbb', 'Featured Themes region title doesn\'t match')
     Assert.greater_equal(home_page.featured_themes_count, 6)
Example #47
0
 def test_greater_equal_fail_int_message(self):
     try:
         Assert.greater_equal(1, 2, "message")
     except AssertionError, e:
         pass 
Example #48
0
 def test_greater_equal_success(self):
     Assert.greater_equal("2", "1")
     Assert.greater_equal(2, 1)
     Assert.greater_equal("1", "1")
     Assert.greater_equal(1, 1)
Example #49
0
 def test_that_featured_themes_exist_on_the_home(self, mozwebqa):
     home_page = Home(mozwebqa)
     Assert.equal(home_page.featured_themes_title,
                  u'Featured Themes See all \xbb',
                  'Featured Themes region title doesn\'t match')
     Assert.greater_equal(home_page.featured_themes_count, 6)
Example #50
0
 def test_greater_equal_fail_int_message(self):
     try:
         Assert.greater_equal(1, 2, "message")
     except AssertionError as e:
         Assert.equal(e.msg, "message")
 def test_greater_equal_fail_int_message(self):
     try:
         Assert.greater_equal(1, 2, "message")
     except AssertionError as e:
         Assert.equal(e.msg, "message")
 def test_greater_equal_fail_string_message(self):
     try:
         Assert.greater_equal("1", "2", "message")
     except AssertionError as e:
         Assert.equal(e.msg, "message")
 def test_greater_equal_success(self):
     Assert.greater_equal("2", "1")
     Assert.greater_equal(2, 1)
     Assert.greater_equal("1", "1")
     Assert.greater_equal(1, 1)
Example #54
0
 def test_that_last_complete_themes_page_is_not_empty(self, mozwebqa):
     home_page = Home(mozwebqa)
     complete_themes_page = home_page.header.click_complete_themes()
     complete_themes_page.paginator.click_last_page()
     Assert.greater_equal(complete_themes_page.addon_count, 1)
Example #55
0
 def test_greater_equal_fail_string_message(self):
     try:
         Assert.greater_equal("1", "2", "message")
     except AssertionError as e:
         Assert.equal(e.msg, "message")