def test_assert_that_a_app_can_be_added_by_api(self, mozwebqa):
        mock_app = MockApplication()  # generate mock app
        mock_app.name = "API %s" % mock_app.name

        # init API client
        mk_api = MarketplaceAPI.get_client(mozwebqa.base_url, mozwebqa.credentials)

        mk_api.submit_app(mock_app)  # submit app

        app_status = mk_api.app_status(mock_app)  # get app data from API

        # Selenium
        dev_home = Home(mozwebqa)
        dev_home.go_to_developers_homepage()
        dev_home.login(user="default")

        dev_submissions = dev_home.header.click_my_submissions()

        dev_submissions.sorter.sort_by("created")
        apps = dev_submissions.submitted_apps

        app_names = []
        for app in apps:
            app_names.append(app.name)

        Assert.contains(app_status["name"], app_names)
Example #2
0
 def test_themes_subcategory_page_breadcrumb(self, mozwebqa):
     home_page = Home(mozwebqa)
     themes_page = home_page.click_themes()
     selected_category = themes_page.themes_category
     amo_category_page = themes_page.click_on_first_category()
     expected_breadcrumb = "Add-ons for Firefox Themes %s" % selected_category
     Assert.equal(expected_breadcrumb, amo_category_page.breadcrumb)
Example #3
0
    def test_that_article_can_be_translated(self, mozwebqa, variables):
        """
           Creates a new knowledge base article.
           Translate article
        """
        user = variables["users"]["admin"]
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page(user["username"], user["password"])

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

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

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

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

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

        # deleting
        kb_article_history.delete_entire_article_document()
Example #4
0
 def test_region_dropdown_link(self, mozwebqa):
     communities_page = Communities(mozwebqa)
     communities_page.go_to_page()
     click_regions = [
         communities_page.click_north_america,
         communities_page.click_latin_america,
         communities_page.click_europe,
         communities_page.click_asia_south_pacific,
         communities_page.click_africa_middle_east,
     ]
     region_communities = [
         communities_page.north_america_communities,
         communities_page.latin_america_communities,
         communities_page.europe_communities,
         communities_page.asia_south_pacific_communities,
         communities_page.africa_middle_east_communities,
     ]
     bad_communities = []
     for index, action in enumerate(click_regions):
         action()
         for community in region_communities[index]:
             communities_page.wait_until_element_visible(community)
             if not community.is_displayed():
                 bad_communities.append("%s is not displayed." % community.text)
     Assert.equal(
         0,
         len(bad_communities),
         "%s communities not displayed: " % len(bad_communities) + ", ".join(bad_communities),
     )
Example #5
0
 def test_that_clicking_on_theme_name_loads_its_detail_page(self, mozwebqa):
     """test for litmus 15363"""
     home_page = Home(mozwebqa)
     themes_page = home_page.click_themes()
     theme_name = themes_page.addon_name(1)
     theme_page = themes_page.click_on_first_addon()
     Assert.contains(theme_name, theme_page.addon_title)
 def test_that_clicking_on_theme_name_loads_its_detail_page(self, mozwebqa):
     """Test for Litmus 15363."""
     home_page = Home(mozwebqa)
     themes_page = home_page.header.site_navigation_menu("Themes").click()
     theme_name = themes_page.addon_name(1)
     theme_page = themes_page.click_on_first_addon()
     Assert.contains(theme_name, theme_page.addon_title)
 def test_vm_power_off_cancel(self, vm_system, verify_vm_running):
     vm_pg = verify_vm_running
     vm_pg.power_off([vm_system], True)
     time.sleep(60)
     vm_pg.refresh()
     vm_pg.find_vm_page(vm_system, None, False)
     Assert.true(vm_pg.quadicon_region.get_quadicon_by_title(vm_system).current_state == "on", "vm not running")
Example #8
0
    def test_visitor_can_view_history(self, mozwebqa):
        home_pg = HomePage(mozwebqa)
        home_pg.go_to_home_page()

        history_pg = home_pg.header_region.click_history()
        Assert.true(history_pg.is_the_current_page)
        Assert.greater(len(history_pg.history_list.strip()), 0)
Example #9
0
 def test_the_featured_personas_section(self, testsetup):
     """ Test for Litmus 15392
         https://litmus.mozilla.org/show_test.cgi?id=15392"""
     amo_home_page = AddonsHomePage(testsetup)
     amo_personas_page = amo_home_page.click_personas()
     Assert.true(amo_personas_page.is_the_current_page)
     Assert.equal(6, amo_personas_page.featured_personas_count)
    def test_reviews_section(self, mozwebqa):
        """https://moztrap.mozilla.org/runtests/run/243/env/112/ - Verify details page for an app - Reviews section"""
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        # click first app and load its Details Page
        search_term = self._take_first_popular_app_name(mozwebqa)
        details_page = home_page.search_and_click_on_app(search_term)

        # This takes the number of reviews on the details page and based on that number it treats 3 different scenarios:
        # when the app has reviews, when it has 1 review and when the app isn't rated.
        if details_page.is_app_rated:
            if details_page.reviews_count >= 2:
                if len(details_page.reviews) == 2:
                    for review in details_page.reviews:
                        Assert.true(review.is_visible)
            elif details_page.reviews_count == 1:
                Assert.true(details_page.reviews[0].is_visible)
        else:
            Assert.equal(details_page.app_not_rated_text, "App not yet rated")

        Assert.true(details_page.is_write_a_review_button_visible)

        for support_button in details_page.support_buttons_list:
            Assert.true(details_page.is_element_visible(*support_button))
    def test_is_id_ft_locator_available(self, mozwebqa):

        """
        Test pages elements defined in CoursesCsce499DocDesignHtmlpage object: coursescsce499docdesignhtml.py
        """
        page = CoursesCsce499DocDesignHtml(mozwebqa)
        Assert.true(page.is_id_ft_locator_available)
