Add Lettuce tests for autoplay in Studio.

This commit is contained in:
Peter Fogg
2013-05-30 11:32:40 -04:00
committed by Peter Fogg
parent 5465bda5f3
commit 6eeb12ad1c
9 changed files with 73 additions and 9 deletions

View File

@@ -154,3 +154,12 @@ def set_date_and_time(date_css, desired_date, time_css, desired_time):
e = world.css_find(time_css).first
e._element.send_keys(Keys.TAB)
time.sleep(float(1))
@step('I have created a Video component$')
def i_created_a_video_component(step):
world.create_component_instance(
step, '.large-video-icon',
'i4x://edx/templates/video/default',
'.xmodule_VideoModule'
)

View File

@@ -0,0 +1,32 @@
#pylint: disable=C0111
#pylint: disable=W0621
from lettuce import world
from nose.tools import assert_equal
import time
@world.absorb
def create_component_instance(step, component_button_css, instance_id, expected_css):
click_new_component_button(step, component_button_css)
click_component_from_menu(instance_id, expected_css)
@world.absorb
def click_new_component_button(step, component_button_css):
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')
world.css_click(component_button_css)
@world.absorb
def click_component_from_menu(instance_id, expected_css):
new_instance = world.browser.find_by_id(instance_id)
assert_equal(1, len(new_instance))
# TODO: why is this sleep necessary?
time.sleep(float(1))
new_instance[0].click()
assert_equal(1, len(world.css_find(expected_css)))

View File

@@ -0,0 +1,6 @@
Feature: Video Component
As a course author, I want to be able to view my created videos in Studio.
Scenario: Autoplay is disabled in Studio
Given I have created a Video component
Then when I view it it does not autoplay

View File

@@ -0,0 +1,14 @@
#pylint: disable=C0111
#pylint: disable=W0621
from lettuce import world, step
from common import *
from nose.tools import assert_equal
############### ACTIONS ####################
@step('when I view it it does not autoplay')
def does_not_autoplay(step):
assert world.css_find('.video')[0]['data-autoplay'] == 'False'
assert world.css_find('.video_control')[0].has_class('play')