Test for due dates.
This commit is contained in:
@@ -11,6 +11,9 @@ from xmodule.modulestore.django import _MODULESTORES, modulestore
|
||||
from xmodule.templates import update_templates
|
||||
from auth.authz import get_user_by_email
|
||||
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
import time
|
||||
|
||||
from logging import getLogger
|
||||
logger = getLogger(__name__)
|
||||
|
||||
@@ -207,3 +210,14 @@ def add_subsection(name='Subsection One'):
|
||||
save_css = 'input.new-subsection-name-save'
|
||||
css_fill(name_css, name)
|
||||
css_click(save_css)
|
||||
|
||||
|
||||
def set_date_and_time(date_css, desired_date, time_css, desired_time):
|
||||
css_fill(date_css, desired_date)
|
||||
# hit TAB to get to the time field
|
||||
e = css_find(date_css).first
|
||||
e._element.send_keys(Keys.TAB)
|
||||
css_fill(time_css, desired_time)
|
||||
e = css_find(time_css).first
|
||||
e._element.send_keys(Keys.TAB)
|
||||
time.sleep(float(1))
|
||||
@@ -1,8 +1,6 @@
|
||||
from lettuce import world, step
|
||||
from common import *
|
||||
from nose.tools import assert_equal
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
import time
|
||||
|
||||
############### ACTIONS ####################
|
||||
|
||||
@@ -36,16 +34,8 @@ def i_click_the_edit_link_for_the_release_date(step):
|
||||
|
||||
@step('I save a new section release date$')
|
||||
def i_save_a_new_section_release_date(step):
|
||||
date_css = 'input.start-date.date.hasDatepicker'
|
||||
time_css = 'input.start-time.time.ui-timepicker-input'
|
||||
css_fill(date_css, '12/25/2013')
|
||||
# hit TAB to get to the time field
|
||||
e = css_find(date_css).first
|
||||
e._element.send_keys(Keys.TAB)
|
||||
css_fill(time_css, '12:00am')
|
||||
e = css_find(time_css).first
|
||||
e._element.send_keys(Keys.TAB)
|
||||
time.sleep(float(1))
|
||||
set_date_and_time('input.start-date.date.hasDatepicker', '12/25/2013',
|
||||
'input.start-time.time.ui-timepicker-input', '12:00am')
|
||||
world.browser.click_link_by_text('Save')
|
||||
|
||||
|
||||
|
||||
@@ -3,25 +3,33 @@ Feature: Create Subsection
|
||||
As a course author
|
||||
I want to create and edit subsections
|
||||
|
||||
Scenario: Add a new subsection to a section
|
||||
Given I have opened a new course section in Studio
|
||||
When I click the New Subsection link
|
||||
And I enter the subsection name and click save
|
||||
Then I see my subsection on the Courseware page
|
||||
# Scenario: Add a new subsection to a section
|
||||
# Given I have opened a new course section in Studio
|
||||
# When I click the New Subsection link
|
||||
# And I enter the subsection name and click save
|
||||
# Then I see my subsection on the Courseware page
|
||||
#
|
||||
# Scenario: Add a new subsection (with a name containing a quote) to a section (bug #216)
|
||||
# Given I have opened a new course section in Studio
|
||||
# When I click the New Subsection link
|
||||
# And I enter a subsection name with a quote and click save
|
||||
# Then I see my subsection name with a quote on the Courseware page
|
||||
# And I click to edit the subsection name
|
||||
# Then I see the complete subsection name with a quote in the editor
|
||||
|
||||
Scenario: Add a new subsection (with a name containing a quote) to a section (bug #216)
|
||||
Given I have opened a new course section in Studio
|
||||
When I click the New Subsection link
|
||||
And I enter a subsection name with a quote and click save
|
||||
Then I see my subsection name with a quote on the Courseware page
|
||||
And I click to edit the subsection name
|
||||
Then I see the complete subsection name with a quote in the editor
|
||||
# @skip-phantom
|
||||
# Scenario: Delete a subsection
|
||||
# Given I have opened a new course section in Studio
|
||||
# And I have added a new subsection
|
||||
# And I see my subsection on the Courseware page
|
||||
# When I press the "subsection" delete icon
|
||||
# And I confirm the alert
|
||||
# Then the subsection does not exist
|
||||
|
||||
Scenario: Set a due date in a different year (bug #256)
|
||||
Given I have opened a new subsection in Studio
|
||||
And I have set a release date and due date in different years
|
||||
Then I see the correct dates
|
||||
And I reload the page
|
||||
Then I see the correct dates
|
||||
|
||||
@skip-phantom
|
||||
Scenario: Delete a subsection
|
||||
Given I have opened a new course section in Studio
|
||||
And I have added a new subsection
|
||||
And I see my subsection on the Courseware page
|
||||
When I press the "subsection" delete icon
|
||||
And I confirm the alert
|
||||
Then the subsection does not exist
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from lettuce import world, step
|
||||
from common import *
|
||||
from nose.tools import assert_equal
|
||||
from nose.tools import assert_equal, assert_true
|
||||
|
||||
############### ACTIONS ####################
|
||||
|
||||
@@ -13,6 +13,18 @@ def i_have_opened_a_new_course_section(step):
|
||||
add_section()
|
||||
|
||||
|
||||
@step('I have added a new subsection$')
|
||||
def i_have_added_a_new_subsection(step):
|
||||
add_subsection()
|
||||
|
||||
|
||||
@step('I have opened a new subsection in Studio$')
|
||||
def i_have_opened_a_new_subsection(step):
|
||||
step.given('I have opened a new course section in Studio')
|
||||
step.given('I have added a new subsection')
|
||||
css_click('span.subsection-name-value')
|
||||
|
||||
|
||||
@step('I click the New Subsection link')
|
||||
def i_click_the_new_subsection_link(step):
|
||||
css = 'a.new-subsection-item'
|
||||
@@ -41,9 +53,19 @@ def i_see_complete_subsection_name_with_quote_in_editor(step):
|
||||
assert_equal(world.browser.find_by_css(css).value, 'Subsection With "Quote"')
|
||||
|
||||
|
||||
@step('I have added a new subsection$')
|
||||
def i_have_added_a_new_subsection(step):
|
||||
add_subsection()
|
||||
@step('I have set a release date and due date in different years$')
|
||||
def test_have_set_dates_in_different_years(step):
|
||||
set_date_and_time('input#start_date', '12/25/2013', 'input#start_time', '3:00am')
|
||||
css_click('.set-date')
|
||||
set_date_and_time('input#due_date', '1/2/2014', 'input#due_time', '4:00am')
|
||||
|
||||
|
||||
@step('I see the correct dates$')
|
||||
def i_see_the_correct_dates(step):
|
||||
assert_equal('12/25/2013', css_find('input#start_date').first.value)
|
||||
assert_equal('3:00am', css_find('input#start_time').first.value)
|
||||
assert_equal('1/2/2014', css_find('input#due_date').first.value)
|
||||
assert_equal('4:00am', css_find('input#due_time').first.value)
|
||||
|
||||
|
||||
############ ASSERTIONS ###################
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="gradable-status" data-initial-status="${subsection.lms.format if section.lms.format is not None else 'Not Graded'}">
|
||||
<div class="gradable-status" data-initial-status="${subsection.lms.format if subsection.lms.format is not None else 'Not Graded'}">
|
||||
</div>
|
||||
|
||||
<div class="item-actions">
|
||||
|
||||
Reference in New Issue
Block a user