def _create_review(self, mozwebqa, user):
        # Step 1 - Login into Marketplace
        mock_review = MockReview()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(user['email'], user['password'])
        assert home_page.is_the_current_page

        # Step 2 - Search for the test app and go to its details page
        app_name = self._take_first_free_app_name(mozwebqa)
        details_page = home_page.header.search_and_click_on_app(app_name)
        assert details_page.is_the_current_page

        details_page.wait_for_review_button_visible()
        assert 'Write a review' == details_page.review_button_text

        # Step 3 - Write a review
        add_review_box = details_page.click_review_button()
        details_page = add_review_box.write_a_review(mock_review['rating'], mock_review['body'])

        # Step 4 - Check review
        assert mock_review['rating'] == details_page.first_review_rating
        assert mock_review['body'] == details_page.first_review_body

        return app_name
 def test_that_verifies_categories_menu(self, base_url, selenium):
     home_page = Home(base_url, selenium)
     home_page.go_to_homepage()
     assert 'Categories' == home_page.header.categories_name
     assert home_page.header.categories_name == 'Categories'
     home_page.header.open_categories_menu()
     assert len(home_page.header.categories) > 0
    def test_that_reports_abuse_as_anonymous_user(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)
        search_page = home_page.header.search(self.search_term)

        # Select the first application link in the list
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_report_abuse_button_visible)
        report_abuse_box = details_page.click_report_abuse_button()

        Assert.true(report_abuse_box.is_visible)
        Assert.false(report_abuse_box.is_report_button_enabled)

        report_abuse_box.insert_text('This is an automatically generated report.')
        Assert.true(report_abuse_box.is_report_button_enabled)

        report_abuse_box.click_report_button()

        details_page.wait_notification_box_visible()
        Assert.equal(details_page.notification_message, "Abuse reported")
    def test_editing_user_profile(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(user="******")

        profile_page = home_page.header.click_edit_account_settings()
        initial_value = profile_page.display_name

        # Initial check
        Assert.equal(profile_page.email.split('@')[0], profile_page.display_name)

        # Data to submit
        name = 'Napoleon'

        profile_page.edit_display_name(name)
        profile_page.save_changes()
        profile_page.wait_notification_box_visible()
        Assert.equal(profile_page.notification_message, 'Settings saved')

        # Refresh page and then inspect saved settings
        profile_page.refresh_page()
        Assert.equal(profile_page.display_name, name)

        # Undo the changes
        profile_page.edit_display_name(initial_value)
        profile_page.save_changes()
        profile_page.wait_notification_box_not_visible()
Beispiel #5
0
 def test_that_verifies_categories_menu(self, mozwebqa):
     home_page = Home(mozwebqa)
     home_page.go_to_homepage()
     assert 'Categories' == home_page.header.categories_name
     assert home_page.header.categories_name == 'Categories'
     home_page.header.open_categories_menu()
     assert len(home_page.header.categories) > 0
Beispiel #6
0
 def test_that_checks_search_with_foreign_characters(self, mozwebqa):
     home_page = Home(mozwebqa)
     home_page.go_to_homepage()
     foreign_search_term = 'dödá pápègoján'.decode('utf-8')
     search_page = home_page.header.search(foreign_search_term)
     assert search_page.is_the_current_page
     assert foreign_search_term in search_page.page_title
    def test_that_checks_the_deletion_of_a_review(self, mozwebqa):
        """
        https://moztrap.mozilla.org/manage/case/648/
        """
        # Step 1 - Login into Marketplace
        user = MockUser()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.create_new_user(user)
        home_page.login(user)
        Assert.true(home_page.is_the_current_page)

        # Step 2 - Search for the test app and go to its details page
        search_page = home_page.header.search(self.test_app)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_submit_review_link_visible)

        # Step 3 - Write a review
        body = 'Automatic app review by Selenium tests %s' % datetime.now()
        rating = random.randint(1, 5)
        add_review_page = details_page.click_submit_review()
        reviews_page = add_review_page.write_a_review(rating, body)

        # Step 4 - Check review
        Assert.true(reviews_page.is_success_message_visible)

        # Step 5 - Delete review
        review = reviews_page.reviews[0]
        review.delete()
        Assert.true(reviews_page.is_success_message_visible)
        Assert.equal(reviews_page.success_message, "Your review was successfully deleted!")
        Assert.false(review.is_review_visible)
    def test_that_user_can_purchase_an_app(self, base_url, selenium, new_user):
        if '-dev' not in base_url:
            pytest.skip("Payments can only be tested on dev.")
        else:
            pytest.xfail("Bug 1212152 - App purchases are failing on dev")

        home_page = Home(base_url, selenium)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(new_user['email'], new_user['password'])
        assert home_page.is_the_current_page
        home_page.set_region('us')

        # Use the first paid app
        app = home_page.header.search(':paid').results[0]
        app_name = app.name
        details_page = app.click_name()
        assert 'free' not in details_page.price_text
        assert 'paid' in details_page.app_status

        payment = details_page.click_install_button()
        payment.create_pin(self.PIN)
        payment.wait_for_buy_app_section_displayed()
        assert app_name == payment.app_name

        payment.click_buy_button()
        # We are not able to interact with the doorhanger that appears to install the app
        # using Selenium
        # We can check for the `purchased` attribute on the price button though
        details_page.wait_for_app_purchased()
    def test_that_clicking_on_featured_app_loads_details_page(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        details_page = home_page.click_on_first_app()
        Assert.true(details_page.is_the_current_page)
    def test_that_checks_changing_language_on_home_page(self, mozwebqa):
        """Test for https://www.pivotaltracker.com/story/show/33702365"""

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        before_lang_change = [home_page.get_url_current_page(),
                            home_page.page_title,
                            home_page.featured_section_title_text,
                            home_page.most_popular_section_title_text,
                            home_page.categories.title,
                            home_page.header.search_field_placeholder,
                            home_page.footer.select_lang_label_text]

        home_page.footer.switch_to_another_language('ru')

        after_lang_change = [home_page.get_url_current_page(),
                            home_page.page_title,
                            home_page.featured_section_title_text,
                            home_page.most_popular_section_title_text,
                            home_page.categories.title,
                            home_page.header.search_field_placeholder,
                            home_page.footer.select_lang_label_text]

        Assert.not_equal(before_lang_change, after_lang_change)
    def test_that_checks_the_deletion_of_a_review(self, mozwebqa):
        """
        https://moztrap.mozilla.org/manage/case/648/
        """

        # Step 1 - Create new review
        mock_review = MockReview()
        mk_api = MarketplaceAPI(credentials=mozwebqa.credentials['api'])
        app = mk_api.get_app(self.test_app)
        review_id = mk_api.submit_app_review(app['id'], mock_review.body, mock_review.rating)

        # Step 2 - Login into Marketplace
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.login(user="******")
        home_page.wait_notification_box_not_visible()
        Assert.true(home_page.is_the_current_page)

        # Step 3 - Search for the test app and go to its details page
        search_page = home_page.header.search(self.test_app)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        # Step 4 - Go to reviews page
        reviews_page = details_page.click_reviews_button()

        # Step 5 - Delete review
        reviews = reviews_page.reviews[0]
        reviews.delete()
        Assert.true(reviews_page.notification_visible)
        Assert.equal(reviews_page.notification_message, "Review deleted")
        Assert.false(reviews.is_review_visible)
    def test_that_promo_module_is_visible(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.is_promo_box_visible)
        Assert.greater(home_page.promo_box_items_number, 0)
    def test_opening_category_pages_from_categories_menu(self, mozwebqa):
        """Open the first 3 category pages and check the first 3 apps on those pages."""

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        categories = home_page.categories.items
        # only check the first three categories
        for c in range(3):
            home_page.open_categories_menu()
            category = categories[c]
            category_name = category.name
            category_page = category.click_category()
            Assert.equal(category_name.title(), category_page.category_title)
            Assert.true(category_page.is_the_current_page)
            apps = category_page.apps
            Assert.true(len(apps) > 0)
            Assert.true(category_page.is_new_popular_tabs_visible)
            Assert.true(category_page.popular_tab_class == 'active')

            # only check the first three apps in the category
            for a in range(3):
                app = apps[a]
                Assert.true(app.is_name_visible)
                Assert.true(app.is_icon_visible)
                Assert.true(app.is_rating_visible)
                Assert.true(app.is_install_visible)
    def test_that_reports_abuse_as_anonymous_user(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)

        search_term = self._take_first_new_app_name(mozwebqa)
        details_page = home_page.header.search_and_click_on_app(search_term)

        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_report_abuse_button_visible)
        report_abuse_box = details_page.click_report_abuse_button()

        Assert.true(report_abuse_box.is_visible)
        Assert.false(report_abuse_box.is_report_button_enabled)

        report_abuse_box.insert_text('This is an automatically generated report.')
        Assert.true(report_abuse_box.is_report_button_enabled)

        report_abuse_box.click_report_button()

        details_page.wait_notification_box_visible()
        Assert.equal(details_page.notification_message, "Abuse reported")
