Commit dc89a4b3 by cahrens

Beginning of Selenium test, updates to work with master.

parent 49ee903e
Feature: Course checklists
Scenario: A course author sees checklists defined by edX
Given I have opened a new course in Studio
When I select Checklists from the Tools menu
Then I see the four default edX checklists
Scenario: A course author can mark tasks as complete
Given I have opened a new course in Studio
When I select Checklists from the Tools menu
Then I can select tasks in a checklist
And They are still selected after I reload the page
\ No newline at end of file
from lettuce import world, step
from common import *
from terrain.steps import reload_the_page
############### ACTIONS ####################
@step('I select Checklists from the Tools menu$')
def i_select_checklists(step):
expand_icon_css = 'li.nav-course-tools i.icon-expand'
if world.browser.is_element_present_by_css(expand_icon_css):
css_click(expand_icon_css)
link_css = 'li.nav-course-tools-checklists a'
css_click(link_css)
@step('I see the four default edX checklists$')
def i_see_default_checklists(step):
checklists = css_find('.checklist-title')
assert_equal(4, len(checklists))
assert_true(checklists[0].text.endswith('Getting Started With Studio'))
assert_true(checklists[1].text.endswith('Draft a Rough Course Outline'))
assert_true(checklists[2].text.endswith("Explore edX\'s Support Tools"))
assert_true(checklists[3].text.endswith('Draft your Course Introduction'))
@step('I can select tasks in a checklist$')
def i_can_select_tasks(step):
# Use the 2nd checklist as a reference
assert_equal('0', css_find('#course-checklist1 .status-count').first.text)
assert_equal('7', css_find('#course-checklist1 .status-amount').first.text)
# TODO: check progress bar, select several items and check how things change
@step('They are still selected after I reload the page$')
def tasks_still_selected_after_reload(step):
reload_the_page(step)
......@@ -1299,12 +1299,11 @@ def get_checklists(request, org, course, name):
template_module = modulestore.get_item(new_course_template)
# If course was created before checklists were introduced, copy them over from the template.
key = "checklists"
if not key in course_module.metadata:
course_module.metadata[key] = template_module.metadata[key]
modulestore.update_metadata(location, course_module.metadata)
if not course_module.checklists:
course_module.checklists = template_module.checklists
modulestore.update_metadata(location, own_metadata(course_module))
checklists = course_module.metadata[key]
checklists = course_module.checklists
return render_to_response('checklists.html',
{
'context_course': course_module,
......@@ -1318,17 +1317,16 @@ def update_checklist(request, org, course, name, checklist_index=None):
location = get_location_and_verify_access(request, org, course, name)
modulestore = get_modulestore(location)
course_module = modulestore.get_item(location)
key = "checklists"
real_method = get_request_method(request)
if checklist_index is not None and (real_method == 'POST' or real_method == 'PUT'):
modified_checklist = json.loads(request.body)
(course_module.metadata[key])[int(checklist_index)] = modified_checklist
modulestore.update_metadata(location, course_module.metadata)
course_module.checklists[int(checklist_index)] = modified_checklist
modulestore.update_metadata(location, own_metadata(course_module))
return HttpResponse(json.dumps(modified_checklist), mimetype="application/json")
elif request.method == 'GET':
# TODO: Would we ever get in this condition? Any point in having this code?
return HttpResponse(json.dumps(course_module.metadata[key]), mimetype="application/json")
return HttpResponse(json.dumps(course_module.checklists), mimetype="application/json")
@login_required
......
......@@ -10,7 +10,7 @@ class CourseMetadata(object):
For CRUD operations on metadata fields which do not have specific editors on the other pages including any user generated ones.
The objects have no predefined attrs but instead are obj encodings of the editable metadata.
'''
FILTERED_LIST = XModuleDescriptor.system_metadata_fields + ['start', 'end', 'enrollment_start', 'enrollment_end', 'tabs', 'graceperiod']
FILTERED_LIST = XModuleDescriptor.system_metadata_fields + ['start', 'end', 'enrollment_start', 'enrollment_end', 'tabs', 'graceperiod', 'checklists']
@classmethod
def fetch(cls, course_location):
......
<section class="course-checklist" id="<%= 'course-checklist' + checklistIndex %>">
<% var allChecked = itemsChecked == items.length; %>
<section
<% if (allChecked) { %>
class="course-checklist is-completed"
<% } else { %>
class="course-checklist"
<% } %>
id="<%= 'course-checklist' + checklistIndex %>">
<% var widthPercentage = 'width:' + percentChecked + '%;'; %>
<span class="viz viz-checklist-status"><span class="viz value viz-checklist-status-value" style="<%= widthPercentage %>">
<span class="int"><%= percentChecked %></span>% of checklist completed</span></span>
......
......@@ -179,7 +179,7 @@ class CourseFields(object):
allow_anonymous_to_peers = Boolean(scope=Scope.settings, default=False)
advanced_modules = List(help="Beta modules used in your course", scope=Scope.settings)
has_children = True
checklists=List(scope=Scope.settings)
info_sidebar_name = String(scope=Scope.settings, default='Course Handouts')
# An extra property is used rather than the wiki_slug/number because
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment