Commit a1c957ec by polesye

BLD-951: Fix flaky tests.

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