Commit d0aaa37a by Jay Zoldak

Fix is_browser_on_page method for Studio Container page

parent f6b278e7
......@@ -37,15 +37,19 @@ class ContainerPage(PageObject):
def is_browser_on_page(self):
def _is_finished_loading():
# Wait until all components have been loaded
is_done = len(self.q(css=XBlockWrapper.BODY_SELECTOR).results) == len(
self.q(css='{} .xblock'.format(XBlockWrapper.BODY_SELECTOR)).results)
# Wait until all components have been loaded.
# See common/static/coffee/src/xblock/core.coffee which adds the
# class "xblock-initialized" at the end of initializeBlock
num_wrappers = len(self.q(css=XBlockWrapper.BODY_SELECTOR).results)
num_xblocks_init = len(self.q(css='{} .xblock.xblock-initialized'.format(XBlockWrapper.BODY_SELECTOR)).results)
is_done = num_wrappers == num_xblocks_init
return (is_done, is_done)
# First make sure that an element with the view-container class is present on the page,
# and then wait to make sure that the xblocks are all there.
# and then wait for the loading spinner to go away and all the xblocks to be initialized.
return (
self.q(css='body.view-container').present and
self.q(css='div.ui-loading.is-hidden').present and
Promise(_is_finished_loading, 'Finished rendering the xblock wrappers.').fulfill()
)
......
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