Beispiel #15
0
    def test_that_reports_abuse_as_signed_in_user(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)
        home_page.login(user="******")
        Assert.true(home_page.header.is_user_logged_in)

        search_term = self._take_first_new_app_name(mozwebqa)
        details_page = home_page.header.search_and_click_on_app(search_term)

        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_report_abuse_button_visible)
        report_abuse_box = details_page.click_report_abuse_button()

        Assert.true(report_abuse_box.is_visible)
        Assert.false(report_abuse_box.is_report_button_enabled)

        report_abuse_box.insert_text('This is an automatically generated report.')
        Assert.true(report_abuse_box.is_report_button_enabled)

        report_abuse_box.click_report_button()

        details_page.wait_notification_box_visible()
        Assert.equal(details_page.notification_message, "Abuse reported")
 def test_statistics_graph_is_visible(self, mozwebqa):
     home_page = Home(mozwebqa)
     home_page.go_to_homepage()
     search_page = home_page.header.search(self.search_term)
     app_details_page = search_page.results[0].click_name()
     statistics_page = app_details_page.click_statistics()
     Assert.true(statistics_page.is_chart_visible)
Beispiel #17
0
    def test_that_reports_abuse_as_signed_in_user(self, mozwebqa, new_user):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        Assert.true(home_page.is_the_current_page)

        home_page.header.click_sign_in()
        home_page.login(new_user['email'], new_user['password'])
        Assert.true(home_page.header.is_user_logged_in)

        search_term = self._take_first_free_app_name(mozwebqa)
        details_page = home_page.header.search_and_click_on_app(search_term)

        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_report_abuse_button_visible)
        report_abuse_box = details_page.click_report_abuse_button()

        Assert.true(report_abuse_box.is_visible)

        report_abuse_box.insert_text(
            'This is an automatically generated report.')
        Assert.true(report_abuse_box.is_report_button_enabled)

        report_abuse_box.click_report_button()
        details_page.wait_for_notification('Report submitted. Thanks!')
 def test_that_checks_search_with_foreign_characters(self, base_url, selenium):
     home_page = Home(base_url, selenium)
     home_page.go_to_homepage()
     foreign_search_term = 'dödá pápègoján'.decode('utf-8')
     search_page = home_page.header.search(foreign_search_term)
     assert search_page.is_the_current_page
     assert foreign_search_term in search_page.page_title
    def test_that_checks_changing_language_on_home_page(self, mozwebqa):
        """Test for https://www.pivotaltracker.com/story/show/33702365"""

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        before_lang_change = [
            home_page.get_url_current_page(), home_page.page_title,
            home_page.featured_section_title_text,
            home_page.most_popular_section_title_text,
            home_page.categories.title,
            home_page.header.search_field_placeholder,
            home_page.footer.select_lang_label_text
        ]

        home_page.footer.switch_to_another_language('ru')

        after_lang_change = [
            home_page.get_url_current_page(), home_page.page_title,
            home_page.featured_section_title_text,
            home_page.most_popular_section_title_text,
            home_page.categories.title,
            home_page.header.search_field_placeholder,
            home_page.footer.select_lang_label_text
        ]

        Assert.not_equal(before_lang_change, after_lang_change)
    def test_that_header_menu_has_expected_items(self, mozwebqa):
        """
        Verify the menu opens & closes.  Verify menu item names
        """

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.false(home_page.header.menu.is_menu_visible,
                     "Menu open at page open")

        # open menu and verify visibility
        home_page.header.menu.open_menu()
        Assert.true(home_page.header.menu.is_menu_visible, "Menu is not open")

        # verify menu item names
        expected_menu = [
            "Home", "Popular", "Top Free", "Top Paid", "Categories"
        ]
        Assert.equal(expected_menu,
                     [item.name for item in home_page.header.menu.items],
                     "Unexpected menu item")

        # close menu and verify
        home_page.header.menu.close_menu()
        Assert.false(home_page.header.menu.is_menu_visible,
                     "Menu did not close")
