From 8d15b74a9751a2d42a0e4662effb3b2b3bbc4f13 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Thu, 6 Jun 2013 14:38:59 -0400 Subject: [PATCH] Fixed errors in spacing and refactoring out of scenario --- .../courseware/features/navigation.feature | 3 +-- .../courseware/features/navigation.py | 27 ++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lms/djangoapps/courseware/features/navigation.feature b/lms/djangoapps/courseware/features/navigation.feature index 182a8ad4a9..8fd8b54c1a 100644 --- a/lms/djangoapps/courseware/features/navigation.feature +++ b/lms/djangoapps/courseware/features/navigation.feature @@ -8,7 +8,6 @@ Feature: Navigate Course When I click on section "2" Then I should see the content of section "2" - Scenario: I can navigate to subsections Given I am viewing a section with multiple subsections When I click on subsection "2" @@ -23,4 +22,4 @@ Feature: Navigate Course Given I am viewing a course with multiple sections When I click on section "2" And I return later - Then I should see "You were most recently in Test Section2" somewhere on the page + Then I should see that I was most recently in section "2" diff --git a/lms/djangoapps/courseware/features/navigation.py b/lms/djangoapps/courseware/features/navigation.py index 06271a3002..1f6308c6c5 100644 --- a/lms/djangoapps/courseware/features/navigation.py +++ b/lms/djangoapps/courseware/features/navigation.py @@ -21,19 +21,19 @@ def view_course_multiple_sections(step): create_course() # Add a section to the course to contain problems section1 = world.ItemFactory.create(parent_location=COURSE_LOC, - display_name=TEST_SECTION_NAME+"1") + display_name=section_name(1)) # Add a section to the course to contain problems section2 = world.ItemFactory.create(parent_location=COURSE_LOC, - display_name=TEST_SECTION_NAME+"2") + display_name=section_name(2)) world.ItemFactory.create(parent_location=section1.location, template='i4x://edx/templates/sequential/Empty', - display_name=TEST_SECTION_NAME+"1") + display_name=section_name(1)) world.ItemFactory.create(parent_location=section2.location, template='i4x://edx/templates/sequential/Empty', - display_name=TEST_SECTION_NAME+"2") + display_name=section_name(2)) add_problem_to_course_section('model_course', 'multiple choice', section=1) add_problem_to_course_section('model_course', 'drop down', section=2) @@ -47,14 +47,14 @@ def view_course_multiple_subsections(step): # Add a section to the course to contain problems section1 = world.ItemFactory.create(parent_location=COURSE_LOC, - display_name=TEST_SECTION_NAME+"1") + display_name=section_name(1)) world.ItemFactory.create(parent_location=section1.location, template='i4x://edx/templates/sequential/Empty', - display_name=TEST_SECTION_NAME+"1") + display_name=section_name(1)) section2 = world.ItemFactory.create(parent_location=section1.location, - display_name=TEST_SECTION_NAME+"2") + display_name=section_name(2)) global SUBSECTION_2_LOC SUBSECTION_2_LOC = section2.location @@ -70,12 +70,12 @@ def view_course_multiple_sequences(step): create_course() # Add a section to the course to contain problems section1 = world.ItemFactory.create(parent_location=COURSE_LOC, - display_name=TEST_SECTION_NAME+"1") + display_name=section_name(1)) world.ItemFactory.create(parent_location=section1.location, template='i4x://edx/templates/sequential/Empty', - display_name=TEST_SECTION_NAME+"1") + display_name=section_name(1)) add_problem_to_course_section('model_course', 'multiple choice', section=1) add_problem_to_course_section('model_course', 'drop down', section=1) @@ -125,11 +125,20 @@ def return_to_course(step): world.click_link("View Course") world.click_link("Courseware") + +@step(u'I should see that I was most recently in section "([^"]*)"') +def see_recent_section(step, section): + step.given('I should see "You were most recently in %s" somewhere on the page' % section_name(int(section))) + ##################### # HELPERS ##################### +def section_name(section): + return TEST_SECTION_NAME+str(section) + + def create_course(): world.clear_courses()