This will remove imports from __future__ that are no longer needed. https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
19 lines
553 B
Python
19 lines
553 B
Python
"""
|
|
Utility methods useful for XBlock page tests.
|
|
"""
|
|
|
|
|
|
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 $('{}').data('initialized')".format(xblock_css))
|
|
return is_done, is_done
|
|
|
|
return Promise(_is_finished_loading, 'Finished initializing the xblock.').fulfill()
|