def _start_checkout(self):
        """ Begin the checkout process for a verified certificate. """
        self.login_with_lms(self.email, self.password)

        if MARKETING_URL_ROOT:
            course_about_page = MarketingCourseAboutPage(
                self.browser, self.course_id)
            course_about_page.visit()

            # Click the first enroll button on the page to take the browser to the track selection page.
            course_about_page.q(css='.js-enroll-btn').first.click()

            # Wait for the track selection page to load.
            wait = WebDriverWait(self.browser, 10)
            track_selection_present = EC.presence_of_element_located(
                (By.CLASS_NAME, 'form-register-choose'))
            wait.until(track_selection_present)
        else:
            course_modes_page = LMSCourseModePage(self.browser, self.course_id)
            course_modes_page.visit()

        # Click the purchase button on the track selection page to take
        # the browser to the payment selection page.
        self.browser.find_element_by_css_selector(
            'input[name=verified_mode]').click()
Beispiel #2
0
    def _start_checkout(self):
        """ Begin the checkout process for a verified certificate. """
        self.login_with_lms(self.email, self.password)

        # If a slug is provided, use the marketing site.
        if ENABLE_MARKETING_SITE:
            course_about_page = MarketingCourseAboutPage(
                self.browser, VERIFIED_COURSE_SLUG)
            course_about_page.visit()

            # Click the first enroll button on the page to take the browser to the track selection page.
            course_about_page.q(css='.js-enroll-btn').first.click()

            # Wait for the track selection page to load.
            WebDriverWait(self.browser, 10).until(
                EC.presence_of_element_located(
                    (By.CLASS_NAME, 'form-register-choose')))
        else:
            course_modes_page = LMSCourseModePage(self.browser, self.course_id)
            course_modes_page.visit()

        # Click the purchase button on the track selection page to take
        # the browser to the payment selection page.
        self.browser.find_element_by_css_selector(
            'input[name=verified_mode]').click()
    def test_payment_required(self):
        """Verify payment is required before enrolling in a professional education course."""
        username, password, email = self.get_lms_user()
        self.login_with_lms(email, password)

        if MARKETING_URL_ROOT:
            course_about_page = MarketingCourseAboutPage(
                self.browser, PROFESSIONAL_COURSE_ID)
            course_about_page.visit()

            # Click the first enroll button on the page to take the browser to the track selection page,
            # and allow it to load.
            course_about_page.q(css='.js-enroll-btn').first.click()
            WebDriverWait(self.browser, 10).until(
                EC.presence_of_element_located((By.CLASS_NAME, 'basket')))
        else:
            # Visit the course mode page (where auto-enrollment normally occurs)
            LMSCourseModePage(self.browser, PROFESSIONAL_COURSE_ID).visit()

        # Verify auto-enrollment does NOT occur for the course.
        self.assert_user_not_enrolled(username, PROFESSIONAL_COURSE_ID)