diff --git a/lms/djangoapps/courseware/features/certificates.feature b/lms/djangoapps/courseware/features/certificates.feature index 103936b6e6..57343dc934 100644 --- a/lms/djangoapps/courseware/features/certificates.feature +++ b/lms/djangoapps/courseware/features/certificates.feature @@ -28,9 +28,6 @@ Feature: Verified certificates When I submit valid payment information Then I see that my payment was successful - - # Not yet implemented LMS-982 - @skip Scenario: Verified courses display correctly on dashboard Given I have submitted photos to verify my identity When I submit valid payment information @@ -57,8 +54,6 @@ Feature: Verified certificates When I edit my name Then I see the new name on the confirmation page. - # Currently broken LMS-1009 - @skip Scenario: I can return to the verify flow Given I have submitted photos to verify my identity When I leave the flow and return @@ -72,9 +67,8 @@ Feature: Verified certificates And I press the payment button Then I am at the payment page - # Design not yet finalized - @skip Scenario: I can take a verified certificate course for free - Given I have submitted photos to verify my identity - When I give a reason why I cannot pay - Then I see that I am registered for a verified certificate course on my dashboard + Given I am logged in + And the course has an honor mode + When I give a reason why I cannot pay + Then I should see the course on my dashboard diff --git a/lms/djangoapps/courseware/features/certificates.py b/lms/djangoapps/courseware/features/certificates.py index d52cd41cbf..9f277840f5 100644 --- a/lms/djangoapps/courseware/features/certificates.py +++ b/lms/djangoapps/courseware/features/certificates.py @@ -13,6 +13,7 @@ def create_cert_course(): name = 'Certificates' course_id = '{org}/{number}/{name}'.format( org=org, number=number, name=name) + world.scenario_dict['course_id'] = course_id world.scenario_dict['COURSE'] = world.CourseFactory.create( org=org, number=number, display_name=name) @@ -44,6 +45,18 @@ def register(): assert world.is_css_present('section.wrapper h3.title') +@step(u'the course has an honor mode') +def the_course_has_an_honor_mode(step): + create_cert_course() + honor_mode = world.CourseModeFactory.create( + course_id=world.scenario_dict['course_id'], + mode_slug='honor', + mode_display_name='honor mode', + min_price=0, + ) + assert isinstance(honor_mode, CourseMode) + + @step(u'I select the audit track$') def select_the_audit_track(step): create_cert_course() @@ -171,8 +184,8 @@ def submit_payment(step): world.css_click(button_css) -@step(u'I have submitted photos to verify my identity') -def submitted_photos_to_verify_my_identity(step): +@step(u'I have submitted face and ID photos$') +def submitted_face_and_id_photos(step): step.given('I am logged in') step.given('I select the verified track') step.given('I go to step "1"') @@ -182,6 +195,11 @@ def submitted_photos_to_verify_my_identity(step): step.given('I capture my "photo_id" photo') step.given('I approve my "photo_id" photo') step.given('I go to step "3"') + + +@step(u'I have submitted photos to verify my identity') +def submitted_photos_to_verify_my_identity(step): + step.given('I have submitted face and ID photos') step.given('I select a contribution amount') step.given('I confirm that the details match') step.given('I go to step "4"') @@ -207,12 +225,13 @@ def see_the_course_on_my_dashboard(step): @step(u'I see that I am on the verified track') def see_that_i_am_on_the_verified_track(step): - assert False, 'Implement this step after the design is done' + id_verified_css = 'li.course-item article.course.verified' + assert world.is_css_present(id_verified_css) @step(u'I leave the flow and return$') def leave_the_flow_and_return(step): - world.browser.back() + world.visit('verify_student/verified/edx/999/Certificates') @step(u'I am at the verified page$') @@ -220,24 +239,24 @@ def see_the_payment_page(step): assert world.css_find('button#pay_button') -@step(u'I press the payment button') -def press_payment_button(step): - assert False, 'This step must be implemented' -@step(u'I have submitted face and ID photos') -def submitted_face_and_id_photos(step): - assert False, 'This step must be implemented' -@step(u'I edit my name') +@step(u'I edit my name$') def edit_my_name(step): - assert False, 'This step must be implemented' -@step(u'I see the new name on the confirmation page.') -def sesee_the_new_name_on_the_confirmation_page(step): - assert False, 'This step must be implemented' -@step(u'I have submitted photos') -def submitted_photos(step): - assert False, 'This step must be implemented' -@step(u'I am registered for the course') -def seam_registered_for_the_course(step): - assert False, 'This step must be implemented' -@step(u'I return to the student dashboard') -def return_to_the_student_dashboard(step): - assert False, 'This step must be implemented' + btn_css = 'a.retake-photos' + world.css_click(btn_css) + + +@step(u'I give a reason why I cannot pay$') +def give_a_reason_why_i_cannot_pay(step): + register() + + link_css = 'h5 i.expandable-icon' + world.css_click(link_css) + + cb_css = 'input#honor-code' + world.css_click(cb_css) + + text_css = 'li.field-explain textarea' + world.css_find(text_css).type('I cannot afford it.') + + btn_css = 'input[value="Select Certificate"]' + world.css_click(btn_css)