Merge pull request #3215 from edx/anton/fix-test-video-position
Video: Fix flaky test.
This commit is contained in:
@@ -2,44 +2,44 @@
|
||||
Feature: LMS Video component
|
||||
As a student, I want to view course videos in LMS
|
||||
|
||||
# BLD-970 Failing currently in master
|
||||
# 1
|
||||
# Scenario: Video component stores position correctly when page is reloaded
|
||||
# Given the course has a Video component in "Youtube" mode
|
||||
# When the video has rendered in "Youtube" mode
|
||||
# And I click video button "play"
|
||||
# Then I seek video to "10" seconds
|
||||
# And I click video button "pause"
|
||||
# And I reload the page
|
||||
# And I click video button "play"
|
||||
# Then I see video starts playing from "0:10" position
|
||||
Scenario: Video component stores position correctly when page is reloaded
|
||||
Given the course has a Video component in "Youtube" mode
|
||||
When the video has rendered in "Youtube" mode
|
||||
And I click video button "play"
|
||||
And I click video button "pause"
|
||||
Then I seek video to "10" seconds
|
||||
And I click video button "play"
|
||||
And I click video button "pause"
|
||||
And I reload the page with video
|
||||
Then I see video slider at "10" seconds
|
||||
|
||||
# 1
|
||||
# 2
|
||||
Scenario: Video component is fully rendered in the LMS in HTML5 mode
|
||||
Given the course has a Video component in "HTML5" mode
|
||||
When the video has rendered in "HTML5" mode
|
||||
And all sources are correct
|
||||
|
||||
# 2
|
||||
# 3
|
||||
@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
|
||||
|
||||
# 3
|
||||
# 4
|
||||
# Youtube testing
|
||||
Scenario: Video component is fully rendered in the LMS in Youtube mode with HTML5 sources
|
||||
Given youtube server is up and response time is 0.4 seconds
|
||||
And the course has a Video component in "Youtube_HTML5" mode
|
||||
When the video has rendered in "Youtube" mode
|
||||
|
||||
# 4
|
||||
# 5
|
||||
Scenario: Video component is not rendered in the LMS in Youtube mode with HTML5 sources
|
||||
Given youtube server is up and response time is 2 seconds
|
||||
And the course has a Video component in "Youtube_HTML5" mode
|
||||
When the video has rendered in "HTML5" mode
|
||||
|
||||
# 5
|
||||
# 6
|
||||
Scenario: Video component is not rendered in the LMS in Youtube mode with HTML5 sources when YouTube API is blocked
|
||||
Given youtube server is up and response time is 2 seconds
|
||||
And youtube stub server blocks YouTube API
|
||||
@@ -47,25 +47,25 @@ Feature: LMS Video component
|
||||
And I wait "3" seconds
|
||||
Then the video has rendered in "HTML5" mode
|
||||
|
||||
# 6
|
||||
# 7
|
||||
Scenario: Video component is rendered in the LMS in Youtube mode without HTML5 sources
|
||||
Given youtube server is up and response time is 2 seconds
|
||||
And the course has a Video component in "Youtube" mode
|
||||
When the video has rendered in "Youtube" mode
|
||||
|
||||
# 7
|
||||
# 8
|
||||
Scenario: Video component is rendered in the LMS in Youtube mode with HTML5 sources that doesn't supported by browser
|
||||
Given youtube server is up and response time is 2 seconds
|
||||
And the course has a Video component in "Youtube_HTML5_Unsupported_Video" mode
|
||||
When the video has rendered in "Youtube" mode
|
||||
|
||||
# 8
|
||||
# 9
|
||||
Scenario: Video component is rendered in the LMS in HTML5 mode with HTML5 sources that doesn't supported by browser
|
||||
Given the course has a Video component in "HTML5_Unsupported_Video" mode
|
||||
Then error message is shown
|
||||
And error message has correct text
|
||||
|
||||
# 9
|
||||
# 10
|
||||
Scenario: Multiple videos in sequentials all load and work, switching between sequentials
|
||||
Given I am registered for the course "test_course"
|
||||
And it has a video "A" in "Youtube" mode in position "1" of sequential
|
||||
@@ -87,7 +87,7 @@ Feature: LMS Video component
|
||||
When I open video "A"
|
||||
Then video "A" should start playing at speed "2.0"
|
||||
|
||||
# 10
|
||||
# 11
|
||||
Scenario: Video component stores speed correctly when each video is in separate sequence
|
||||
Given I am registered for the course "test_course"
|
||||
And it has a video "A" in "Youtube" mode in position "1" of sequential
|
||||
@@ -100,7 +100,7 @@ Feature: LMS Video component
|
||||
Then video "C" should start playing at speed "0.75"
|
||||
When I open video "A"
|
||||
Then video "A" should start playing at speed "2.0"
|
||||
And I reload the page
|
||||
And I reload the page with video
|
||||
When I open video "A"
|
||||
Then video "A" should start playing at speed "2.0"
|
||||
And I select the "1.0" speed on video "A"
|
||||
@@ -109,7 +109,7 @@ Feature: LMS Video component
|
||||
When I open video "C"
|
||||
Then video "C" should start playing at speed "1.0"
|
||||
|
||||
# 11
|
||||
# 12
|
||||
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
|
||||
@@ -124,7 +124,7 @@ Feature: LMS Video component
|
||||
And I select language with code "en"
|
||||
And I see "Hi, welcome to Edx." text in the captions
|
||||
|
||||
# 12
|
||||
# 13
|
||||
Scenario: CC button works correctly w/o 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
|
||||
@@ -134,7 +134,7 @@ Feature: LMS Video component
|
||||
And I make sure captions are opened
|
||||
Then I see "好 各位同学" text in the captions
|
||||
|
||||
# 13
|
||||
# 14
|
||||
Scenario: CC button works correctly only w/ english transcript in HTML5 mode of Video component
|
||||
Given I am registered for the course "test_course"
|
||||
And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
|
||||
@@ -144,7 +144,7 @@ Feature: LMS Video component
|
||||
And I make sure captions are opened
|
||||
Then I see "Hi, welcome to Edx." text in the captions
|
||||
|
||||
# 14
|
||||
# 15
|
||||
Scenario: CC button works correctly w/o 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
|
||||
@@ -154,7 +154,7 @@ Feature: LMS Video component
|
||||
And I make sure captions are opened
|
||||
Then I see "好 各位同学" text in the captions
|
||||
|
||||
# 15
|
||||
# 16
|
||||
Scenario: CC button works correctly if transcripts and sub fields are empty, but transcript file exists in assets (Youtube mode of Video component)
|
||||
Given I am registered for the course "test_course"
|
||||
And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
|
||||
@@ -162,12 +162,12 @@ Feature: LMS Video component
|
||||
And I make sure captions are opened
|
||||
Then I see "Hi, welcome to Edx." text in the captions
|
||||
|
||||
# 16
|
||||
# 17
|
||||
Scenario: CC button is hidden if no translations
|
||||
Given the course has a Video component in "Youtube" mode
|
||||
Then button "CC" is hidden
|
||||
|
||||
# 17
|
||||
# 18
|
||||
Scenario: Video is aligned correctly if transcript is visible in fullscreen mode
|
||||
Given I am registered for the course "test_course"
|
||||
And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
|
||||
@@ -178,13 +178,13 @@ Feature: LMS Video component
|
||||
And I click video button "fullscreen"
|
||||
Then I see video aligned correctly with enabled transcript
|
||||
|
||||
# 18
|
||||
# 19
|
||||
Scenario: Video is aligned correctly if transcript is hidden in fullscreen mode
|
||||
Given the course has a Video component in "Youtube" mode
|
||||
And I click video button "fullscreen"
|
||||
Then I see video aligned correctly without enabled transcript
|
||||
|
||||
# 19
|
||||
# 20
|
||||
Scenario: Video is aligned correctly on transcript toggle in fullscreen mode
|
||||
Given I am registered for the course "test_course"
|
||||
And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
|
||||
@@ -197,7 +197,7 @@ Feature: LMS Video component
|
||||
And I click video button "CC"
|
||||
Then I see video aligned correctly without enabled transcript
|
||||
|
||||
# 20
|
||||
# 21
|
||||
Scenario: Download Transcript button works correctly in Video component
|
||||
Given I am registered for the course "test_course"
|
||||
And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
|
||||
@@ -219,7 +219,7 @@ Feature: LMS Video component
|
||||
When I open video "C"
|
||||
Then menu "download_transcript" doesn't exist
|
||||
|
||||
# 21
|
||||
# 22
|
||||
Scenario: Youtube video has correct transcript if fields for other speeds are filled.
|
||||
Given I am registered for the course "test_course"
|
||||
And I have a "subs_OEoXaMPEzfM.srt.sjson" transcript file in assets
|
||||
@@ -230,11 +230,11 @@ Feature: LMS Video component
|
||||
And I make sure captions are opened
|
||||
Then I see "Hi, welcome to Edx." text in the captions
|
||||
And I select the "1.50" speed
|
||||
And I reload the page
|
||||
And I reload the page with video
|
||||
Then I see "Hi, welcome to Edx." text in the captions
|
||||
And I see duration "1:00"
|
||||
|
||||
# 22
|
||||
# 23
|
||||
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
|
||||
@@ -248,7 +248,7 @@ Feature: LMS Video component
|
||||
And I see "好 各位同学" text in the captions
|
||||
Then I can download transcript in "srt" format that has text "好 各位同学"
|
||||
|
||||
# 23
|
||||
# 24
|
||||
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
|
||||
@@ -262,7 +262,7 @@ Feature: LMS Video component
|
||||
And I see "好 各位同学" text in the captions
|
||||
Then I can download transcript in "srt" format that has text "好 各位同学"
|
||||
|
||||
# 24
|
||||
# 25
|
||||
Scenario: Download button works correctly w/o 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
|
||||
@@ -272,7 +272,7 @@ Feature: LMS Video component
|
||||
And I see "好 各位同学" text in the captions
|
||||
Then I can download transcript in "srt" format that has text "好 各位同学"
|
||||
|
||||
# 25
|
||||
# 26
|
||||
Scenario: Download button works correctly w/o 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
|
||||
@@ -282,7 +282,7 @@ Feature: LMS Video component
|
||||
And I see "好 各位同学" text in the captions
|
||||
Then I can download transcript in "srt" format that has text "好 各位同学"
|
||||
|
||||
# 26
|
||||
# 27
|
||||
Scenario: Verify that each video in each sub-section includes a transcript for non-Youtube countries.
|
||||
Given youtube server is up and response time is 2 seconds
|
||||
And I am registered for the course "test_course"
|
||||
|
||||
@@ -6,7 +6,7 @@ import json
|
||||
import os
|
||||
import time
|
||||
import requests
|
||||
from nose.tools import assert_less
|
||||
from nose.tools import assert_less, assert_equal
|
||||
from common import i_am_registered_for_the_course, visit_scenario_item
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.conf import settings
|
||||
@@ -183,9 +183,6 @@ def add_video_to_course(course, parent_location=None, player_mode=None, data=Non
|
||||
parent_location = add_vertical_to_course(course)
|
||||
kwargs = get_metadata(parent_location, player_mode, data, display_name=display_name)
|
||||
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):
|
||||
@@ -223,6 +220,7 @@ def navigate_to_an_item_in_a_sequence(number):
|
||||
def change_video_speed(speed):
|
||||
world.browser.execute_script("$('.speeds').addClass('open')")
|
||||
speed_css = 'li[data-speed="{0}"] a'.format(speed)
|
||||
world.wait_for_visible('.speeds')
|
||||
world.css_click(speed_css)
|
||||
|
||||
|
||||
@@ -302,6 +300,19 @@ def find_caption_line_by_data_index(index):
|
||||
return world.css_find(SELECTOR).first
|
||||
|
||||
|
||||
def wait_for_video():
|
||||
world.wait_for_present('.is-initialized')
|
||||
world.wait_for_present('div.vidtime')
|
||||
world.wait_for_invisible('.video-wrapper .spinner')
|
||||
world.wait_for_ajax_complete()
|
||||
|
||||
|
||||
@step("I reload the page with video$")
|
||||
def reload_the_page_with_video(_step):
|
||||
_step.given('I reload the page')
|
||||
wait_for_video()
|
||||
|
||||
|
||||
@step('youtube stub server (.*) YouTube API')
|
||||
def configure_youtube_api(_step, action):
|
||||
action=action.strip()
|
||||
@@ -326,6 +337,7 @@ def view_video(_step, player_mode):
|
||||
data = _step.hashes[0] if _step.hashes else None
|
||||
add_video_to_course(coursenum, player_mode=player_mode.lower(), data=data)
|
||||
visit_scenario_item('SECTION')
|
||||
wait_for_video()
|
||||
|
||||
|
||||
@step('a video in "([^"]*)" mode(?:\:)?$')
|
||||
@@ -333,6 +345,7 @@ def add_video(_step, player_mode):
|
||||
data = _step.hashes[0] if _step.hashes else None
|
||||
add_video_to_course(coursenum, player_mode=player_mode.lower(), data=data)
|
||||
visit_scenario_item('SECTION')
|
||||
wait_for_video()
|
||||
|
||||
|
||||
@step('video(?:s)? "([^"]*)" in "([^"]*)" mode in position "([^"]*)" of sequential(?:\:)?$')
|
||||
@@ -345,6 +358,7 @@ def add_video_in_position(_step, video_ids, player_mode, position):
|
||||
@step('I open the section with videos$')
|
||||
def visit_video_section(_step):
|
||||
visit_scenario_item('SECTION')
|
||||
wait_for_video()
|
||||
|
||||
|
||||
@step('I select the "([^"]*)" speed$')
|
||||
@@ -493,15 +507,19 @@ def select_language(_step, code):
|
||||
@step('I click video button "([^"]*)"$')
|
||||
def click_button(_step, button):
|
||||
world.css_click(VIDEO_BUTTONS[button])
|
||||
world.wait_for_ajax_complete()
|
||||
|
||||
|
||||
@step('I see video starts playing from "([^"]*)" position$')
|
||||
@step('I see video slider at "([^"]*)" seconds$')
|
||||
def start_playing_video_from_n_seconds(_step, position):
|
||||
world.wait_for(
|
||||
func=lambda _: world.css_html('.vidtime')[:4] == position.strip(),
|
||||
timeout=5
|
||||
func=lambda _: elapsed_time() > 0,
|
||||
timeout=30
|
||||
)
|
||||
|
||||
actual_position = elapsed_time()
|
||||
assert_equal(actual_position, int(position), "Current position is {}, but should be {}".format(actual_position, position))
|
||||
|
||||
|
||||
@step('I see duration "([^"]*)"$')
|
||||
def i_see_duration(_step, position):
|
||||
@@ -518,6 +536,7 @@ def seek_video_to_n_seconds(_step, seconds):
|
||||
time = float(seconds.strip())
|
||||
jsCode = "$('.video').data('video-player-state').videoPlayer.onSlideSeek({{time: {0:f}}})".format(time)
|
||||
world.browser.execute_script(jsCode)
|
||||
_step.given('I see video slider at "{}" seconds'.format(seconds))
|
||||
|
||||
|
||||
@step('I have a "([^"]*)" transcript file in assets$')
|
||||
|
||||
Reference in New Issue
Block a user