Commit af4f1668 by Jay Zoldak

Stub out the video and capture the html files of the high level tabs for diff comparison

Conflicts:
	lms/templates/video.html
parent 10275e97
......@@ -9,6 +9,7 @@ def i_click_on_view_courseware(step):
@step('I click on the "([^"]*)" tab$')
def i_click_on_the_tab(step, tab):
world.browser.find_link_by_text(tab).first.click()
world.save_the_html()
@step('I visit the courseware URL$')
def i_visit_the_course_info_url(step):
......
......@@ -7,6 +7,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from student.models import CourseEnrollment
import time
from urllib import quote_plus
from nose.tools import assert_equals
from logging import getLogger
......@@ -99,6 +100,15 @@ def log_in(email, password):
# wait for the page to redraw
assert world.browser.is_element_present_by_css('.content-wrapper', 10)
@world.absorb
def save_the_html(path='/tmp'):
u = world.browser.url
html = world.browser.html.encode('ascii', 'ignore')
filename = '%s.html' % quote_plus(u)
f = open('%s/%s' % (path, filename), 'w')
f.write(html)
f.close
########### DEBUGGING ##############
@step(u'I save a screenshot to "(.*)"')
def save_screenshot_to(step, filename):
......
""" Command line interface to difflib.py to compare html files
"""
import sys, os, time, difflib, optparse, os.path, re
from urllib import unquote_plus
def main():
# Configure the option parser
usage = "usage: %prog fromdir todir"
parser = optparse.OptionParser(usage)
(options, args) = parser.parse_args()
if len(args) == 0:
parser.print_help()
sys.exit(1)
if len(args) != 2:
parser.error("need to specify both a fromdir and todir")
fromdir, todir = args # as specified in the usage string
if not os.path.isdir(fromdir):
print "'%s' is not a directory" % fromdir
if not os.path.isdir(todir):
print "'%s' is not a directory" % todir
from_files = os.listdir(fromdir)
to_files = os.listdir(todir)
for filename in from_files:
if filename in to_files:
fromfile = os.path.join(fromdir, filename)
tofile = os.path.join(todir, filename)
# we're passing these as arguments to the diff function
# fromdate = time.ctime(os.stat(fromfile).st_mtime)
# todate = time.ctime(os.stat(tofile).st_mtime)
fromlines = cleanup(open(fromfile, 'U').readlines())
tolines = cleanup(open(tofile, 'U').readlines())
diff = difflib.unified_diff(fromlines, tolines, fromdir, todir, n=0)
# fromdate, todate, n=0)
print 'FILE: %s' % unquote_plus(filename)
# we're using writelines because diff is a generator
sys.stdout.writelines(diff)
print ''
def cleanup(lines):
lines = [s.replace('/c4x/MITx/6.002x/asset', '/static/content-mit-6002x') for s in lines]
lines = [s.replace('handouts_', 'handouts/') for s in lines]
return lines
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -2,19 +2,21 @@
<h2> ${display_name} </h2>
% endif
<div id="video_${id}" class="video" data-streams="${streams}"
data-caption-data-dir="${data_dir}" data-show-captions="${show_captions}"
data-start="${start}" data-end="${end}">
<div class="tc-wrapper">
<article class="video-wrapper">
<section class="video-player">
<div id="${id}"></div>
</section>
<section class="video-controls"></section>
</article>
%if settings.MITX_FEATURES['DISPLAY_TOY_COURSES']:
<div id="stub_out_video_for_testing"></div>
%else:
<div id="video_${id}" class="video" data-streams="${streams}" data-caption-data-dir="${data_dir}" data-show-captions="${show_captions}">
<div class="tc-wrapper">
<article class="video-wrapper">
<section class="video-player">
<div id="${id}"></div>
</section>
<section class="video-controls"></section>
</article>
</div>
</div>
</div>
%endif
% if source:
<div class="video-sources">
<p>Download video <a href="${source}">here</a>.</p>
......
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