Beispiel #21
0
    def test_that_promo_module_is_visible(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.is_promo_box_visible)
        Assert.greater(home_page.promo_box_items_number, 0)
    def test_that_purchases_an_app_without_pre_auth_and_requests_a_refund(self, mozwebqa):
        """Litmus 58166"""
        home_page = Home(mozwebqa)

        home_page.go_to_homepage()
        home_page.login()

        Assert.true(home_page.is_the_current_page)

        search_page = home_page.header.search(self._app_name)
        Assert.true(search_page.is_the_current_page)

        Assert.not_equal("FREE", search_page.results[0].price)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_app_available_for_purchase)

        pre_approval_region = details_page.click_purchase()

        paypal_frame = pre_approval_region.click_one_time_payment()

        paypal_popup = paypal_frame.login_to_paypal()
        Assert.true(paypal_popup.is_user_logged_into_paypal)

        try:
            # From this point on we have payed for the app so we have to request a refund
            paypal_popup.click_pay()
            paypal_popup.close_paypal_popup()

            Assert.true(details_page.is_app_installing)
        except Exception as exception:
            Assert.fail(exception)
        finally:
            self.request_refund_procedure(mozwebqa, self._app_name)
    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_editing_user_profile(self, mozwebqa):
        """Test for https://www.pivotaltracker.com/story/show/33709085"""

        user = PersonaTestUser().create_user()

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.login(user)

        profile_page = home_page.header.click_edit_account_settings()
        _username = user['email'].split('@')[0]

        # Initial check
        Assert.equal(profile_page.browser_id_email, user['email'])
        Assert.equal(profile_page.display_name, _username)

        # Data to submit. Username should be unique
        name = 'Napoleon'

        profile_page.edit_display_name(name)
        profile_page.save_changes()
        Assert.true(profile_page.notification_visible)

        # Refresh page and then inspect saved settings
        profile_page.refresh_page()
        Assert.equal(profile_page.display_name, name)
    def test_that_the_search_tag_is_present_in_the_search_results(
            self, mozwebqa):
        """Litmus 53263"""

        home_page = Home(mozwebqa)

        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)
        search_page = home_page.header.search(self.search_term)

        # Check page title
        Assert.equal("%s | Search | Mozilla Marketplace" % self.search_term,
                     search_page.page_title)

        # Check the breadcrumbs
        Assert.equal("Home", search_page.breadcrumbs[0].text)
        Assert.equal("Search", search_page.breadcrumbs[1].text)
        Assert.equal(self.search_term, search_page.breadcrumbs[2].text)

        # Check title for the search
        Assert.equal('Search Results for "%s"' % self.search_term,
                     search_page.title)

        # Check that the first result contains the search term
        Assert.contains(self.search_term, search_page.results[0].name)
    def test_that_the_search_tag_is_present_in_the_search_results(self, mozwebqa):
        """Litmus 53263"""

        search_term = "SeaVan"
        home_page = Home(mozwebqa)

        home_page.go_to_homepage()
        home_page.login()

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

        # Check page title
        Assert.equal("%s | Search | Mozilla Marketplace" % search_term, search_page.page_title)

        # Check the breadcrumbs
        Assert.equal("Home", search_page.breadcrumbs[0].text)
        Assert.equal("Search", search_page.breadcrumbs[1].text)
        Assert.equal("SeaVan", search_page.breadcrumbs[2].text)

        # Check title for the search
        Assert.equal('Search Results for "%s"' % search_term, search_page.title)

        # Check that the first result contains the search term
        Assert.contains(search_term, search_page.results[0].name)
    def test_that_checks_the_addition_of_a_review(self, mozwebqa):

        # Step 1 - Login into Marketplace
        user = MockUser()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.create_new_user(user)
        home_page.login(user)
        Assert.true(home_page.is_the_current_page)

        # Step 2 - Search for the test app and go to its details page
        search_page = home_page.header.search(self.test_app)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_submit_review_link_visible)
        Assert.equal(details_page.submit_review_link, "Submit a Review")

        # Step 3 - Write a review
        body = 'Automatic app review by Selenium tests %s' % datetime.now()
        rating = random.randint(1, 5)
        add_review_page = details_page.click_submit_review()
        review_page = add_review_page.write_a_review(rating, body)

        # Step 4 - Check review
        Assert.true(review_page.is_success_message_visible)
        Assert.equal(review_page.success_message, "Your review was successfully added!")
        review = review_page.reviews[0]
        Assert.equal(review.rating, rating)
        Assert.equal(review.author, user.name)
        Assert.equal(review.text, body)
    def request_refund_procedure(self, mozwebqa, app_name):
        """necessary steps to request a refund"""
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        if not home_page.footer.is_user_logged_in:
            home_page.login()
        Assert.true(home_page.is_the_current_page)
        Assert.true(home_page.footer.is_user_logged_in)

        account_history_page = home_page.footer.click_account_history()
        purchased_apps = account_history_page.purchased_apps

        stop = True
        idx = 0
        while stop:
            if purchased_apps[idx].name == app_name:
                app_support_page = purchased_apps[idx].click_request_support()

                request_refund_page = app_support_page.click_request_refund()
                account_history_page = request_refund_page.click_continue()
                stop = False
            else:
                idx = idx + 1

        Assert.true(account_history_page.was_refund_successful, account_history_page.error_notification_text)
        Assert.equal(account_history_page.successful_notification_text, "Refund is being processed.")
    def test_that_checks_changing_language(self, mozwebqa):

        if mozwebqa.base_url == 'https://marketplace-dev.allizom.org' or mozwebqa.base_url == 'https://marketplace.allizom.org':
            pytest.skip("We currently don't have the option for changing the language in Fireplace")

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.login()

        profile_page = home_page.header.click_edit_account_settings()

        language = 'fr'

        before_lang_change = [profile_page.get_url_current_page(),
                            profile_page.page_title,
                            profile_page.account_settings_header_text,
                            profile_page.display_name_field_text,
                            profile_page.language_field_text,
                            profile_page.region_field_text,
                            profile_page.header.search_field_placeholder,
                            profile_page.save_button_text]

        profile_page.edit_language(language)
        profile_page.save_changes()

        after_lang_change = [profile_page.get_url_current_page(),
                            profile_page.page_title,
                            profile_page.account_settings_header_text,
                            profile_page.display_name_field_text,
                            profile_page.language_field_text,
                            profile_page.region_field_text,
                            profile_page.header.search_field_placeholder,
                            profile_page.save_button_text]

        Assert.not_equal(before_lang_change, after_lang_change)
    def _create_review(self, base_url, selenium, user):
        # Step 1 - Login into Marketplace
        mock_review = MockReview()
        home_page = Home(base_url, selenium)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(user['email'], user['password'])
        assert home_page.is_the_current_page

        # Step 2 - Search for the test app and go to its details page
        app_name = self._take_first_free_app_name(base_url, selenium)
        details_page = home_page.header.search_and_click_on_app(app_name)
        assert details_page.is_the_current_page

        details_page.wait_for_review_button_visible()
        assert 'Write a review' == details_page.review_button_text

        # Step 3 - Write a review
        add_review_box = details_page.click_review_button()
        details_page = add_review_box.write_a_review(mock_review['rating'], mock_review['body'])

        # Step 4 - Check review
        assert mock_review['rating'] == details_page.first_review_rating
        assert mock_review['body'] == details_page.first_review_body

        return app_name
    def test_that_checks_the_addition_of_a_review(self, mozwebqa):

        # Step 1 - Login into Marketplace
        user = MockUser()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.create_new_user(user)
        home_page.login(user)
        Assert.true(home_page.is_the_current_page)

        # Step 2 - Search for the test app and go to its details page
        search_page = home_page.header.search(self.test_app)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_submit_review_link_visible)
        Assert.equal(details_page.submit_review_link, "Submit a Review")

        # Step 3 - Write a review
        body = 'Automatic app review by Selenium tests %s' % datetime.now()
        rating = random.randint(1, 5)
        add_review_page = details_page.click_submit_review()
        review_page = add_review_page.write_a_review(rating, body)

        # Step 4 - Check review
        Assert.true(review_page.is_success_message_visible)
        Assert.equal(review_page.success_message,
                     "Your review was successfully added!")
        review = review_page.reviews[0]
        Assert.equal(review.rating, rating)
        Assert.equal(review.author, user.name)
        Assert.equal(review.text, body)
    def test_that_checks_the_deletion_of_a_review(self, mozwebqa):
        """
        https://moztrap.mozilla.org/manage/case/648/
        """
        # Step 1 - Login into Marketplace
        mock_review = MockReview()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.login()
        Assert.true(home_page.is_the_current_page)

        # Step 2 - Search for the test app and go to its details page
        search_page = home_page.header.search(self.test_app)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)
        Assert.true(details_page.is_write_review_link_visible)

        # Step 3 - Write a review
        add_review_box = details_page.click_write_review()
        reviews_page = add_review_box.write_a_review(mock_review['rating'], mock_review['body'])

        # Step 4 - Check review
        Assert.true(reviews_page.is_success_message_visible)

        # Step 5 - Delete review
        reviews = reviews_page.reviews[0]
        reviews.delete()
        Assert.true(reviews_page.is_success_message_visible)
        Assert.equal(reviews_page.success_message, "Your review was successfully deleted!")
        Assert.false(reviews.is_review_visible)
    def test_editing_user_profile(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.header.click_sign_in()
        acct = self.create_new_user(mozwebqa)
        home_page.login(acct)

        profile_page = home_page.header.click_edit_account_settings()

        # Initial check
        Assert.equal(profile_page.email.split('@')[0], profile_page.display_name)

        # Data to submit
        name = 'Napoleon'

        profile_page.edit_display_name(name)
        profile_page.save_changes()
        profile_page.wait_notification_box_visible()
        Assert.equal(profile_page.notification_message, 'Your settings have been successfully saved')

        # Refresh page and then inspect saved settings
        profile_page.refresh_page()
        Assert.equal(profile_page.display_name, name)
    def request_refund_procedure(self, mozwebqa, app_name):
        """necessary steps to request a refund"""
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

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

        account_history_page = home_page.footer.click_account_history()
        purchased_apps = account_history_page.purchased_apps

        for listed_app in purchased_apps:
            if listed_app.name == app_name:
                app_support_page = listed_app.click_request_support()
                break

        request_refund_page = app_support_page.click_request_refund()
        account_history_page = request_refund_page.click_continue()

        if not account_history_page.was_refund_successful and \
           account_history_page.error_notification_text == "There was an error with your instant refund.":
            pytest.xfail(reason="Bugzilla 769364 - IPN Updates refund table")

        Assert.true(account_history_page.was_refund_successful, account_history_page.error_notification_text)
        Assert.equal(account_history_page.successful_notification_text, "Refund is being processed.")
    def test_that_checks_the_editing_of_a_review(self, mozwebqa):

        self._reviews_setup(mozwebqa)

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        # Login into Marketplace
        home_page.login(user="******")
        Assert.true(home_page.is_the_current_page)

        # Search for the test app and go to its details page
        search_page = home_page.header.search(self.app_name)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_edit_review_button_visible)
        Assert.equal(details_page.edit_review_button, "Edit Your Review")

        # Write a review
        edit_review = details_page.click_edit_review()
        mock_review = MockReview()
        details_page = edit_review.write_a_review(mock_review['rating'], mock_review['body'])

        # Check notification
        Assert.equal(details_page.notification_message, "Review updated successfully")

        # Go to reviews page and verify
        reviews = details_page.click_reviews_button()
        Assert.equal(reviews.logged_in_users_review.text, mock_review['body'])
        Assert.equal(reviews.logged_in_users_review.rating, mock_review['rating'])

        # Clean up
        self.mk_api.delete_app_review(self.review_id)
    def test_that_purchases_an_app_without_pre_auth_and_requests_a_refund(self, mozwebqa):
        """Litmus 58166"""
        user = MockUser()
        home_page = Home(mozwebqa)

        home_page.go_to_homepage()
        home_page.create_new_user(user)
        home_page.login(user)

        Assert.true(home_page.is_the_current_page)

        search_page = home_page.header.search(self._app_name)
        Assert.true(search_page.is_the_current_page)

        Assert.not_equal("FREE", search_page.results[0].price)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_app_available_for_purchase)

        pre_aproval_region = details_page.click_purchase()

        paypal_frame = pre_aproval_region.click_one_time_payment()

        paypal_popup = paypal_frame.login_to_paypal()
        Assert.true(paypal_popup.is_user_logged_into_paypal)

        try:
            # From this point on we have payed for the app so we have to request a refund
            paypal_popup.click_pay()
            paypal_popup.close_paypal_popup()

            Assert.true(details_page.is_app_installing)
        except Exception as exception:
            Assert.fail(exception)
        finally:
            self.request_refund_procedure(mozwebqa, self._app_name)
    def request_refund_procedure(self, mozwebqa, app_name):
        """necessary steps to request a refund"""
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

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

        account_history_page = home_page.footer.click_account_history()
        purchased_apps = account_history_page.purchased_apps

        for listed_app in purchased_apps:
            if listed_app.name == app_name:
                app_support_page = listed_app.click_request_support()
                break

        request_refund_page = app_support_page.click_request_refund()
        account_history_page = request_refund_page.click_continue()

        if not account_history_page.was_refund_successful and \
           account_history_page.error_notification_text == "There was an error with your instant refund.":
            pytest.xfail(reason="Bugzilla 769364 - IPN Updates refund table")

        Assert.true(account_history_page.was_refund_successful, account_history_page.error_notification_text)
        Assert.equal(account_history_page.successful_notification_text, "Refund is being processed.")
 def test_that_verifies_categories_menu(self, mozwebqa):
     home_page = Home(mozwebqa)
     home_page.go_to_homepage()
     assert 'Categories' == home_page.header.categories_name
     assert home_page.header.categories_name == 'Categories'
     home_page.header.open_categories_menu()
     assert len(home_page.header.categories) > 0
