* INCR-244: Make compatible with Python 3.x without breaking Python 2.7 support on common/test/acceptance/pages [common, xblock] * INCR-244: Add missing module docstring and fix for six import * INCR-244: Update module docstring
19 lines
593 B
Python
19 lines
593 B
Python
"""
|
|
Utility methods useful for XBlock page tests.
|
|
"""
|
|
from __future__ import absolute_import
|
|
|
|
from bok_choy.promise import Promise
|
|
|
|
|
|
def wait_for_xblock_initialization(page, xblock_css):
|
|
"""
|
|
Wait for the xblock with the given CSS to finish initializing.
|
|
"""
|
|
def _is_finished_loading():
|
|
# Wait for the xblock javascript to finish initializing
|
|
is_done = page.browser.execute_script(u"return $({!r}).data('initialized')".format(xblock_css))
|
|
return (is_done, is_done)
|
|
|
|
return Promise(_is_finished_loading, 'Finished initializing the xblock.').fulfill()
|