Commit 68fb0230 by polesye

Merge pull request #1201 from edx/anton/fix_video_acceptance_tests

BLD-388: Fix acceptance tests.
parents a3525875 9a4633be
...@@ -10,7 +10,6 @@ import random ...@@ -10,7 +10,6 @@ import random
import os import os
from django.contrib.auth.models import User from django.contrib.auth.models import User
from student.models import CourseEnrollment from student.models import CourseEnrollment
from splinter.request_handler.status_code import HttpResponseError
from nose.tools import assert_equal, assert_not_equal # pylint: disable=E0611 from nose.tools import assert_equal, assert_not_equal # pylint: disable=E0611
TEST_ROOT = settings.COMMON_TEST_DATA_ROOT TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
...@@ -25,11 +24,12 @@ def go_to_uploads(_step): ...@@ -25,11 +24,12 @@ def go_to_uploads(_step):
world.css_click(uploads_css) world.css_click(uploads_css)
@step(u'I upload the file "([^"]*)"$') @step(u'I upload the( test?) file "([^"]*)"$')
def upload_file(_step, file_name): def upload_file(_step, is_test_file, file_name):
upload_css = 'a.upload-button' upload_css = 'a.upload-button'
world.css_click(upload_css) world.css_click(upload_css)
if not is_test_file:
_write_test_file(file_name, "test file") _write_test_file(file_name, "test file")
# uploading the file itself # uploading the file itself
......
...@@ -23,6 +23,10 @@ def shows_captions(_step, show_captions): ...@@ -23,6 +23,10 @@ def shows_captions(_step, show_captions):
else: else:
assert world.is_css_not_present('div.video.closed') assert world.is_css_not_present('div.video.closed')
# Prevent cookies from overriding course settings
world.browser.cookies.delete('hide_captions')
world.browser.cookies.delete('current_player_mode')
@step('I see the correct video settings and default values$') @step('I see the correct video settings and default values$')
def correct_video_settings(_step): def correct_video_settings(_step):
......
...@@ -17,23 +17,31 @@ def i_created_a_video_component(step): ...@@ -17,23 +17,31 @@ def i_created_a_video_component(step):
@step('I have created a Video component with subtitles$') @step('I have created a Video component with subtitles$')
def i_created_a_video_component_subtitles(step): def i_created_a_video_with_subs(_step):
step.given('I have created a Video component') _step.given('I have created a Video component with subtitles "OEoXaMPEzfM"')
@step('I have created a Video component with subtitles "([^"]*)"$')
def i_created_a_video_with_subs_with_name(_step, sub_id):
_step.given('I have created a Video component')
# Store the current URL so we can return here # Store the current URL so we can return here
video_url = world.browser.url video_url = world.browser.url
# Upload subtitles for the video using the upload interface # Upload subtitles for the video using the upload interface
step.given('I have uploaded subtitles') _step.given('I have uploaded subtitles "{}"'.format(sub_id))
# Return to the video # Return to the video
world.visit(video_url) world.visit(video_url)
@step('I have uploaded subtitles') @step('I have uploaded subtitles "([^"]*)"$')
def i_have_uploaded_subtitles(step): def i_have_uploaded_subtitles(_step, sub_id):
step.given('I go to the files and uploads page') _step.given('I go to the files and uploads page')
step.given('I upload the file "subs_OEoXaMPEzfM.srt.sjson"')
sub_id = sub_id.strip()
if not sub_id:
sub_id = 'OEoXaMPEzfM'
_step.given('I upload the test file "subs_{}.srt.sjson"'.format(sub_id))
@step('when I view the (.*) it does not have autoplay enabled$') @step('when I view the (.*) it does not have autoplay enabled$')
......
...@@ -200,7 +200,7 @@ function () { ...@@ -200,7 +200,7 @@ function () {
'STATUS:', textStatus + ', MESSAGE:', '' + errorThrown 'STATUS:', textStatus + ', MESSAGE:', '' + errorThrown
); );
_this.videoCaption.hideCaptions(true); _this.videoCaption.hideCaptions(true, false);
_this.videoCaption.hideSubtitlesEl.hide(); _this.videoCaption.hideSubtitlesEl.hide();
} }
}); });
...@@ -582,9 +582,13 @@ function () { ...@@ -582,9 +582,13 @@ function () {
} }
} }
function hideCaptions(hide_captions) { function hideCaptions(hide_captions, update_cookie) {
var type; var type;
if (typeof update_cookie === 'undefined') {
update_cookie = true;
}
if (hide_captions) { if (hide_captions) {
type = 'hide_transcript'; type = 'hide_transcript';
this.captionsHidden = true; this.captionsHidden = true;
...@@ -606,11 +610,13 @@ function () { ...@@ -606,11 +610,13 @@ function () {
this.videoCaption.setSubtitlesHeight(); this.videoCaption.setSubtitlesHeight();
if (update_cookie) {
$.cookie('hide_captions', hide_captions, { $.cookie('hide_captions', hide_captions, {
expires: 3650, expires: 3650,
path: '/' path: '/'
}); });
} }
}
function captionHeight() { function captionHeight() {
if (this.isFullScreen) { if (this.isFullScreen) {
......
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