diff --git a/cms/.coveragerc b/cms/.coveragerc index dbc6203c87..4f0dbebe79 100644 --- a/cms/.coveragerc +++ b/cms/.coveragerc @@ -2,7 +2,7 @@ [run] data_file = reports/cms/.coverage source = cms,common/djangoapps -omit = cms/envs/*, cms/manage.py, common/djangoapps/*/migrations/* +omit = cms/envs/*, cms/manage.py, common/djangoapps/terrain/*, common/djangoapps/*/migrations/* [report] ignore_errors = True diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index 3d886082b4..d0d007b231 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -147,10 +147,11 @@ def add_section(name='My Section'): span_css = 'span.section-name-span' assert_true(world.browser.is_element_present_by_css(span_css, 5)) + def add_subsection(name='Subsection One'): css = 'a.new-subsection-item' css_click(css) name_css = 'input.new-subsection-name-input' save_css = 'input.new-subsection-name-save' css_fill(name_css, name) - css_click(save_css) \ No newline at end of file + css_click(save_css) diff --git a/lms/djangoapps/terrain/__init__.py b/common/djangoapps/terrain/__init__.py similarity index 100% rename from lms/djangoapps/terrain/__init__.py rename to common/djangoapps/terrain/__init__.py diff --git a/lms/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py similarity index 100% rename from lms/djangoapps/terrain/browser.py rename to common/djangoapps/terrain/browser.py diff --git a/lms/djangoapps/terrain/factories.py b/common/djangoapps/terrain/factories.py similarity index 100% rename from lms/djangoapps/terrain/factories.py rename to common/djangoapps/terrain/factories.py diff --git a/lms/djangoapps/terrain/steps.py b/common/djangoapps/terrain/steps.py similarity index 100% rename from lms/djangoapps/terrain/steps.py rename to common/djangoapps/terrain/steps.py diff --git a/lms/.coveragerc b/lms/.coveragerc index d0c0a537d8..72b7b037ef 100644 --- a/lms/.coveragerc +++ b/lms/.coveragerc @@ -2,7 +2,7 @@ [run] data_file = reports/lms/.coverage source = lms,common/djangoapps -omit = lms/envs/*, lms/djangoapps/portal/*, lms/djangoapps/terrain/*, common/djangoapps/*/migrations/* +omit = lms/envs/*, common/djangoapps/terrain/*, common/djangoapps/*/migrations/* [report] ignore_errors = True diff --git a/lms/djangoapps/portal/features/common.py b/lms/djangoapps/courseware/features/common.py similarity index 97% rename from lms/djangoapps/portal/features/common.py rename to lms/djangoapps/courseware/features/common.py index 8bfb548367..2e19696ad4 100644 --- a/lms/djangoapps/portal/features/common.py +++ b/lms/djangoapps/courseware/features/common.py @@ -1,5 +1,4 @@ -from lettuce import world, step # , before, after -from factories import * +from lettuce import world, step from django.core.management import call_command from nose.tools import assert_equals, assert_in from lettuce.django import django_url diff --git a/lms/djangoapps/courseware/features/courses.py b/lms/djangoapps/courseware/features/courses.py index 9b1316b00d..ba0bcd359b 100644 --- a/lms/djangoapps/courseware/features/courses.py +++ b/lms/djangoapps/courseware/features/courses.py @@ -9,7 +9,6 @@ logger = getLogger(__name__) ## support functions - def get_courses(): ''' Returns dict of lists of courses available, keyed by course.org (ie university). @@ -20,29 +19,6 @@ def get_courses(): courses = sorted(courses, key=lambda course: course.number) return courses -# def get_courseware(course_id): -# """ -# Given a course_id (string), return a courseware array of dictionaries for the -# top two levels of navigation. Example: - -# [ -# {'chapter_name': 'Overview', -# 'sections': ['Welcome', 'System Usage Sequence', 'Lab0: Using the tools', 'Circuit Sandbox'] -# }, -# {'chapter_name': 'Week 1', -# 'sections': ['Administrivia and Circuit Elements', 'Basic Circuit Analysis', 'Resistor Divider', 'Week 1 Tutorials'] -# }, -# {'chapter_name': 'Midterm Exam', -# 'sections': ['Midterm Exam'] -# } -# ] -# """ - -# course = get_course_by_id(course_id) -# chapters = course.get_children() -# courseware = [ {'chapter_name':c.display_name, 'sections':[s.display_name for s in c.get_children()]} for c in chapters] -# return courseware - def get_courseware_with_tabs(course_id): """ @@ -106,8 +82,8 @@ def get_courseware_with_tabs(course_id): course = get_course_by_id(course_id) chapters = [chapter for chapter in course.get_children() if chapter.metadata.get('hide_from_toc', 'false').lower() != 'true'] courseware = [{'chapter_name': c.display_name, - 'sections': [{'section_name': s.display_name, - 'clickable_tab_count': len(s.get_children()) if (type(s) == seq_module.SequenceDescriptor) else 0, + 'sections': [{'section_name': s.display_name, + 'clickable_tab_count': len(s.get_children()) if (type(s) == seq_module.SequenceDescriptor) else 0, 'tabs': [{'children_count': len(t.get_children()) if (type(t) == vertical_module.VerticalDescriptor) else 0, 'class': t.__class__.__name__} for t in s.get_children()]} diff --git a/lms/djangoapps/courseware/features/courseware.feature b/lms/djangoapps/courseware/features/courseware.feature index 21c7e84541..279e5732c9 100644 --- a/lms/djangoapps/courseware/features/courseware.feature +++ b/lms/djangoapps/courseware/features/courseware.feature @@ -9,10 +9,3 @@ Feature: View the Courseware Tab And I click on View Courseware When I click on the "Courseware" tab Then the "Courseware" tab is active - - # TODO: fix this one? Not sure whether you should get a 404. - # Scenario: I cannot get to the courseware tab when not logged in - # Given I am not logged in - # And I visit the homepage - # When I visit the courseware URL - # Then the login dialog is visible diff --git a/lms/djangoapps/portal/features/homepage.feature b/lms/djangoapps/courseware/features/homepage.feature similarity index 100% rename from lms/djangoapps/portal/features/homepage.feature rename to lms/djangoapps/courseware/features/homepage.feature diff --git a/lms/djangoapps/portal/features/homepage.py b/lms/djangoapps/courseware/features/homepage.py similarity index 100% rename from lms/djangoapps/portal/features/homepage.py rename to lms/djangoapps/courseware/features/homepage.py diff --git a/lms/djangoapps/portal/features/login.feature b/lms/djangoapps/courseware/features/login.feature similarity index 100% rename from lms/djangoapps/portal/features/login.feature rename to lms/djangoapps/courseware/features/login.feature diff --git a/lms/djangoapps/portal/features/login.py b/lms/djangoapps/courseware/features/login.py similarity index 99% rename from lms/djangoapps/portal/features/login.py rename to lms/djangoapps/courseware/features/login.py index 094db078ca..ca7d710c61 100644 --- a/lms/djangoapps/portal/features/login.py +++ b/lms/djangoapps/courseware/features/login.py @@ -34,7 +34,6 @@ def click_the_dropdown(step): #### helper functions - def user_is_an_unactivated_user(uname): u = User.objects.get(username=uname) u.is_active = False diff --git a/lms/djangoapps/courseware/features/openended.feature b/lms/djangoapps/courseware/features/openended.feature index 3c7043ba54..cc9f6e1c5f 100644 --- a/lms/djangoapps/courseware/features/openended.feature +++ b/lms/djangoapps/courseware/features/openended.feature @@ -3,31 +3,35 @@ Feature: Open ended grading In order to complete the courseware questions I want the machine learning grading to be functional - Scenario: An answer that is too short is rejected - Given I navigate to an openended question - And I enter the answer "z" - When I press the "Check" button - And I wait for "8" seconds - And I see the grader status "Submitted for grading" - And I press the "Recheck for Feedback" button - Then I see the red X - And I see the grader score "0" + # Commenting these all out right now until we can + # make a reference implementation for a course with + # an open ended grading problem that is always available + # + # Scenario: An answer that is too short is rejected + # Given I navigate to an openended question + # And I enter the answer "z" + # When I press the "Check" button + # And I wait for "8" seconds + # And I see the grader status "Submitted for grading" + # And I press the "Recheck for Feedback" button + # Then I see the red X + # And I see the grader score "0" - Scenario: An answer with too many spelling errors is rejected - Given I navigate to an openended question - And I enter the answer "az" - When I press the "Check" button - And I wait for "8" seconds - And I see the grader status "Submitted for grading" - And I press the "Recheck for Feedback" button - Then I see the red X - And I see the grader score "0" - When I click the link for full output - Then I see the spelling grading message "More spelling errors than average." + # Scenario: An answer with too many spelling errors is rejected + # Given I navigate to an openended question + # And I enter the answer "az" + # When I press the "Check" button + # And I wait for "8" seconds + # And I see the grader status "Submitted for grading" + # And I press the "Recheck for Feedback" button + # Then I see the red X + # And I see the grader score "0" + # When I click the link for full output + # Then I see the spelling grading message "More spelling errors than average." - Scenario: An answer makes its way to the instructor dashboard - Given I navigate to an openended question as staff - When I submit the answer "I love Chemistry." - And I wait for "8" seconds - And I visit the staff grading page - Then my answer is queued for instructor grading \ No newline at end of file + # Scenario: An answer makes its way to the instructor dashboard + # Given I navigate to an openended question as staff + # When I submit the answer "I love Chemistry." + # And I wait for "8" seconds + # And I visit the staff grading page + # Then my answer is queued for instructor grading diff --git a/lms/djangoapps/portal/features/registration.feature b/lms/djangoapps/courseware/features/registration.feature similarity index 94% rename from lms/djangoapps/portal/features/registration.feature rename to lms/djangoapps/courseware/features/registration.feature index d8a6796ee3..d9b588534b 100644 --- a/lms/djangoapps/portal/features/registration.feature +++ b/lms/djangoapps/courseware/features/registration.feature @@ -14,4 +14,4 @@ Feature: Register for a course 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 I should see "Looks like you haven't registered for any courses yet." somewhere in the page \ No newline at end of file + Then I should see "Looks like you haven't registered for any courses yet." somewhere in the page diff --git a/lms/djangoapps/portal/features/registration.py b/lms/djangoapps/courseware/features/registration.py similarity index 88% rename from lms/djangoapps/portal/features/registration.py rename to lms/djangoapps/courseware/features/registration.py index b2b4c4bd8d..f585136412 100644 --- a/lms/djangoapps/portal/features/registration.py +++ b/lms/djangoapps/courseware/features/registration.py @@ -4,7 +4,7 @@ from lettuce import world, step @step('I register for the course numbered "([^"]*)"$') def i_register_for_the_course(step, course): courses_section = world.browser.find_by_css('section.courses') - course_link_css = 'article[id*="%s"] a' % course + course_link_css = 'article[id*="%s"] > div' % course course_link = courses_section.find_by_css(course_link_css).first course_link.click() @@ -25,3 +25,4 @@ def i_should_see_that_course_in_my_dashboard(step, course): def i_press_the_button_in_the_unenroll_dialog(step, value): button_css = 'section#unenroll-modal input[value="%s"]' % value world.browser.find_by_css(button_css).click() + assert world.browser.is_element_present_by_css('section.container.dashboard') diff --git a/lms/djangoapps/portal/features/signup.feature b/lms/djangoapps/courseware/features/signup.feature similarity index 100% rename from lms/djangoapps/portal/features/signup.feature rename to lms/djangoapps/courseware/features/signup.feature diff --git a/lms/djangoapps/portal/features/signup.py b/lms/djangoapps/courseware/features/signup.py similarity index 100% rename from lms/djangoapps/portal/features/signup.py rename to lms/djangoapps/courseware/features/signup.py diff --git a/lms/djangoapps/courseware/features/smart-accordion.feature b/lms/djangoapps/courseware/features/smart-accordion.feature index 90d097144a..ccf1d45601 100644 --- a/lms/djangoapps/courseware/features/smart-accordion.feature +++ b/lms/djangoapps/courseware/features/smart-accordion.feature @@ -23,37 +23,41 @@ Feature: There are courses on the homepage As an acceptance test I want to count all the chapters, sections, and tabs for each course - Scenario: Navigate through course MITx/3.091x/2012_Fall - Given I am registered for course "MITx/3.091x/2012_Fall" - And I log in - Then I verify all the content of each course + # Commenting these all out for now because they don't always run, + # they have too many prerequesites, e.g. the course exists, and + # is within the start and end dates, etc. - Scenario: Navigate through course MITx/6.002x/2012_Fall - Given I am registered for course "MITx/6.002x/2012_Fall" - And I log in - Then I verify all the content of each course + # Scenario: Navigate through course MITx/3.091x/2012_Fall + # Given I am registered for course "MITx/3.091x/2012_Fall" + # And I log in + # Then I verify all the content of each course - Scenario: Navigate through course MITx/6.00x/2012_Fall - Given I am registered for course "MITx/6.00x/2012_Fall" - And I log in - Then I verify all the content of each course + # Scenario: Navigate through course MITx/6.002x/2012_Fall + # Given I am registered for course "MITx/6.002x/2012_Fall" + # And I log in + # Then I verify all the content of each course - Scenario: Navigate through course HarvardX/PH207x/2012_Fall - Given I am registered for course "HarvardX/PH207x/2012_Fall" - And I log in - Then I verify all the content of each course + # Scenario: Navigate through course MITx/6.00x/2012_Fall + # Given I am registered for course "MITx/6.00x/2012_Fall" + # And I log in + # Then I verify all the content of each course - Scenario: Navigate through course BerkeleyX/CS169.1x/2012_Fall - Given I am registered for course "BerkeleyX/CS169.1x/2012_Fall" - And I log in - Then I verify all the content of each course + # Scenario: Navigate through course HarvardX/PH207x/2012_Fall + # Given I am registered for course "HarvardX/PH207x/2012_Fall" + # And I log in + # Then I verify all the content of each course - Scenario: Navigate through course BerkeleyX/CS169.2x/2012_Fall - Given I am registered for course "BerkeleyX/CS169.2x/2012_Fall" - And I log in - Then I verify all the content of each course + # Scenario: Navigate through course BerkeleyX/CS169.1x/2012_Fall + # Given I am registered for course "BerkeleyX/CS169.1x/2012_Fall" + # And I log in + # Then I verify all the content of each course - Scenario: Navigate through course BerkeleyX/CS184.1x/2012_Fall - Given I am registered for course "BerkeleyX/CS184.1x/2012_Fall" - And I log in - Then I verify all the content of each course \ No newline at end of file + # Scenario: Navigate through course BerkeleyX/CS169.2x/2012_Fall + # Given I am registered for course "BerkeleyX/CS169.2x/2012_Fall" + # And I log in + # Then I verify all the content of each course + + # Scenario: Navigate through course BerkeleyX/CS184.1x/2012_Fall + # Given I am registered for course "BerkeleyX/CS184.1x/2012_Fall" + # And I log in + # Then I verify all the content of each course \ No newline at end of file diff --git a/lms/djangoapps/portal/README.md b/lms/djangoapps/portal/README.md deleted file mode 100644 index 09930ec8fb..0000000000 --- a/lms/djangoapps/portal/README.md +++ /dev/null @@ -1,15 +0,0 @@ -## acceptance_testing - -This fake django app is here to support acceptance testing using lettuce + -splinter (which wraps selenium). - -First you need to make sure that you've installed the requirements. -This includes lettuce, selenium, splinter, etc. -Do this with: -```pip install -r test-requirements.txt``` - -The settings.py environment file used is named acceptance.py. -It uses a test SQLite database defined as ../db/test-mitx.db. -You need to first start up the server separately, then run the lettuce scenarios. - -Full documentation can be found on the wiki at this link. diff --git a/lms/djangoapps/portal/__init__.py b/lms/djangoapps/portal/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lms/djangoapps/portal/features/factories.py b/lms/djangoapps/portal/features/factories.py deleted file mode 100644 index 71781ea3d6..0000000000 --- a/lms/djangoapps/portal/features/factories.py +++ /dev/null @@ -1,37 +0,0 @@ -import factory -from student.models import User, UserProfile, Registration -from datetime import datetime -import uuid - - -class UserProfileFactory(factory.Factory): - FACTORY_FOR = UserProfile - - user = None - name = 'Jack Foo' - level_of_education = None - gender = 'm' - mailing_address = None - goals = 'World domination' - - -class RegistrationFactory(factory.Factory): - FACTORY_FOR = Registration - - user = None - activation_key = uuid.uuid4().hex - - -class UserFactory(factory.Factory): - FACTORY_FOR = User - - username = 'robot' - email = 'robot+test@edx.org' - password = 'test' - first_name = 'Robot' - last_name = 'Test' - is_staff = False - is_active = True - is_superuser = False - last_login = datetime(2012, 1, 1) - date_joined = datetime(2011, 1, 1) diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 412815a402..b6941f4a70 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -38,4 +38,4 @@ MITX_FEATURES['STUB_VIDEO_FOR_TESTING'] = True # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) -LETTUCE_APPS = ('portal',) # dummy app covers the home page, login, registration, and course enrollment +LETTUCE_APPS = ('courseware',)