Commit 1941474a by Valera Rozuvan

Fixing test for range element in slider.

parent 644af346
...@@ -82,8 +82,8 @@ Feature: CMS.Video Component ...@@ -82,8 +82,8 @@ Feature: CMS.Video Component
Scenario: When start end end times are specified, a range on slider is shown Scenario: When start end end times are specified, a range on slider is shown
Given I have created a Video component Given I have created a Video component
And I edit the component And I edit the component
And Enter a start time of 10 seconds And I set value "12" to the field "Start Time"
And Enter an end time of 20 seconds And I set value "24" to the field "End Time"
And I close the component editor And I save changes
And I click Play button And I click button "Play"
Then I see a range on slider starting at 20 and running for 40 % Then I see a range on slider with styles "left" set to 10 and "width" set to 10
...@@ -9,9 +9,11 @@ BUTTONS = { ...@@ -9,9 +9,11 @@ BUTTONS = {
'CC': '.hide-subtitles', 'CC': '.hide-subtitles',
'volume': '.volume', 'volume': '.volume',
'Play': '.video_control.play', 'Play': '.video_control.play',
'Save': 'save-button',
} }
# We should wait 300 ms for event handler invocation + 200ms for safety.
DELAY = 0.5
@step('I have created a Video component$') @step('I have created a Video component$')
def i_created_a_video_component(step): def i_created_a_video_component(step):
...@@ -176,25 +178,39 @@ def caption_line_has_class(_step, index, className): ...@@ -176,25 +178,39 @@ def caption_line_has_class(_step, index, className):
world.css_has_class(SELECTOR, className.strip()) world.css_has_class(SELECTOR, className.strip())
@step('Enter (?:a|an) (.+) time of (.+) seconds$') @step('I set value "([^"]*)" to the field "([^"]*)"$')
def enter_start_end_time(_step, type_of_time, time): def set_value_transcripts_field(_step, value, field_name):
type_of_time = type_of_time.strip() world.wait(DELAY)
time = int(time.strip()) world.wait_for_ajax_complete()
field_id = '#' + world.browser.find_by_xpath('//label[text()="%s"]' % field_name.strip())[0]['for']
world.css_fill(field_id, value.strip())
@step('I click (.+) button$') @step('I save changes$')
def click_a_button(_step, button): def save_changes(_step):
button = button.strip(button) world.wait(DELAY)
world.browser.find_by_css(BUTTONS[button]).click() world.wait_for_ajax_complete()
save_css = 'a.save-button'
world.css_click(save_css)
@step('I close the component editor$') @step('I click button "([^"]*)"$')
def close_component_editor(_step): def click_button(_step, button_type):
_step.given('I click Save button') world.wait(DELAY)
world.wait_for_ajax_complete()
button = button_type.strip()
world.css_click(BUTTONS[button])
@step('I see a range on slider starting at (.+) and running for (.+) %$') @step('I see a range on slider with styles "left" set to (.+) and "width" set to (.+)$')
def see_a_range_slider_with_proper_range(_step, left, width): def see_a_range_slider_with_proper_range(_step, left, width):
left = int(left.strip()) left = int(left.strip())
width = int(width.strip()) width = int(width.strip())
world.wait_for_visible(".slider-range")
slider_range = world.css_find(".slider-range")[0]
assert "left: {}%;".format(left) in slider_range.outer_html
assert "width: {}%;".format(width) in slider_range.outer_html
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