def _create_review(self, mozwebqa):
        # Create a new Firefox Account and store it in self so it can
        # be accessed later in the test method that calls this method
        self.acct = self.create_new_user(mozwebqa)

        # 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(self.acct)
        Assert.true(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.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
        Assert.equal(details_page.first_review_rating, mock_review['rating'])
        Assert.equal(details_page.first_review_body, mock_review['body'])

        return app_name
    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_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_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 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_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_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_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_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)
Esempio n. 11
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")
Esempio n. 12
0
    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)
Esempio n. 13
0
    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)
Esempio n. 14
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!')
Esempio n. 15
0
    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 _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_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()
    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 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_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 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_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)
Esempio n. 24
0
    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_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)
Esempio n. 26
0
    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_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)
Esempio n. 28
0
    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)
Esempio n. 29
0
    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 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.header.click_sign_in()
        acct = self.create_new_user(mozwebqa)
        home_page.login(acct)
        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('Abuse report submitted. Thanks!')
Esempio n. 32
0
    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_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_create_new_user(self, mozwebqa):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        home_page.login()
        Assert.false(home_page.header.is_sign_in_visible)
        Assert.true(home_page.is_the_current_page)

        home_page.header.hover_over_settings_menu()
        Assert.true(home_page.header.is_user_logged_in)
    def test_create_new_user_using_fxapom(self, mozwebqa, new_user):
        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 not home_page.header.is_sign_in_visible
        assert home_page.is_the_current_page

        home_page.header.open_settings_menu()
        assert home_page.header.is_user_logged_in
    def test_user_can_sign_in_and_sign_out_from_home_page(self, mozwebqa, new_user):
        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
        assert home_page.header.is_user_logged_in

        home_page.header.click_sign_out()
        assert home_page.header.is_sign_in_visible
Esempio n. 37
0
    def test_footer_has_expected_items(self, mozwebqa, existing_user):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(existing_user['email'], existing_user['password'])

        # Inspect footer elements
        for link in home_page.footer.footer_links_list:
            link = link.get('locator')
            assert home_page.footer.is_element_visible(*link)
    def test_user_can_login_and_logout_using_browser_id_in_consumer_pages(self, mozwebqa):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.login(user="******")

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

        home_page.footer.click_logout()
        Assert.false(home_page.footer.is_user_logged_in)
Esempio n. 39
0
    def test_create_new_user(self, mozwebqa):
        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)
        Assert.true(home_page.footer.is_user_logged_in)
    def test_create_new_user_using_fxapom(self, mozwebqa, new_user):
        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 not home_page.header.is_sign_in_visible
        assert home_page.is_the_current_page

        home_page.header.open_settings_menu()
        assert home_page.header.is_user_logged_in
    def test_create_new_user(self, mozwebqa):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

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

        home_page.header.hover_over_settings_menu()
        Assert.true(home_page.header.is_user_logged_in)
    def test_create_new_user(self, mozwebqa):
        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)
        Assert.true(home_page.footer.is_user_logged_in)
    def test_footer_has_expected_items(self, mozwebqa, existing_user):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(existing_user['email'], existing_user['password'])

        # Inspect footer elements
        for link in home_page.footer.footer_links_list:
            link = link.get('locator')
            assert home_page.footer.is_element_visible(*link)
Esempio n. 44
0
    def test_user_can_login_and_logout_using_browser_id_in_consumer_pages(
            self, mozwebqa):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.login(user="******")

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

        home_page.footer.click_logout()
        Assert.false(home_page.footer.is_user_logged_in)
    def test_user_can_sign_in_and_sign_out_from_home_page(
            self, mozwebqa, new_user):
        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
        assert home_page.header.is_user_logged_in

        home_page.header.click_sign_out()
        assert home_page.header.is_sign_in_visible
    def test_footer_section_links(self, mozwebqa, existing_user):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(existing_user['email'], existing_user['password'])

        bad_links = []
        for link in Home.FooterRegion.footer_links_list:
            url = home_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 [] == bad_links, '%s bad links found: %s' % (len(bad_links), ', '.join(bad_links))
Esempio n. 47
0
    def test_settings_dropdown_menu(self, mozwebqa, new_user):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(new_user['email'], new_user['password'])

        # Verify account settings menu
        user_settings = home_page.header.click_edit_account_settings()
        assert user_settings.is_the_current_page
        assert user_settings.is_email_visible
        assert user_settings.is_display_name_visible
        assert user_settings.is_region_field_visible
        assert user_settings.is_save_button_visible
    def test_user_can_sign_in_and_sign_out_from_home_page(
            self, mozwebqa, new_user):
        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)

        # Verify that user is logged in
        Assert.true(home_page.header.is_user_logged_in)

        home_page.header.click_sign_out()
        Assert.true(home_page.header.is_sign_in_visible)
    def test_user_can_sign_in_and_sign_out_in_consumer_pages(self, mozwebqa):

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

        Assert.true(home_page.is_the_current_page)

        # Verify that user is loggedin
        Assert.true(home_page.header.is_user_logged_in)

        home_page.header.click_sign_out()
        Assert.true(home_page.header.is_sign_in_visible)
