Commit 55aaa1a8 by Peter Fogg

Add lettuce tests for single-click video creation and fix previously failing tests.

parent cce65ce9
...@@ -161,3 +161,11 @@ def i_created_a_video_component(step): ...@@ -161,3 +161,11 @@ def i_created_a_video_component(step):
'i4x://edx/templates/video/default', 'i4x://edx/templates/video/default',
'.xmodule_VideoModule' '.xmodule_VideoModule'
) )
@step('I have clicked the new unit button')
def open_new_unit(step):
step.given('I have opened a new course section in Studio')
step.given('I have added a new subsection')
step.given('I expand the first section')
world.css_click('a.new-unit-item')
...@@ -14,19 +14,23 @@ def create_component_instance(step, component_button_css, instance_id, expected_ ...@@ -14,19 +14,23 @@ def create_component_instance(step, component_button_css, instance_id, expected_
@world.absorb @world.absorb
def click_new_component_button(step, component_button_css): def click_new_component_button(step, component_button_css):
step.given('I have opened a new course section in Studio') # step.given('I have opened a new course section in Studio')
step.given('I have added a new subsection') # step.given('I have added a new subsection')
step.given('I expand the first section') # step.given('I expand the first section')
world.css_click('a.new-unit-item') # world.css_click('a.new-unit-item')
step.given('I have clicked the new unit button')
world.css_click(component_button_css) world.css_click(component_button_css)
@world.absorb @world.absorb
def click_component_from_menu(instance_id, expected_css): def click_component_from_menu(instance_id, expected_css):
elem_css = "a[data-location='%s']" % instance_id elem_css = "a[data-location='%s']" % instance_id
assert_equal(1, len(world.css_find(elem_css))) elements = world.css_find(elem_css)
world.css_click(elem_css) if len(elements) == 1: # Multiple templates
assert_equal(1, len(world.css_find(expected_css))) world.css_click(elem_css)
assert_equal(1, len(world.css_find(expected_css)))
else: # Single template
assert(len(filter(lambda ele: ele.has_class('single_template'), elements)) == 1)
@world.absorb @world.absorb
def edit_component_and_select_settings(): def edit_component_and_select_settings():
......
...@@ -4,3 +4,7 @@ Feature: Video Component ...@@ -4,3 +4,7 @@ Feature: Video Component
Scenario: Autoplay is disabled in Studio Scenario: Autoplay is disabled in Studio
Given I have created a Video component Given I have created a Video component
Then when I view the video it does not have autoplay enabled Then when I view the video it does not have autoplay enabled
Scenario: Creating a video takes a single click
Given I have clicked the new unit button
Then creating a video takes a single click
...@@ -9,3 +9,10 @@ from lettuce import world, step ...@@ -9,3 +9,10 @@ from lettuce import world, step
def does_not_autoplay(step): def does_not_autoplay(step):
assert world.css_find('.video')[0]['data-autoplay'] == 'False' assert world.css_find('.video')[0]['data-autoplay'] == 'False'
assert world.css_find('.video_control')[0].has_class('play') assert world.css_find('.video_control')[0].has_class('play')
@step('creating a video takes a single click')
def click_new_component_button(step):
assert(not world.is_css_present('.xmodule_VideoModule'))
world.css_click("a[data-location='i4x://edx/templates/video/default']")
assert(world.is_css_present('.xmodule_VideoModule'))
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