BLD-410: Add tests.

This commit is contained in:
polesye
2013-11-13 15:48:22 +02:00
parent 957f318485
commit 38163cf942
4 changed files with 72 additions and 35 deletions

View File

@@ -79,19 +79,13 @@ Feature: CMS.Video Component
And I see caption line with data-index "0" has class "focused"
# 11
# Disabled until we come up with a more solid test, as this one is brittle.
# Scenario: When start end end times are specified, a range on slider is shown
# Given I have created a Video component
# And Make sure captions are closed
# And I edit the component
# And I open tab "Advanced"
# And I set value "12" to the field "Start Time"
# And I set value "24" to the field "End Time"
# And I save changes
# And I click video button "Play"
# The below line is a bit flaky. Numbers 73 and 73 were determined rather
# accidentally. They might change in the future as Video player gets CSS
# updates. If this test starts failing, 99.9% cause of failure is the line
# below.
# Then I see a range on slider with styles "left" set to 73 px and "width" set to 73 px
Scenario: When start end end times are specified, a range on slider is shown
Given I have created a Video component
And Make sure captions are closed
And I edit the component
And I open tab "Advanced"
And I set value "00:00:12" to the field "Start Time"
And I set value "00:00:24" to the field "End Time"
And I save changes
And I click video button "play"
Then I see a range on slider

View File

@@ -8,7 +8,8 @@ from selenium.webdriver.common.keys import Keys
VIDEO_BUTTONS = {
'CC': '.hide-subtitles',
'volume': '.volume',
'Play': '.video_control.play',
'play': '.video_control.play',
'pause': '.video_control.pause',
}
SELECTORS = {
@@ -183,17 +184,11 @@ def caption_line_has_class(_step, index, className):
world.css_has_class(SELECTOR, className.strip())
@step('I see a range on slider with styles "left" set to (.+) px and "width" set to (.+) px$')
def see_a_range_slider_with_proper_range(_step, left, width):
left = int(left.strip())
width = int(width.strip())
@step('I see a range on slider$')
def see_a_range_slider_with_proper_range(_step):
world.wait_for_visible(VIDEO_BUTTONS['pause'])
world.wait_for_visible(".slider-range")
world.wait(4)
slider_range = world.browser.driver.find_element_by_css_selector(".slider-range")
assert int(round(float(slider_range.value_of_css_property("left")[:-2]))) == left
assert int(round(float(slider_range.value_of_css_property("width")[:-2]))) == width
assert world.css_visible(".slider-range")
@step('I click video button "([^"]*)"$')