Example #12
0
    def test_could_install_theme(self, mozwebqa):
        """note that this test does not actually *install* the theme"""

        home_page = Home(mozwebqa)
        complete_themes_page = home_page.header.click_complete_themes()
        complete_theme_page = complete_themes_page.click_on_first_addon()
        Assert.true(complete_theme_page.is_install_button_visible)
Example #13
0
    def test_add_new_storage_chargeback(self, intel_chargeback_pg, random_string):
        # Add a new Storage Chargeback
        Assert.true(intel_chargeback_pg.is_the_current_page)
        rates_pg = intel_chargeback_pg.click_on_rates()
        storage_pg = rates_pg.click_on_storage()
        add_storage_chargeback_pg = storage_pg.click_on_add_new_chargeback_rate()
        storage_chargeback_description = random_string
        self._storage_chargeback_list.append(random_string)
        # Edit to change the Details of the Storage Chargeback
        Description = storage_chargeback_description
        Fixed_1 = ""
        Fixed_1_per_time = ""
        Fixed_2 = 4000
        Fixed_2_per_time = "Monthly"
        Alloc_Disk_Storage = 2000
        Alloc_Disk_Storage_per_time = "Daily"
        Used_Disk_Storage = 6000
        Used_Disk_Storage_per_time = "Daily"

        add_fields = add_storage_chargeback_pg.fill_data(
            Description,
            Fixed_1,
            Fixed_1_per_time,
            Fixed_2,
            Fixed_2_per_time,
            Alloc_Disk_Storage,
            Alloc_Disk_Storage_per_time,
            Used_Disk_Storage,
            Used_Disk_Storage_per_time,
        )
        add_storage_chargeback = add_storage_chargeback_pg.click_on_add()
        Assert.true(
            storage_pg.flash.message.startswith('Chargeback Rate "%s" was added' % storage_chargeback_description)
        )
 def test_that_verifies_the_tooltip_for_Other_Applications(self, mozwebqa):
     """
     Litmus 22925
     https://litmus.mozilla.org/show_test.cgi?id=22925
     """
     amo_home_page = AddonsHomePage(mozwebqa)
     Assert.equal(amo_home_page.header.other_applications_tooltip, "Find add-ons for other applications")
 def test_that_most_popular_link_is_default(self, mozwebqa):
     """Test for Litmus 15348"""
     home_page = Home(mozwebqa)
     themes_page = home_page.header.site_navigation_menu("Themes").click()
     url_current_page = themes_page.get_url_current_page()
     Assert.true(url_current_page.endswith("/themes/"))
     Assert.equal(themes_page.selected_explore_filter, "Most Popular")
Example #16
0
    def test_events_timeline_is_visible(self, mozwebqa):
        home_page = Home(mozwebqa)

        events_page = home_page.header.click_events_link()
        events_page.click_timeline()
        events_page.wait_for_page_to_load()
        Assert.true(events_page.is_events_timeline_visible)
 def test_sorted_by_most_users_is_default(self, mozwebqa):
     """Test for Litmus 15346."""
     home_page = Home(mozwebqa)
     themes_page = home_page.header.site_navigation_menu("Themes").click()
     url_current_page = themes_page.get_url_current_page()
     Assert.true(url_current_page.endswith("/themes/"))
     Assert.equal(themes_page.sorted_by, "Most Users")
Example #18
0
    def test_advanced_options_are_visible(self, mozwebqa):
        home_page = Home(mozwebqa)

        events_page = home_page.header.click_events_link()
        events_page.click_advanced_options()
        Assert.true(events_page.is_advanced_search_form_visible)
        Assert.true(events_page.is_events_icalendar_export_button_visible)
Example #19
0
    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)
Example #20
0
    def test_filter_results_by_owner(self, mozwebqa):
        query = u"John Giannelos"
        home_page = Home(mozwebqa)

        events_page = home_page.header.click_events_link()
        events_page.filter_for(query)
        Assert.equal(u"John Giannelos", events_page.event_profile_owner_text)
Example #21
0
 def check_bad_links(self, page, link_list):
     bad_links = []
     for link in link_list:
         url = page.link_destination(link.get("locator"))
         if not url.endswith(link.get("url_suffix")):
             bad_links.append("%s does not end with %s" % (url, link.get("url_suffix")))
     Assert.equal(0, len(bad_links), "%s bad links found: " % len(bad_links) + ", ".join(bad_links))
