Merge pull request #4552 from edx/zoldak/studio-container-page
Improve is_browser_on_page method for Studio Container page
This commit is contained in:
@@ -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()
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user