Tidy up the code.
This commit is contained in:
@@ -46,19 +46,19 @@ Feature: CMS.Video Component
|
||||
Given I have created a Video component with subtitles
|
||||
And Make sure captions are closed
|
||||
Then Captions become invisible after 3 seconds
|
||||
And Hover over CC button
|
||||
Then Captions become visible after 0 seconds
|
||||
And Hover over volume button
|
||||
And I hover over button "CC"
|
||||
Then Captions become visible
|
||||
And I hover over button "volume"
|
||||
Then Captions become invisible after 3 seconds
|
||||
|
||||
# 8
|
||||
Scenario: Open captions never become invisible
|
||||
Given I have created a Video component with subtitles
|
||||
And Make sure captions are open
|
||||
Then Captions are visible after 0 seconds
|
||||
And Hover over CC button
|
||||
Then Captions are visible
|
||||
And I hover over button "CC"
|
||||
Then Captions are visible after 3 seconds
|
||||
And Hover over volume button
|
||||
And I hover over button "volume"
|
||||
Then Captions are visible after 3 seconds
|
||||
|
||||
# 9
|
||||
@@ -66,5 +66,5 @@ Feature: CMS.Video Component
|
||||
Given I have created a Video component with subtitles
|
||||
And Make sure captions are closed
|
||||
Then Captions become invisible after 3 seconds
|
||||
And Hover over volume button
|
||||
Then Captions are invisible after 0 seconds
|
||||
And I hover over button "volume"
|
||||
Then Captions are invisible
|
||||
|
||||
@@ -5,6 +5,11 @@ from terrain.steps import reload_the_page
|
||||
from xmodule.modulestore import Location
|
||||
from contentstore.utils import get_modulestore
|
||||
|
||||
BUTTONS = {
|
||||
'CC': '.hide-subtitles',
|
||||
'volume': '.volume',
|
||||
}
|
||||
|
||||
|
||||
@step('I have created a Video component$')
|
||||
def i_created_a_video_component(step):
|
||||
@@ -17,8 +22,13 @@ def i_created_a_video_component(step):
|
||||
|
||||
|
||||
@step('I have created a Video component with subtitles$')
|
||||
def i_created_a_video_component_subtitles(step):
|
||||
step.given('I have created a Video component')
|
||||
def i_created_a_video_with_subs(_step):
|
||||
_step.given('I have created a Video component with subtitles "OEoXaMPEzfM"')
|
||||
|
||||
|
||||
@step('I have created a Video component with subtitles "([^"]*)"$')
|
||||
def i_created_a_video_with_subs_with_name(_step, sub_id):
|
||||
_step.given('I have created a Video component')
|
||||
|
||||
# Store the current URL so we can return here
|
||||
video_url = world.browser.url
|
||||
@@ -119,15 +129,17 @@ def set_captions_visibility_state(_step, captions_state):
|
||||
world.browser.find_by_css('.hide-subtitles').click()
|
||||
|
||||
|
||||
@step('Hover over (.+) button$')
|
||||
@step('I hover over button "([^"]*)"$')
|
||||
def hover_over_button(_step, button):
|
||||
if button.strip() == 'CC':
|
||||
world.browser.find_by_css('.hide-subtitles').mouse_over()
|
||||
else:
|
||||
world.browser.find_by_css('.volume').mouse_over()
|
||||
world.browser.find_by_css(BUTTONS[button.strip()]).mouse_over()
|
||||
|
||||
|
||||
@step('Captions become (.+) after (.+) seconds$')
|
||||
@step('Captions (?:are|become) (.+)$')
|
||||
def are_captions_visibile(_step, visibility_state):
|
||||
_step.given('Captions are {0} after 0 seconds'.format(visibility_state))
|
||||
|
||||
|
||||
@step('Captions (?:are|become) (.+) after (.+) seconds$')
|
||||
def check_captions_visibility_state(_step, visibility_state, timeout):
|
||||
timeout = int(timeout.strip())
|
||||
|
||||
@@ -140,8 +152,3 @@ def check_captions_visibility_state(_step, visibility_state, timeout):
|
||||
else:
|
||||
assert not world.css_visible('.subtitles')
|
||||
|
||||
|
||||
@step('Captions are (.+) after (.+) seconds$')
|
||||
def check_captions_visibility_state2(_step, visibility_state, timeout):
|
||||
check_captions_visibility_state(_step, visibility_state, timeout)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user