Example #22
0
    def test_filter_results_by_location(self, mozwebqa):
        query = u"Greece"
        home_page = Home(mozwebqa)

        events_page = home_page.header.click_events_link()
        events_page.filter_for(query)
        Assert.contains(u"Greece", events_page.event_profile_location_text)
Example #23
0
    def collect_links(self, url, relative=True, name=True, **kwargs):
        """Collects links for given page URL.

        If name is True, then links will be collected for whole page.
        Use name argument to pass tag name of element.
        Use kwargs to pass id of element or its class name.
        Because 'class' is a reserved keyword in Python,
        you need to pass class as: **{'class': 'container row'}.

        Read more about searching elements with BeautifulSoup.
        See: http://goo.gl/85BuZ
        """

        # support for relative URLs
        if relative:
            url = "%s%s" % (self.base_url, url)

        # get the page and verify status code is OK
        r = requests.get(url)
        Assert.true(r.status_code == requests.codes.ok, u"{0.url} returned: {0.status_code} {0.reason}".format(r))

        # collect links
        parsed_html = BeautifulSoup(r.text)
        urls = [anchor["href"] for anchor in parsed_html.find(name, attrs=kwargs).findAll("a")]

        # prepend base_url to relative links
        return map(lambda u: u if u.startswith("http") else "%s%s" % (self.base_url, u), urls)
Example #24
0
    def test_that_favicon_present(self, mozwebqa):

        home_page = HomePage(mozwebqa)
        favicon_url = home_page.favicon_url
        r = requests.get(favicon_url, verify=False)

        Assert.equal(r.status_code, 200, u"request to %s responded with %s status code" % (favicon_url, r.status_code))
Example #25
0
 def test_that_clicking_on_a_subcategory_loads_expected_page(self, mozwebqa):
     """test for litmus 15949"""
     home_page = Home(mozwebqa)
     themes_page = home_page.click_themes()
     selected_category = themes_page.themes_category
     amo_category_page = themes_page.click_on_first_category()
     Assert.equal(selected_category, amo_category_page.title)
Example #26
0
    def test_that_robots_txt_present(self, mozwebqa):

        home_page = HomePage(mozwebqa)
        robots_url = u"%s/%s" % (home_page.base_url, "robots.txt")
        r = requests.get(robots_url, verify=False)

        Assert.equal(r.status_code, 200, u"request to %s responded with %s status code" % (robots_url, r.status_code))
Example #27
0
    def test_that_article_can_be_created(self, mozwebqa, variables):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article
        """
        user = variables["users"]["admin"]
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page(user["username"], user["password"])

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

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

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

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

        # delete the same article
        kb_article = kb_edit_article.navigation.click_show_history()
        kb_article.delete_entire_article_document()
 def test_that_clicking_on_a_subcategory_loads_expected_page(self, mozwebqa):
     """Test for Litmus 15949."""
     home_page = Home(mozwebqa)
     themes_page = home_page.header.site_navigation_menu("Themes").click()
     selected_category = themes_page.themes_category
     amo_category_page = themes_page.click_on_first_category()
     Assert.equal(selected_category, amo_category_page.title)
Example #29
0
    def test_that_article_can_be_deleted(self, mozwebqa, variables):
        """
           Creates a new knowledge base article.
           Deletes the article.
           Verifies the deletion.
        """
        user = variables["users"]["admin"]
        kb_new_article = PageProvider(mozwebqa).new_kb_article_page(user["username"], user["password"])

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

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

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

        kb_article_history.selenium.get(article_url)
        actual_page_title = kb_article_history.page_title
        Assert.contains("Page Not Found", actual_page_title)
    def test_that_a_screenshot_can_be_added(self, mozwebqa_devhub_logged_in, free_app):
        """Test the happy path for adding a screenshot for a free submitted app."""

        edit_listing = self._go_to_edit_listing_page(mozwebqa_devhub_logged_in, free_app)
        before_screenshots_count = len(edit_listing.screenshots_previews)

        # bring up the media form for the first free app
        media_region = edit_listing.click_edit_media()
        screenshots_count = len(media_region.screenshots)

        # upload a new screenshot
        media_region.screenshot_upload(self._get_resource_path("img.jpg"))

        # check that the screenshot list is updated
        new_screenshots_count = len(media_region.screenshots)
        Assert.equal(
            screenshots_count + 1,
            new_screenshots_count,
            "Expected %s screenshots, but there are %s." % (screenshots_count + 1, new_screenshots_count),
        )

        # save the changes
        media_region.click_save_changes()

        # check that the icon preview has been updated
        after_screenshots_count = len(edit_listing.screenshots_previews)
        Assert.equal(
            before_screenshots_count + 1,
            len(edit_listing.screenshots_previews),
            "Expected %s screenshots, but there are %s." % (before_screenshots_count + 1, after_screenshots_count),
        )