Reapply "Switch container factory to webpack"

This reverts commit 18d93b00ba.
This commit is contained in:
Calen Pennington
2018-06-07 15:52:05 -04:00
parent 947d82737e
commit be3c7e05c5
158 changed files with 7368 additions and 6805 deletions

View File

@@ -68,8 +68,7 @@ VIDEO_MENUS = {
}
@js_defined('window.Video', 'window.RequireJS.require', 'window.jQuery',
'window.MathJax', 'window.MathJax.isReady')
@js_defined('window.Video', 'window.jQuery', 'window.MathJax')
class VideoPage(PageObject):
"""
Video player in the courseware.

View File

@@ -29,6 +29,7 @@ CLASS_SELECTORS = {
'collapse_bar': '.videolist-extra-videos',
'status': '.transcripts-message-status',
'attach_transcript': '.file-chooser > input[type="file"]',
'basic_metadata': '.basic_metadata_edit',
}
BUTTON_SELECTORS = {
@@ -91,8 +92,8 @@ FIELDS_WO_CLEAR = [
DELAY = 0.5
@js_defined('window.Video', 'window.RequireJS.require', 'window.jQuery', 'window.XModule', 'window.XBlock',
'window.MathJax', 'window.MathJax.isReady')
@js_defined('window.Video', 'window.jQuery', 'window.XModule', 'window.XBlock',
'window.MathJax')
class VideoComponentPage(VideoPage):
"""
CMS Video Component Page
@@ -102,8 +103,10 @@ class VideoComponentPage(VideoPage):
@wait_for_js
def is_browser_on_page(self):
return self.q(css='div{0}'.format(CLASS_SELECTORS['video_xmodule'])).present or self.q(
css='div{0}'.format(CLASS_SELECTORS['xblock'])).present
return (
self.q(css='div{0}'.format(CLASS_SELECTORS['video_xmodule'])).present or
self.q(css='div{0}'.format(CLASS_SELECTORS['xblock'])).present
)
def get_element_selector(self, class_name, vertical=False):
return super(VideoComponentPage, self).get_element_selector(class_name, vertical=vertical)

View File

@@ -740,6 +740,39 @@ class AcceptanceTest(WebAppTest):
# Use long messages so that failures show actual and expected values
self.longMessage = True # pylint: disable=invalid-name
def tearDown(self):
try:
self.browser.get('http://{}:{}'.format(
os.environ.get('BOK_CHOY_HOSTNAME', '127.0.0.1'),
os.environ.get('BOK_CHOY_LMS_PORT', 8003),
))
except: # pylint: disable=bare-except
self.browser.get('http://{}:{}'.format(
os.environ.get('BOK_CHOY_HOSTNAME', '127.0.0.1'),
os.environ.get('BOK_CHOY_CMS_PORT', 8031),
))
logs = self.browser.execute_script("return window.localStorage.getItem('console_log_capture');")
if not logs:
return
logs = json.loads(logs)
log_dir = path('test_root') / 'log'
if 'shard' in os.environ:
log_dir /= "shard_{}".format(os.environ["SHARD"])
log_dir.mkdir_p()
with (log_dir / '{}.browser.log'.format(self.id())).open('w') as browser_log:
for (message, url, line_no, col_no, stack) in logs:
browser_log.write(u"{}:{}:{}: {}\n {}\n".format(
url,
line_no,
col_no,
message,
(stack or "").replace('\n', '\n ')
))
super(AcceptanceTest, self).tearDown()
class UniqueCourseTest(AcceptanceTest):
"""

View File

@@ -9,6 +9,8 @@ from unittest import skipIf
from mock import patch
from nose.plugins.attrib import attr
from bok_choy.promise import EmptyPromise
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.studio.overview import CourseOutlinePage
@@ -141,6 +143,11 @@ class CMSVideoBaseTest(UniqueCourseTest):
xblock_index: number starting from 1 (0th entry is the unit page itself)
"""
self.unit_page.xblocks[xblock_index].edit()
EmptyPromise(
lambda: self.video.q(css='div.basic_metadata_edit').visible,
"Wait for the basic editor to be open",
timeout=5
).fulfill()
def open_advanced_tab(self):
"""

View File

@@ -26,19 +26,20 @@ from common.test.acceptance.tests.helpers import (
)
VIDEO_SOURCE_PORT = 8777
VIDEO_HOSTNAME = os.environ.get('BOK_CHOY_HOSTNAME', 'localhost')
HTML5_SOURCES = [
'http://localhost:{0}/gizmo.mp4'.format(VIDEO_SOURCE_PORT),
'http://localhost:{0}/gizmo.webm'.format(VIDEO_SOURCE_PORT),
'http://localhost:{0}/gizmo.ogv'.format(VIDEO_SOURCE_PORT),
'http://{}:{}/gizmo.mp4'.format(VIDEO_HOSTNAME, VIDEO_SOURCE_PORT),
'http://{}:{}/gizmo.webm'.format(VIDEO_HOSTNAME, VIDEO_SOURCE_PORT),
'http://{}:{}/gizmo.ogv'.format(VIDEO_HOSTNAME, VIDEO_SOURCE_PORT),
]
HTML5_SOURCES_INCORRECT = [
'http://localhost:{0}/gizmo.mp99'.format(VIDEO_SOURCE_PORT),
'http://{}:{}/gizmo.mp99'.format(VIDEO_HOSTNAME, VIDEO_SOURCE_PORT),
]
HLS_SOURCES = [
'http://localhost:{0}/hls/history.m3u8'.format(VIDEO_SOURCE_PORT),
'http://{}:{}/hls/history.m3u8'.format(VIDEO_HOSTNAME, VIDEO_SOURCE_PORT),
]

View File

@@ -53,7 +53,7 @@ from openedx.core.djangolib.js_utils import js_escaped_string
</%block>
<%block name="page_bundle">
<%static:invoke_page_bundle page_name="js/pages/login" class_name="LoginFactory">
"${reverse('homepage') | n, js_escaped_string}"
</%static:invoke_page_bundle>
<%static:webpack entry="js/factories/login">
LoginFactory("${reverse('homepage') | n, js_escaped_string}");
</%static:webpack>
</%block>