Beispiel #39
0
    def test_opening_category_pages_from_categories_menu(self, mozwebqa):
        """Open the first 3 category pages and check the first 3 apps on those pages."""

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        categories = home_page.categories.items
        # only check the first three categories
        for c in range(3):
            home_page.open_categories_menu()
            category = categories[c]
            category_name = category.name
            category_page = category.click_category()
            Assert.equal(category_name.title(), category_page.category_title)
            Assert.true(category_page.is_the_current_page)
            apps = category_page.apps
            Assert.true(len(apps) > 0)
            Assert.true(category_page.is_new_popular_tabs_visible)
            Assert.true(category_page.popular_tab_class == 'active')

            # only check the first three apps in the category
            for a in range(3):
                app = apps[a]
                Assert.true(app.is_name_visible)
                Assert.true(app.is_icon_visible)
                Assert.true(app.is_rating_visible)
                Assert.true(app.is_install_visible)
    def test_add_review_after_sign_in_from_details_page(self, mozwebqa):

        # Go to Marketplace Home page
        mock_review = MockReview()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        Assert.true(home_page.is_the_current_page)

        # Search for the test app and go to its details page
        search_term = self._take_first_new_app_name(mozwebqa)
        details_page = home_page.header.search_and_click_on_app(search_term)
        Assert.true(details_page.is_the_current_page)
        Assert.equal(details_page.review_button_text, "Sign in to review")

        # Login
        add_review_box = details_page.click_review_button()
        acct = self.create_new_user(mozwebqa)
        details_page.login(acct)

        add_review_box.write_a_review(mock_review['rating'], mock_review['body'])
        details_page.wait_notification_box_visible()
        details_page.wait_notification_box_not_visible()

        Assert.equal(details_page.first_review_rating, mock_review['rating'])
        Assert.equal(details_page.first_review_body, mock_review['body'])
    def test_that_reports_abuse_as_signed_in_user(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.is_the_current_page)
        home_page.login(user="******")
        Assert.true(home_page.header.is_user_logged_in)

        search_page = home_page.header.search(self.search_term)

        # Select the first application link in the list
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_report_abuse_button_visible)
        report_abuse_box = details_page.click_report_abuse_button()

        Assert.true(report_abuse_box.is_visible)
        Assert.false(report_abuse_box.is_report_button_enabled)

        report_abuse_box.insert_text('This is an automatically generated report.')
        Assert.true(report_abuse_box.is_report_button_enabled)

        report_abuse_box.click_report_button()

        details_page.wait_notification_box_visible()
        Assert.equal(details_page.notification_message, "Abuse reported")
    def test_that_checks_the_addition_of_a_review(self, mozwebqa):

        # Step 1 - Login into Marketplace
        mock_review = MockReview()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.header.click_sign_in()
        acct = self.create_new_user(mozwebqa)
        home_page.login(acct)
        Assert.true(home_page.is_the_current_page)

        # Step 2 - Search for the test app and go to its details page
        search_term = self._take_first_new_app_name(mozwebqa)
        details_page = home_page.header.search_and_click_on_app(search_term)
        Assert.true(details_page.is_the_current_page)

        details_page.wait_for_review_button_visible()
        Assert.equal(details_page.review_button_text, "Write a review")

        # Step 3 - Write a review
        add_review_box = details_page.click_review_button()
        details_page = add_review_box.write_a_review(mock_review['rating'], mock_review['body'])

        # Step 4 - Check review
        details_page.wait_notification_box_visible()
        Assert.equal(details_page.notification_message, "Your review was successfully posted. Thanks!")
        details_page.wait_notification_box_not_visible()

        Assert.equal(details_page.first_review_rating, mock_review['rating'])
        Assert.equal(details_page.first_review_body, mock_review['body'])
    def test_that_checks_changing_language(self, mozwebqa):
        """Test for https://www.pivotaltracker.com/story/show/33702365"""

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.login()

        profile_page = home_page.header.click_account_settings()

        language = 'fr'

        before_lang_change = [profile_page.get_url_current_page(),
                            profile_page.page_title,
                            profile_page.account_settings_header_text,
                            profile_page.header.search_field_placeholder,
                            profile_page.save_button_text]

        profile_page.edit_language(language)

        after_lang_change = [profile_page.get_url_current_page(),
                            profile_page.page_title,
                            profile_page.account_settings_header_text,
                            profile_page.header.search_field_placeholder,
                            profile_page.save_button_text]

        Assert.not_equal(before_lang_change, after_lang_change)
    def test_editing_user_profile(self, mozwebqa):
        """Test for https://www.pivotaltracker.com/story/show/33709085"""

        user = PersonaTestUser().create_user()

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.login(user)

        profile_page = home_page.header.click_account_settings()
        _username = user['email'].split('@')[0]

        #Initial check
        Assert.equal(profile_page.browser_id_email, user['email'])
        Assert.equal(profile_page.display_name, _username)

        # Data to submit. Username should be unique
        name = 'Napoleon'
        region = 'br'

        profile_page.edit_display_name(name)
        profile_page.edit_region(region)
        profile_page.save_changes()

        Assert.equal(profile_page.display_name, name)
        Assert.equal(profile_page.change_user_region, region)
    def test_that_checks_the_deletion_of_a_review(self, mozwebqa):
        """
        https://moztrap.mozilla.org/manage/case/648/
        """

        self._reviews_setup(mozwebqa)

        # Step 1 - Login into Marketplace
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.login(user="******")
        Assert.true(home_page.is_the_current_page)

        # Step 3 - Search for the test app and go to its details page
        search_page = home_page.header.search(self.app_name)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        # Step 4 - Go to reviews page
        reviews_page = details_page.click_reviews_button()

        # Step 5 - Delete review
        reviews = reviews_page.reviews[0]
        reviews.delete()

        reviews_page.wait_notification_box_visible()
        Assert.equal(reviews_page.notification_message, "Review deleted")
        Assert.false(reviews.is_review_visible)
    def test_that_checks_the_addition_of_a_review(self, mozwebqa):
        self._reviews_setup(mozwebqa)

        # delete the review before getting started
        self.mk_api.delete_app_review(self.review_id)

        # so that teardown does not try to delete the review
        del self.review_id

        # Step 1 - Login into Marketplace
        mock_review = MockReview()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.login(user="******")
        Assert.true(home_page.is_the_current_page)

        # Step 2 - Search for the test app and go to its details page
        search_page = home_page.header.search(self.app_name)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_write_review_button_visible)
        Assert.equal(details_page.write_review_button, "Write a Review")

        # Step 3 - Write a review
        add_review_box = details_page.click_write_review()
        details_page = add_review_box.write_a_review(mock_review['rating'], mock_review['body'])

        # Step 4 - Check review
        Assert.true(details_page.notification_visible, "Review not added: %s" % details_page.success_message)
        Assert.equal(details_page.notification_message, "Your review was posted")
        Assert.equal(details_page.first_review_rating, mock_review['rating'])
        Assert.equal(details_page.first_review_body, mock_review['body'])
    def test_that_user_can_purchase_an_app(self, mozwebqa):

        if '-dev' not in mozwebqa.base_url:
            pytest.skip("Payments can only be tested on dev.")

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        acct = self.create_new_user(mozwebqa)
        home_page.header.click_sign_in()
        home_page.login(acct)
        Assert.true(home_page.is_the_current_page)
        home_page.set_region('us')

        details_page = home_page.header.search_and_click_on_app(self._app_name)
        Assert.not_equal('Free', details_page.price_text)
        Assert.true('paid' in details_page.app_status)

        payment = details_page.click_install_button()
        payment.create_pin(self.PIN)
        payment.wait_for_buy_app_section_displayed()
        Assert.equal(self._app_name, payment.app_name)

        payment.click_buy_button()
        # We are not able to interact with the doorhanger that appears to install the app
        # using Selenium
        # We can check for the `purchased` attribute on the price button though
        details_page.wait_for_app_purchased()
    def test_that_checks_the_addition_of_a_review(self, mozwebqa):

        user = PersonaTestUser().create_user()

        # Step 1 - Login into Marketplace
        mock_review = MockReview()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.login(user)
        Assert.true(home_page.is_the_current_page)

        # Step 2 - Search for the test app and go to its details page
        search_page = home_page.header.search(self.test_app)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_write_review_button_visible)
        Assert.equal(details_page.write_review_button, "Write a Review")

        # Step 3 - Write a review
        add_review_box = details_page.click_write_review()
        details_page = add_review_box.write_a_review(mock_review['rating'],
                                                     mock_review['body'])

        # Step 4 - Check review
        Assert.true(details_page.is_success_message_visible,
                    "Review not added: %s" % details_page.success_message)
        Assert.equal(details_page.success_message, "Your review was posted")
        Assert.equal(details_page.first_review_rating, mock_review['rating'])
        Assert.equal(details_page.first_review_body, mock_review['body'])
    def test_that_checks_the_addition_of_a_review(self, mozwebqa):

        user = PersonaTestUser().create_user()

        # Step 1 - Login into Marketplace
        mock_review = MockReview()
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.login(user)
        Assert.true(home_page.is_the_current_page)

        # Step 2 - Search for the test app and go to its details page
        search_page = home_page.header.search(self.test_app)
        details_page = search_page.results[0].click_name()
        Assert.true(details_page.is_the_current_page)

        Assert.true(details_page.is_write_review_link_visible)
        Assert.equal(details_page.write_review_link, "Write a Review")

        # Step 3 - Write a review
        add_review_box = details_page.click_write_review()
        reviews_page = add_review_box.write_a_review(mock_review['rating'], mock_review['body'])

        # Step 4 - Check review
        Assert.true(reviews_page.is_success_message_visible, "Review not added: %s" % reviews_page.success_message)
        Assert.equal(reviews_page.success_message, "Your review was successfully added!")
        review = reviews_page.reviews[0]
        Assert.equal(review.rating, mock_review['rating'])
        Assert.equal(review.text, mock_review['body'])
    def test_that_clicking_on_featured_app_loads_details_page(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        details_page = home_page.click_on_first_app()
        Assert.true(details_page.is_the_current_page)
    def test_editing_user_profile(self, mozwebqa):
        """Test for https://www.pivotaltracker.com/story/show/33709085"""

        user = PersonaTestUser().create_user()

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.login(user)

        profile_page = home_page.header.click_edit_account_settings()
        _username = user['email'].split('@')[0]

        # Initial check
        Assert.equal(profile_page.browser_id_email, user['email'])
        Assert.equal(profile_page.display_name, _username)
        Assert.equal(profile_page.user_region, 'Worldwide')

        # Data to submit. Username should be unique
        name = 'Napoleon'

        profile_page.edit_display_name(name)
        profile_page.save_changes()
        Assert.true(profile_page.notification_visible)

        # Refresh page and then inspect saved settings
        profile_page.refresh_page()

        Assert.equal(profile_page.display_name, name)
        Assert.equal(profile_page.user_region, 'Worldwide')
    def test_that_user_can_purchase_an_app(self, mozwebqa, new_user):
        if '-dev' not in mozwebqa.base_url:
            pytest.skip("Payments can only be tested on dev.")
        else:
            pytest.xfail("Bug 1212152 - App purchases are failing on dev")

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(new_user['email'], new_user['password'])
        assert home_page.is_the_current_page
        home_page.set_region('us')

        # Use the first paid app
        app = home_page.header.search(':paid').results[0]
        app_name = app.name
        details_page = app.click_name()
        assert 'free' not in details_page.price_text
        assert 'paid' in details_page.app_status

        payment = details_page.click_install_button()
        payment.create_pin(self.PIN)
        payment.wait_for_buy_app_section_displayed()
        assert app_name == payment.app_name

        payment.click_buy_button()
        # We are not able to interact with the doorhanger that appears to install the app
        # using Selenium
        # We can check for the `purchased` attribute on the price button though
        details_page.wait_for_app_purchased()
    def test_that_user_can_purchase_an_app(self, mozwebqa, new_user):
        if '-dev' not in mozwebqa.base_url:
            pytest.skip("Payments can only be tested on dev.")

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(new_user['email'], new_user['password'])
        Assert.true(home_page.is_the_current_page)
        home_page.set_region('us')

        # Use the first paid app
        app = home_page.header.search(':paid').results[0]
        app_name = app.name
        details_page = app.click_name()
        Assert.false('free' in details_page.price_text)
        Assert.true('paid' in details_page.app_status)

        payment = details_page.click_install_button()
        payment.create_pin(self.PIN)
        payment.wait_for_buy_app_section_displayed()
        Assert.equal(app_name, payment.app_name)

        payment.click_buy_button()
        # We are not able to interact with the doorhanger that appears to install the app
        # using Selenium
        # We can check for the `purchased` attribute on the price button though
        details_page.wait_for_app_purchased()
    def test_that_verifies_categories_section(self, mozwebqa):
        """https://www.pivotaltracker.com/story/show/31913855"""

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.equal(home_page.categories.title, 'All categories')
        Assert.equal(len(home_page.categories.items), 15)
Beispiel #55
0
    def _take_first_free_app_name(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.header.search(':free')
        app_name = home_page.first_app_name
        return app_name
Beispiel #56
0
    def _take_first_new_app_name(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.click_popular_tab()
        app_name = home_page.first_new_app_name
        return app_name
Beispiel #57
0
    def test_that_header_has_expected_items(self, mozwebqa):

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        Assert.true(home_page.header.is_logo_visible)
        Assert.true(home_page.header.is_search_visible)
        Assert.true(home_page.header.is_sign_in_visible)