diff --git a/lms/djangoapps/courseware/features/registration.feature b/lms/djangoapps/courseware/features/registration.feature index 43b04a5ad0..6c850a0b43 100644 --- a/lms/djangoapps/courseware/features/registration.feature +++ b/lms/djangoapps/courseware/features/registration.feature @@ -13,8 +13,8 @@ Feature: Register for a course Scenario: I can unregister for a course Given I am registered for the course "6.002x" And I visit the dashboard - When I click the link with the text "Unregister" - And I press the "Unregister" button in the Unenroll dialog - Then All dialogs should be closed - And I should be on the dashboard page + Then I should see the course numbered "6.002x" in my dashboard + When I unregister for the course numbered "6.002x" + Then I should be on the dashboard page And I should see "Looks like you haven't registered for any courses yet." somewhere in the page + And I should NOT see the course numbered "6.002x" in my dashboard diff --git a/lms/djangoapps/courseware/features/registration.py b/lms/djangoapps/courseware/features/registration.py index 72bde65f99..dd2fcb0825 100644 --- a/lms/djangoapps/courseware/features/registration.py +++ b/lms/djangoapps/courseware/features/registration.py @@ -25,8 +25,15 @@ def i_should_see_that_course_in_my_dashboard(step, course): assert world.is_css_present(course_link_css) -@step(u'I press the "([^"]*)" button in the Unenroll dialog') -def i_press_the_button_in_the_unenroll_dialog(step, value): - button_css = 'section#unenroll-modal input[value="%s"]' % value +@step(u'I should NOT see the course numbered "([^"]*)" in my dashboard$') +def i_should_not_see_that_course_in_my_dashboard(step, course): + course_link_css = 'section.my-courses a[href*="%s"]' % course + assert not world.is_css_present(course_link_css) + + +@step(u'I unregister for the course numbered "([^"]*)"') +def i_unregister_for_that_course(step, course): + unregister_css = 'section.info a[href*="#unenroll-modal"][data-course-number*="%s"]' % course + world.css_click(unregister_css) + button_css = 'section#unenroll-modal input[value="Unregister"]' world.css_click(button_css) - assert world.is_css_present('section.container.dashboard')