Commit 960c2ec4 by polesye

Fix acceptance tests.

parent a3525875
......@@ -25,12 +25,13 @@ def go_to_uploads(_step):
world.css_click(uploads_css)
@step(u'I upload the file "([^"]*)"$')
def upload_file(_step, file_name):
@step(u'I upload the (.*)file "([^"]*)"$')
def upload_file(_step, is_test_file, file_name):
upload_css = 'a.upload-button'
world.css_click(upload_css)
_write_test_file(file_name, "test file")
if not is_test_file:
_write_test_file(file_name, "test file")
# uploading the file itself
path = os.path.join(TEST_ROOT, 'uploads/', file_name)
......
......@@ -23,6 +23,10 @@ def shows_captions(_step, show_captions):
else:
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$')
def correct_video_settings(_step):
......
......@@ -16,24 +16,28 @@ def i_created_a_video_component(step):
)
@step('I have created a Video component with subtitles$')
def i_created_a_video_component_subtitles(step):
step.given('I have created a Video component')
@step('I have created a Video component with (.*)subtitles$')
def i_created_a_video_with_subs(_step, sub_id):
_step.given('I have created a Video component')
# Store the current URL so we can return here
video_url = world.browser.url
# 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
world.visit(video_url)
@step('I have uploaded subtitles')
def i_have_uploaded_subtitles(step):
step.given('I go to the files and uploads page')
step.given('I upload the file "subs_OEoXaMPEzfM.srt.sjson"')
@step('I have uploaded (.*) subtitles')
def i_have_uploaded_subtitles(_step, sub_id):
_step.given('I go to the files and uploads page')
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$')
......
......@@ -200,7 +200,7 @@ function () {
'STATUS:', textStatus + ', MESSAGE:', '' + errorThrown
);
_this.videoCaption.hideCaptions(true);
_this.videoCaption.hideCaptions(true, false);
_this.videoCaption.hideSubtitlesEl.hide();
}
});
......@@ -337,18 +337,18 @@ function () {
// Enables or disables automatic scrolling of the captions when the
// video is playing. This feature has to be disabled when tabbing
// through them as it interferes with that action. Initially, have this
// flag enabled as we assume mouse use. Then, if the first caption
// flag enabled as we assume mouse use. Then, if the first caption
// (through forward tabbing) or the last caption (through backwards
// tabbing) gets the focus, disable that feature. Renable it if tabbing
// then cycles out of the the captions.
// then cycles out of the the captions.
this.videoCaption.autoScrolling = true;
// Keeps track of where the focus is situated in the array of captions.
// Used to implement the automatic scrolling behavior and decide if the
// outline around a caption has to be hidden or shown on a mouseenter or
// mouseleave. Initially, no caption has the focus, set the index to -1.
this.videoCaption.currentCaptionIndex = -1;
// Used to track if the focus is coming from a click or tabbing. This
// has to be known to decide if, when a caption gets the focus, an
// Used to track if the focus is coming from a click or tabbing. This
// has to be known to decide if, when a caption gets the focus, an
// outline has to be drawn (tabbing) or not (mouse click).
this.videoCaption.isMouseFocus = false;
......@@ -362,7 +362,7 @@ function () {
// On mouseOut, show the outline of a caption that has been tabbed to.
function captionMouseOverOut(event) {
var caption = $(event.target),
captionIndex = parseInt(caption.attr('data-index'), 10);
captionIndex = parseInt(caption.attr('data-index'), 10);
if (captionIndex === this.videoCaption.currentCaptionIndex) {
if (event.type === 'mouseover') {
caption.removeClass('focused');
......@@ -370,7 +370,7 @@ function () {
else { // mouseout
caption.addClass('focused');
}
}
}
}
function captionMouseDown(event) {
......@@ -390,19 +390,19 @@ function () {
captionIndex = parseInt(caption.attr('data-index'), 10);
// If the focus comes from a mouse click, hide the outline, turn on
// automatic scrolling and set currentCaptionIndex to point outside of
// caption list (ie -1) to disable mouseenter, mouseleave behavior.
// caption list (ie -1) to disable mouseenter, mouseleave behavior.
if (this.videoCaption.isMouseFocus) {
this.videoCaption.autoScrolling = true;
caption.removeClass('focused');
this.videoCaption.currentCaptionIndex = -1;
}
// If the focus comes from tabbing, show the outline and turn off
// If the focus comes from tabbing, show the outline and turn off
// automatic scrolling.
else {
this.videoCaption.currentCaptionIndex = captionIndex;
caption.addClass('focused');
// The second and second to last elements turn automatic scrolling
// off again as it may have been enabled in captionBlur.
// off again as it may have been enabled in captionBlur.
if (captionIndex <= 1 || captionIndex >= this.videoCaption.captions.length-2) {
this.videoCaption.autoScrolling = false;
}
......@@ -410,7 +410,7 @@ function () {
}
function captionBlur(event) {
var caption = $(event.target),
var caption = $(event.target),
captionIndex = parseInt(caption.attr('data-index'), 10);
caption.removeClass('focused');
// If we are on first or last index, we have to turn automatic scroll on
......@@ -418,7 +418,7 @@ function () {
// are tabbing. So we could be on the first element and tabbing back out
// of the captions or on the last element and tabbing forward out of the
// captions.
if (captionIndex === 0 ||
if (captionIndex === 0 ||
captionIndex === this.videoCaption.captions.length-1) {
this.videoCaption.autoScrolling = true;
}
......@@ -434,8 +434,8 @@ function () {
function scrollCaption() {
var el = this.videoCaption.subtitlesEl.find('.current:first');
// Automatic scrolling gets disabled if one of the captions has received
// focus through tabbing.
// Automatic scrolling gets disabled if one of the captions has received
// focus through tabbing.
if (!this.videoCaption.frozen && el.length && this.videoCaption.autoScrolling) {
this.videoCaption.subtitlesEl.scrollTo(
el,
......@@ -582,9 +582,13 @@ function () {
}
}
function hideCaptions(hide_captions) {
function hideCaptions(hide_captions, update_cookie) {
var type;
if (typeof update_cookie === 'undefined') {
update_cookie = true;
}
if (hide_captions) {
type = 'hide_transcript';
this.captionsHidden = true;
......@@ -606,10 +610,12 @@ function () {
this.videoCaption.setSubtitlesHeight();
$.cookie('hide_captions', hide_captions, {
expires: 3650,
path: '/'
});
if (update_cookie) {
$.cookie('hide_captions', hide_captions, {
expires: 3650,
path: '/'
});
}
}
function captionHeight() {
......
{
"start": [
270,
2720,
5430,
7160,
10830,
12880,
15890,
19000,
22070,
25170,
27890,
30590,
32920,
36360,
39630,
41170,
42790,
44590,
47320,
50250,
51880,
54320,
57410,
59160,
62320,
65099,
68430,
71360,
73640,
76580,
78660,
81480,
83940,
86230,
88570,
90520,
93430,
95940,
99090,
100910,
103740,
105610,
108310,
111100,
112360
],
"end": [
2720,
5430,
7160,
10830,
12880,
15890,
19000,
22070,
25170,
27890,
30590,
32920,
36360,
39630,
41170,
42790,
44590,
47320,
50250,
51880,
54320,
57410,
59160,
62320,
65099,
68430,
71360,
73640,
76580,
78660,
81480,
83940,
86230,
88570,
90520,
93430,
95940,
99090,
100910,
103740,
105610,
108310,
111100,
112360,
114220
],
"text": [
"LILA FISHER: Hi, welcome to Edx.",
"I'm Lila Fisher, an Edx fellow helping to put",
"together these courses.",
"As you know, our courses are entirely online.",
"So before we start learning about the subjects that",
"brought you here, let's learn about the tools that you will",
"use to navigate through the course material.",
"Let's start with what is on your screen right now.",
"You are watching a video of me talking.",
"You have several tools associated with these videos.",
"Some of them are standard video buttons, like the play",
"Pause Button on the bottom left.",
"Like most video players, you can see how far you are into",
"this particular video segment and how long the entire video",
"segment is.",
"Something that you might not be used to",
"is the speed option.",
"While you are going through the videos, you can speed up",
"or slow down the video player with these buttons.",
"Go ahead and try that now.",
"Make me talk faster and slower.",
"If you ever get frustrated by the pace of speech, you can",
"adjust it this way.",
"Another great feature is the transcript on the side.",
"This will follow along with everything that I am saying as",
"I am saying it, so you can read along if you like.",
"You can also click on any of the words, and you will notice",
"that the video jumps to that word.",
"The video slider at the bottom of the video will let you",
"navigate through the video quickly.",
"If you ever find the transcript distracting, you",
"can toggle the captioning button in order to make it go",
"away or reappear.",
"Now that you know about the video player, I want to point",
"out the sequence navigator.",
"Right now you're in a lecture sequence, which interweaves",
"many videos and practice exercises.",
"You can see how far you are in a particular sequence by",
"observing which tab you're on.",
"You can navigate directly to any video or exercise by",
"clicking on the appropriate tab.",
"You can also progress to the next element by pressing the",
"Arrow button, or by clicking on the next tab.",
"Try that now.",
"The tutorial will continue in the next video."
]
}
\ No newline at end of file
{"start":[0,650,3920,7450,10080,11700,13950,18000,21020,22710,25050,27730,29990,32950,36190,37390,41130,43720,47380,51430,53000,55980,57790,61000,64590,66440,69710,71790,76110,79570,81080,84950,87580,90270,94920,97070,100920,103600,107200,111090,116760,120410,124600,127190,131590,135480,139985,143930,147400,150640,155620,159350,162280,165560,167740,171560,174050,177830,179820,182970,184990,188110,189070,192980,194230],"end":[650,3920,7450,10080,11700,13950,18000,21020,22710,25050,27730,29990,32950,36190,37390,41130,43720,47380,51430,53000,55980,57790,61000,64590,66440,69710,71790,76110,79570,81080,84950,87580,90270,94920,97070,100920,103600,107200,111090,116760,120410,124600,127190,131590,135480,139985,143930,147400,150640,155620,159350,162280,165560,167740,171560,174050,177830,179820,182970,184990,188110,189070,192980,194230,194710],"text":["","ERIC: Hi, and welcome to the edX demonstration course.","I'm Eric, and I'm here to help you get a better understanding of how fun and","easy it is to take an edX course.","So, let's get started.","Let me show you how all the parts work together.","If at any time you want to skip this video and get a firsthand experience","of the demonstration course, all you have to do is click","week one to the left.","Don't worry, I won't be offended.","Let's first look along the top of the page.","This area's called the navigation bar.","Click on Courseware to interact with your course.","Course Info contains course announcements and updates from the","course staff.","If your course has digital textbooks, this is where you'll find them.","Discussion is where you can communicate with the fellow students","on topics and projects, and even occasionally with the course staff.","When available, the course Wiki acts as a knowledge base for your course.","It's a helpful resource.","Clicking on Progress will reveal how well you're doing in","your studies and exams.","When you take the demo course, we'll provide you with a simple progress","report matching your results.","Let's look at the left column now.","The left side of the Courseware screen contains a course navigation bar","starting from the top down.","Many courses start with an overview of edX and an introduction to the course.","Below the overview are segments of the course, which are released as the","course progresses.","Typically, an edX course is delivered in week by week segments, and have","lessons and homeworks you need to complete.","Many courses are 10 to 12 weeks long.","We made this demonstration course three weeks for simplicity.","Let's now look at the learning sequence.","Each item in the left column reveals a corresponding learning sequence.","Work your way from left to right.","Learning sequences can contain lectures, exercises, and interactive","lessons that you can complete on your own schedule.","Next, let's discover what makes edX fun and unique, its interactivity.","edX prides itself on its interactive lessons, which can include","demonstrations, visualizations, and virtual environments.","You can try out some in the demo course.","Interactive lessons are often graded and contribute to your final grade.","While the edX platform also supports more traditional question formats like","multiple choice, our classes also test your understanding by allowing you to","use labs and simulators, and even asking you to write an essay.","Example of these graded interactions are in the demo course.","You can see how the questions the course uses for gauging your learning","process can even be auto graded, or detailed feedback given in real time.","So while an edX course might be rigorous, the tools and visualizations","are really fun and truly interactive.","Finally, there are many ways successful students like to you","interact to get the most out of a course.","Beyond the discussion forums, you can meet and engage with fellow classmates","through a local meet up-- which we highly recommend--","a Google Hangout, or even invite students to join you via Twitter,","Facebook, or other social networks.","It's a proven fact that if you engage with others while taking a course,","you're more likely to succeed.","Now that you've seen how easy it is to take an edX course, experience this","demonstration course.","Firsthand all you have to do is click on week one to the left and you can","get started.",""],"paragraphs":[0,650,22710,41130,64590,81080,97070,116760,143930,162280,179820]}
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