Commit f166ddb4 by Jay Zoldak

Merge pull request #4552 from edx/zoldak/studio-container-page

Improve is_browser_on_page method for Studio Container page
parents c930e17f d0aaa37a
...@@ -37,15 +37,19 @@ class ContainerPage(PageObject): ...@@ -37,15 +37,19 @@ class ContainerPage(PageObject):
def is_browser_on_page(self): def is_browser_on_page(self):
def _is_finished_loading(): def _is_finished_loading():
# Wait until all components have been loaded # Wait until all components have been loaded.
is_done = len(self.q(css=XBlockWrapper.BODY_SELECTOR).results) == len( # See common/static/coffee/src/xblock/core.coffee which adds the
self.q(css='{} .xblock'.format(XBlockWrapper.BODY_SELECTOR)).results) # 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) return (is_done, is_done)
# First make sure that an element with the view-container class is present on the page, # 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 ( return (
self.q(css='body.view-container').present and 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() 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