示例#1
0
    def setUp(self):
        """Initialize the test.

        Create the necessary page objects, create a test course and configure its modes,
        create a user and log them in.
        """
        super(PayAndVerifyTest, self).setUp()

        self.payment_and_verification_flow = PaymentAndVerificationFlow(
            self.browser, self.course_id)
        self.immediate_verification_page = PaymentAndVerificationFlow(
            self.browser, self.course_id, entry_point='verify-now')
        self.upgrade_page = PaymentAndVerificationFlow(self.browser,
                                                       self.course_id,
                                                       entry_point='upgrade')
        self.fake_payment_page = FakePaymentPage(self.browser, self.course_id)
        self.dashboard_page = DashboardPage(self.browser)

        # Create a course
        CourseFixture(self.course_info['org'], self.course_info['number'],
                      self.course_info['run'],
                      self.course_info['display_name']).install()

        # Add an honor mode to the course
        ModeCreationPage(self.browser, self.course_id).visit()

        # Add a verified mode to the course
        ModeCreationPage(self.browser,
                         self.course_id,
                         mode_slug=u'verified',
                         mode_display_name=u'Verified Certificate',
                         min_price=10,
                         suggested_prices='10,20').visit()
示例#2
0
文件: test_lms.py 项目: fdns/eol-edx
    def setUp(self):
        """Create a course that is closed for enrollment, and sign in as a user."""
        super(EnrollmentClosedRedirectTest, self).setUp()
        course = CourseFixture(
            self.course_info['org'], self.course_info['number'],
            self.course_info['run'], self.course_info['display_name']
        )
        now = datetime.now(pytz.UTC)
        course.add_course_details({
            'enrollment_start': (now - timedelta(days=30)).isoformat(),
            'enrollment_end': (now - timedelta(days=1)).isoformat()
        })
        course.install()

        # Add an honor mode to the course
        ModeCreationPage(self.browser, self.course_id).visit()

        # Add a verified mode to the course
        ModeCreationPage(
            self.browser,
            self.course_id,
            mode_slug=u'verified',
            mode_display_name=u'Verified Certificate',
            min_price=10,
            suggested_prices='10,20'
        ).visit()
示例#3
0
    def test_course_home(self):
        """
        Smoke test of course goals, course outline, breadcrumbs to and from course outline, and bookmarks.
        """
        ModeCreationPage(
            self.browser, self.course_id, mode_slug=u'verified',
            mode_display_name='verified', min_price=10
        ).visit()
        self.course_home_page.visit()

        # TODO: TNL-6546: Remove course_outline_page.
        self.course_home_page.course_outline_page = True
        self.courseware_page.nav.course_outline_page = True

        # Check that the tab lands on the course home page.
        self.assertTrue(self.course_home_page.is_browser_on_page())

        # Check that a success message and update course field are shown when selecting a course goal
        # TODO: LEARNER-2522: Ensure the correct message shows up for a particular goal choice
        self.assertFalse(self.course_home_page.is_course_goal_success_message_shown())
        self.assertFalse(self.course_home_page.is_course_goal_update_field_shown())
        self.course_home_page.select_course_goal()
        self.course_home_page.wait_for_ajax()
        self.assertTrue(self.course_home_page.is_course_goal_success_message_shown())
        self.assertTrue(self.course_home_page.is_course_goal_update_field_shown())

        # Check that the course navigation appears correctly
        EXPECTED_SECTIONS = {
            u'Test Section': [u'Test Subsection'],
            u'Test Section 2': [u'Test Subsection 2', u'Test Subsection 3']
        }

        actual_sections = self.course_home_page.outline.sections
        for section, _ in six.iteritems(EXPECTED_SECTIONS):
            self.assertIn(section, actual_sections)
            self.assertEqual(actual_sections[section], EXPECTED_SECTIONS[section])

        # Navigate to a particular section
        self.course_home_page.outline.go_to_section(u'Test Section', u'Test Subsection')

        # Check the sequence items on the courseware page
        EXPECTED_ITEMS = ['Test Problem 1', 'Test Problem 2', 'Test HTML']

        actual_items = self.courseware_page.nav.sequence_items
        self.assertEqual(len(actual_items), len(EXPECTED_ITEMS))
        for expected in EXPECTED_ITEMS:
            self.assertIn(expected, actual_items)

        # Use outline breadcrumb to get back to course home page.
        self.courseware_page.nav.go_to_outline()

        # Navigate to a particular section other than the default landing section.
        self.course_home_page.outline.go_to_section('Test Section 2', 'Test Subsection 3')
        self.assertTrue(self.courseware_page.nav.is_on_section('Test Section 2', 'Test Subsection 3'))

        # Verify that we can navigate to the bookmarks page
        self.course_home_page.visit()
        self.course_home_page.click_bookmarks_button()
        bookmarks_page = BookmarksPage(self.browser, self.course_id)
        self.assertTrue(bookmarks_page.is_browser_on_page())
