Commit de72759c by Anton Stupak

Merge pull request #3033 from edx/anton/fix-flaky-video-acceptance-tests

Video: Fix flaky acceptance tests.
parents 2c0636da a1c957ec
......@@ -3,12 +3,9 @@ Feature: CMS Video Component
As a course author, I want to be able to view my created videos in Studio
# 1
# Disabled because does_not_autoplay fails with the
# selenium upgrade from 2.34.0 to 2.39.0. See TE-368
# Video Alpha Features will work in Firefox only when Firefox is the active window
# Scenario: Autoplay is disabled in Studio
# Given I have created a Video component
# Then when I view the video it does not have autoplay enabled
Scenario: Autoplay is disabled in Studio
Given I have created a Video component
Then when I view the video it does not have autoplay enabled
# 2
Scenario: Creating a video takes a single click
......
......@@ -77,7 +77,9 @@ def i_have_uploaded_subtitles(_step, sub_id):
@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'
actual = world.css_find('.%s' % video_type)[0]['data-autoplay']
expected = [u'False', u'false', False]
assert actual in expected
assert world.css_has_class('.video_control', 'play')
......
......@@ -20,13 +20,10 @@ Feature: LMS Video component
And all sources are correct
# 3
# Firefox doesn't have HTML5 (only mp4 - fix here)
# Disabled because does_not_autoplay fails with the
# selenium upgrade from 2.34.0 to 2.39.0. See TE-368
# @skip_firefox
# Scenario: Autoplay is disabled in LMS for a Video component
# Given the course has a Video component in HTML5 mode
# Then when I view the video it does not have autoplay enabled
@skip_firefox
Scenario: Autoplay is disabled in LMS for a Video component
Given the course has a Video component in "HTML5" mode
Then when I view the video it does not have autoplay enabled
# 4
# Youtube testing
......@@ -82,19 +79,19 @@ Feature: LMS Video component
Then video "C" should start playing at speed "1.0"
# 10
# Scenario: Language menu works correctly in Video component
# Given I am registered for the course "test_course"
# And I have a "chinese_transcripts.srt" transcript file in assets
# And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
# And it has a video in "Youtube" mode:
# | transcripts | sub |
# | {"zh": "chinese_transcripts.srt"} | OEoXaMPEzfM |
# And I make sure captions are closed
# And I see video menu "language" with correct items
# And I select language with code "zh"
# Then I see "好 各位同学" text in the captions
# And I select language with code "en"
# And I see "Hi, welcome to Edx." text in the captions
Scenario: Language menu works correctly in Video component
Given I am registered for the course "test_course"
And I have a "chinese_transcripts.srt" transcript file in assets
And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
And it has a video in "Youtube" mode:
| transcripts | sub |
| {"zh": "chinese_transcripts.srt"} | OEoXaMPEzfM |
And I make sure captions are closed
And I see video menu "language" with correct items
And I select language with code "zh"
Then I see "好 各位同学" text in the captions
And I select language with code "en"
And I see "Hi, welcome to Edx." text in the captions
# 11
Scenario: CC button works correctly w/o english transcript in HTML5 mode of Video component
......@@ -207,30 +204,30 @@ Feature: LMS Video component
And I see duration "1:00"
# 21
# Scenario: Download button works correctly for non-english transcript in Youtube mode of V# ideo component
# Given I am registered for the course "test_course"
# And I have a "chinese_transcripts.srt" transcript file in assets
# And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
# And it has a video in "Youtube" mode:
# | transcripts | sub | download_track |
# | {"zh": "chinese_transcripts.srt"} | OEoXaMPEzfM | true |
# Then I can download transcript in "srt" format that has text "Hi, welcome to Edx."
# And I select language with code "zh"
# And I see "好 各位同学" text in the captions
# Then I can download transcript in "srt" format that has text "好 各位同学"
Scenario: Download button works correctly for non-english transcript in Youtube mode of Video component
Given I am registered for the course "test_course"
And I have a "chinese_transcripts.srt" transcript file in assets
And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
And it has a video in "Youtube" mode:
| transcripts | sub | download_track |
| {"zh": "chinese_transcripts.srt"} | OEoXaMPEzfM | true |
Then I can download transcript in "srt" format that has text "Hi, welcome to Edx."
And I select language with code "zh"
And I see "好 各位同学" text in the captions
Then I can download transcript in "srt" format that has text "好 各位同学"
# 22
# Scenario: Download button works correctly for non-english transcript in HTML5 mode of Video component
# Given I am registered for the course "test_course"
# And I have a "chinese_transcripts.srt" transcript file in assets
# And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
# And it has a video in "HTML5" mode:
# | transcripts | sub | download_track |
# | {"zh": "chinese_transcripts.srt"} | OEoXaMPEzfM | true |
# Then I can download transcript in "srt" format that has text "Hi, welcome to Edx."
# And I select language with code "zh"
# And I see "好 各位同学" text in the captions
# Then I can download transcript in "srt" format that has text "好 各位同学"
Scenario: Download button works correctly for non-english transcript in HTML5 mode of Video component
Given I am registered for the course "test_course"
And I have a "chinese_transcripts.srt" transcript file in assets
And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
And it has a video in "HTML5" mode:
| transcripts | sub | download_track |
| {"zh": "chinese_transcripts.srt"} | OEoXaMPEzfM | true |
Then I can download transcript in "srt" format that has text "Hi, welcome to Edx."
And I select language with code "zh"
And I see "好 各位同学" text in the captions
Then I can download transcript in "srt" format that has text "好 各位同学"
# 23
Scenario: Download button works correctly w/o english transcript in HTML5 mode of Video component
......
......@@ -165,6 +165,7 @@ def add_video_to_course(course, parent_location=None, player_mode=None, data=Non
world.scenario_dict['VIDEO'] = world.ItemFactory.create(**kwargs)
world.wait_for_present('.is-initialized')
world.wait_for_invisible('.video-wrapper .spinner')
world.wait_for_ajax_complete()
def add_vertical_to_course(course_num):
......@@ -270,7 +271,9 @@ def parse_time_str(time_str):
@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')
actual = world.css_find('.%s' % video_type)[0]['data-autoplay']
expected = [u'False', u'false', False]
assert actual in expected
@step('the course has a Video component in "([^"]*)" mode(?:\:)?$')
......@@ -410,19 +413,25 @@ def check_text_in_the_captions(_step, text):
@step('I select language with code "([^"]*)"$')
def select_language(_step, code):
# Make sure that all ajax requests that affects the language menu are finished.
# For example, request to get new translation etc.
world.wait_for_ajax_complete()
selector = VIDEO_MENUS["language"] + ' li[data-lang-code="{code}"]'.format(
code=code
)
world.wait_for_present(selector)
world.css_find(VIDEO_BUTTONS["CC"])[0].mouse_over()
world.wait_for_visible(selector)
world.css_click(selector)
assert world.css_has_class(selector, 'active')
assert len(world.css_find(VIDEO_MENUS["language"] + ' li.active')) == 1
assert world.css_visible('.subtitles')
# Make sure that all ajax requests that affects the display of captions are finished.
# For example, request to get new translation etc.
world.wait_for_ajax_complete()
assert world.css_visible('.subtitles')
@step('I click video button "([^"]*)"$')
......
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