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()
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)
def enroll_user_track(browser, course_id, track): """ Utility method to enroll a user in the audit or verified user track. Creates and connects to the necessary pages. Selects the track and handles payment for verified. Supported tracks are 'verified' or 'audit'. """ payment_and_verification_flow = PaymentAndVerificationFlow(browser, course_id) fake_payment_page = FakePaymentPage(browser, course_id) track_selection = TrackSelectionPage(browser, course_id) # Select track and process payment track_selection.visit() track_selection.enroll(track) if track == 'verified': payment_and_verification_flow.proceed_to_payment() fake_payment_page.submit_payment()