Updated acceptance tests to match new behavior in video captions.

This commit is contained in:
Will Daly
2013-08-30 11:48:35 -04:00
parent df03b09136
commit 2ed66ce7a5
5 changed files with 175 additions and 12 deletions

View File

@@ -17,13 +17,13 @@ Feature: Video Component Editor
# Sauce Labs cannot delete cookies
@skip_sauce
Scenario: Captions are hidden when "show captions" is false
Given I have created a Video component
Given I have created a Video component with subtitles
And I have set "show captions" to False
Then when I view the video it does not show the captions
# Sauce Labs cannot delete cookies
@skip_sauce
Scenario: Captions are shown when "show captions" is true
Given I have created a Video component
Given I have created a Video component with subtitles
And I have set "show captions" to True
Then when I view the video it does show the captions

View File

@@ -7,20 +7,21 @@ from terrain.steps import reload_the_page
@step('I have set "show captions" to (.*)$')
def set_show_captions(step, setting):
# Prevent cookies from overriding course settings
world.browser.cookies.delete('hide_captions')
world.css_click('a.edit-button')
world.wait_for(lambda _driver: world.css_visible('a.save-button'))
world.browser.select('Show Captions', setting)
world.css_click('a.save-button')
@step('when I view the (video.*) it (.*) show the captions$')
def shows_captions(_step, video_type, show_captions):
# Prevent cookies from overriding course settings
world.browser.cookies.delete('hide_captions')
@step('when I view the video it (.*) show the captions$')
def shows_captions(_step, show_captions):
if show_captions == 'does not':
assert world.css_has_class('.%s' % video_type, 'closed')
assert world.is_css_present('div.video.closed')
else:
assert world.is_css_not_present('.%s.closed' % video_type)
assert world.is_css_not_present('div.video.closed')
@step('I see the correct video settings and default values$')

View File

@@ -13,20 +13,20 @@ Feature: Video Component
# Sauce Labs cannot delete cookies
@skip_sauce
Scenario: Captions are hidden correctly
Given I have created a Video component
Given I have created a Video component with subtitles
And I have hidden captions
Then when I view the video it does not show the captions
# Sauce Labs cannot delete cookies
@skip_sauce
Scenario: Captions are shown correctly
Given I have created a Video component
Given I have created a Video component with subtitles
Then when I view the video it does show the captions
# Sauce Labs cannot delete cookies
@skip_sauce
Scenario: Captions are toggled correctly
Given I have created a Video component
Given I have created a Video component with subtitles
And I have toggled captions
Then when I view the video it does show the captions

View File

@@ -8,7 +8,6 @@ from contentstore.utils import get_modulestore
############### ACTIONS ####################
@step('I have created a Video component$')
def i_created_a_video_component(step):
world.create_component_instance(
@@ -19,6 +18,26 @@ def i_created_a_video_component(step):
)
@step('I have created a Video component with subtitles$')
def i_created_a_video_component(step):
step.given('I have created a Video component')
# Store the current URL so we can return here
video_url = world.browser.url
# Upload subtitles for the video using the upload interface
step.given('I have uploaded subtitles')
# Return to the video
world.visit(video_url)
@step('I have uploaded subtitles')
def i_have_uploaded_subtitles(step):
step.given('I go to the files and uploads page')
step.given('I upload the file "subs_OEoXaMPEzfM.srt.sjson"')
@step('when I view the (.*) it does not have autoplay enabled$')
def does_not_autoplay(_step, video_type):
assert world.css_find('.%s' % video_type)[0]['data-autoplay'] == 'False'