Esempio n. 50
0
    def _login_to_consumer_pages(self, mozwebqa, user=None):
        """login to consumer pages using the provided user
            if the user is not provided a new one will be created"""

        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        if user is None:
            user = MockUser()
            home_page.create_new_user(user)

        home_page.login(user)

        return home_page, user
Esempio n. 51
0
    def test_footer_section_links(self, mozwebqa, existing_user):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(existing_user['email'], existing_user['password'])

        bad_links = []
        for link in Home.FooterRegion.footer_links_list:
            url = home_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 [] == bad_links, '%s bad links found: %s' % (
            len(bad_links), ', '.join(bad_links))
    def test_user_can_sign_in_and_sign_out_from_home_page(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)
        Assert.true(home_page.is_the_current_page)

        # Verify that user is logged in
        Assert.true(home_page.header.is_user_logged_in)

        home_page.header.click_sign_out()
        Assert.true(home_page.header.is_sign_in_visible)
    def test_editing_user_profile(self, mozwebqa, new_user):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(new_user['email'], new_user['password'])
        profile_page = home_page.header.click_edit_account_settings()
        assert profile_page.email.split('@')[0] == profile_page.display_name

        name = 'Napoleon'
        profile_page.edit_display_name(name)
        profile_page.save_changes()
        profile_page.wait_for_notification(
            'Your settings have been successfully saved')
        profile_page.refresh_page()
        assert name == profile_page.display_name
Esempio n. 54
0
    def _login_to_consumer_pages(self, mozwebqa, user=None):
        """login to consumer pages using the provided user
            if the user is not provided a new one will be created"""

        from pages.desktop.consumer_pages.home import Home
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()

        if user == None:
            from mocks.mock_user import MockUser
            user = MockUser()
            home_page.create_new_user(user)

        home_page.login(user)

        return home_page, user
Esempio n. 55
0
    def _payment_settings_page_as_user(self, mozwebqa, user):
        # Now we start to test the marketplace pages
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.login(user=user)

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

        # go to Payment Settings page
        settings_page = home_page.footer.click_account_settings()
        Assert.true(settings_page.is_the_current_page)

        payment_settings_page = settings_page.click_payment_menu()
        Assert.equal('Payment Settings', payment_settings_page.header_title)
        return payment_settings_page
Esempio n. 56
0
    def test_editing_user_profile(self, mozwebqa):
        """Test for https://www.pivotaltracker.com/story/show/33709085"""

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

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

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

        #Data to submit. Username and Bio should be unique
        name = 'Napoleon'
        username = _username[::-1]
        location = 'Saint Helena'
        occupation = 'Emperor of the French'
        homepage = 'https://mozilla.org/'
        bio = 'Unique bio for %s' % _username

        profile_page.edit_display_name(name)
        profile_page.edit_username(username)
        profile_page.edit_location(location)
        profile_page.edit_occupation(occupation)
        profile_page.edit_homepage(homepage)
        profile_page.edit_bio(bio)
        profile_page.check_email_me_checkbox()
        profile_page.save_changes()

        Assert.equal(profile_page.notification_text, 'Profile Updated')
        Assert.equal(profile_page.display_name, name)
        Assert.equal(profile_page.username, username)
        Assert.equal(profile_page.location, location)
        Assert.equal(profile_page.occupation, occupation)
        Assert.equal(profile_page.homepage, homepage)
        Assert.equal(profile_page.bio, bio)
        Assert.false(profile_page.is_email_me_checked)
Esempio n. 57
0
    def test_settings_dropdown_menu(self, mozwebqa, new_user):
        home_page = Home(mozwebqa)
        home_page.go_to_homepage()
        home_page.header.click_sign_in()
        home_page.login(new_user['email'], new_user['password'])

        # Verify account settings menu
        user_settings = home_page.header.click_edit_account_settings()
        Assert.true(user_settings.is_the_current_page)
        Assert.true(user_settings.is_email_visible)
        Assert.true(user_settings.is_display_name_visible)
        Assert.true(user_settings.is_region_field_visible)
        Assert.true(user_settings.is_save_button_visible)
        Assert.true(user_settings.is_sign_out_button_visible)

        # Verify My Apps menu
        home_page.go_to_homepage()
        my_apps_page = home_page.header.click_my_apps()
        Assert.true(my_apps_page.is_the_current_page)
        my_apps_page.click_expand_button()
        for i in range(len(my_apps_page.apps)):
            Assert.true(my_apps_page.apps[i].are_screenshots_visible)