示例#4
0
def add_enrollment_course_modes(browser, course_id, tracks):
    """
    Add the specified array of tracks to the given course.
    Supported tracks are `verified` and `audit` (all others will be ignored),
    and display names assigned are `Verified` and `Audit`, respectively.
    """
    for track in tracks:
        if track == 'audit':
            # Add an audit mode to the course
            ModeCreationPage(browser,
                             course_id,
                             mode_slug='audit',
                             mode_display_name='Audit').visit()

        elif track == 'verified':
            # Add a verified mode to the course
            ModeCreationPage(browser,
                             course_id,
                             mode_slug='verified',
                             mode_display_name='Verified',
                             min_price=10).visit()
    def setUp(self):
        super(ProctoredExamTest, self).setUp()

        self.courseware_page = CoursewarePage(self.browser, self.course_id)

        self.course_outline = CourseOutlinePage(self.browser,
                                                self.course_info['org'],
                                                self.course_info['number'],
                                                self.course_info['run'])

        # Install a course with sections/problems, tabs, updates, and handouts
        course_fix = CourseFixture(self.course_info['org'],
                                   self.course_info['number'],
                                   self.course_info['run'],
                                   self.course_info['display_name'])
        course_fix.add_advanced_settings(
            {"enable_proctored_exams": {
                "value": "true"
            }})

        course_fix.add_children(
            XBlockFixtureDesc('chapter', 'Test Section 1').add_children(
                XBlockFixtureDesc('sequential',
                                  'Test Subsection 1').add_children(
                                      XBlockFixtureDesc(
                                          'problem',
                                          'Test Problem 1')))).install()

        self.track_selection_page = TrackSelectionPage(self.browser,
                                                       self.course_id)
        self.payment_and_verification_flow = PaymentAndVerificationFlow(
            self.browser, self.course_id)
        self.immediate_verification_page = PaymentAndVerificationFlow(
            self.browser, self.course_id, entry_point='verify-now')
        self.upgrade_page = PaymentAndVerificationFlow(self.browser,
                                                       self.course_id,
                                                       entry_point='upgrade')
        self.fake_payment_page = FakePaymentPage(self.browser, self.course_id)
        self.dashboard_page = DashboardPage(self.browser)
        self.problem_page = ProblemPage(self.browser)

        # Add a verified mode to the course
        ModeCreationPage(self.browser,
                         self.course_id,
                         mode_slug=u'verified',
                         mode_display_name=u'Verified Certificate',
                         min_price=10,
                         suggested_prices='10,20').visit()

        # Auto-auth register for the course.
        self._auto_auth(self.USERNAME, self.EMAIL, False)
示例#6
0
    def setUp(self):  # pylint: disable=arguments-differ
        super(CertificatesTest, self).setUp(is_staff=True, test_xss=False)
        self.certificates_page = CertificatesPage(self.browser,
                                                  self.course_info['org'],
                                                  self.course_info['number'],
                                                  self.course_info['run'])
        self.advanced_settings_page = AdvancedSettingsPage(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.course_advanced_settings = dict()

        # Add a verified mode to the course
        ModeCreationPage(self.browser,
                         self.course_id,
                         mode_slug=u'verified',
                         mode_display_name=u'Verified Certificate',
                         min_price=10,
                         suggested_prices='10,20').visit()