Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
b0859941
Commit
b0859941
authored
Apr 03, 2014
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3181 from edx/zoldak/fix-acid
Add synchronization for rendering to studio xblock tests
parents
70db47a7
86cfda32
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
15 deletions
+34
-15
common/test/acceptance/pages/studio/container.py
+11
-4
common/test/acceptance/pages/studio/unit.py
+12
-5
common/test/acceptance/pages/xblock/acid.py
+10
-2
common/test/acceptance/tests/test_studio.py
+1
-4
No files found.
common/test/acceptance/pages/studio/container.py
View file @
b0859941
...
...
@@ -3,7 +3,7 @@ Container page in Studio
"""
from
bok_choy.page_object
import
PageObject
from
bok_choy.promise
import
Promise
from
.
import
BASE_URL
...
...
@@ -22,11 +22,18 @@ class ContainerPage(PageObject):
return
"{}/container/{}"
.
format
(
BASE_URL
,
self
.
unit_locator
)
def
is_browser_on_page
(
self
):
# Wait until all components have been loaded
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
)
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.
return
(
self
.
q
(
css
=
'body.view-container'
)
.
present
and
len
(
self
.
q
(
css
=
XBlockWrapper
.
BODY_SELECTOR
)
.
results
)
==
len
(
self
.
q
(
css
=
'{} .xblock'
.
format
(
XBlockWrapper
.
BODY_SELECTOR
))
.
results
)
Promise
(
_is_finished_loading
,
'Finished rendering the xblock wrappers.'
)
.
fulfill
()
)
@property
...
...
common/test/acceptance/pages/studio/unit.py
View file @
b0859941
...
...
@@ -3,7 +3,7 @@ Unit page in Studio
"""
from
bok_choy.page_object
import
PageObject
from
bok_choy.promise
import
EmptyPromise
from
bok_choy.promise
import
EmptyPromise
,
Promise
from
.
import
BASE_URL
from
.container
import
ContainerPage
...
...
@@ -24,12 +24,19 @@ class UnitPage(PageObject):
return
"{}/unit/{}"
.
format
(
BASE_URL
,
self
.
unit_locator
)
def
is_browser_on_page
(
self
):
# Wait until all components have been loaded
number_of_leaf_xblocks
=
len
(
self
.
q
(
css
=
'{} .xblock-student_view'
.
format
(
Component
.
BODY_SELECTOR
))
.
results
)
number_of_container_xblocks
=
len
(
self
.
q
(
css
=
'{} .wrapper-xblock'
.
format
(
Component
.
BODY_SELECTOR
))
.
results
)
def
_is_finished_loading
():
# Wait until all components have been loaded
number_of_leaf_xblocks
=
len
(
self
.
q
(
css
=
'{} .xblock-student_view'
.
format
(
Component
.
BODY_SELECTOR
))
.
results
)
number_of_container_xblocks
=
len
(
self
.
q
(
css
=
'{} .wrapper-xblock'
.
format
(
Component
.
BODY_SELECTOR
))
.
results
)
is_done
=
len
(
self
.
q
(
css
=
Component
.
BODY_SELECTOR
)
.
results
)
==
number_of_leaf_xblocks
+
number_of_container_xblocks
return
(
is_done
,
is_done
)
# First make sure that an element with the view-unit class is present on the page,
# and then wait to make sure that the xblocks are all there
return
(
self
.
q
(
css
=
'body.view-unit'
)
.
present
and
len
(
self
.
q
(
css
=
Component
.
BODY_SELECTOR
)
.
results
)
==
number_of_leaf_xblocks
+
number_of_container_xblocks
Promise
(
_is_finished_loading
,
'Finished rendering the xblocks in the unit.'
)
.
fulfill
()
)
@property
...
...
common/test/acceptance/pages/xblock/acid.py
View file @
b0859941
...
...
@@ -3,7 +3,7 @@ PageObjects related to the AcidBlock
"""
from
bok_choy.page_object
import
PageObject
from
bok_choy.promise
import
EmptyPromise
,
BrokenPromise
from
bok_choy.promise
import
EmptyPromise
,
BrokenPromise
,
Promise
class
AcidView
(
PageObject
):
"""
...
...
@@ -24,9 +24,17 @@ class AcidView(PageObject):
self
.
context_selector
=
context_selector
def
is_browser_on_page
(
self
):
def
_is_finished_loading
():
# Wait for the xblock javascript to finish initializing
is_done
=
self
.
browser
.
execute_script
(
"return $({!r}).data('initialized')"
.
format
(
self
.
context_selector
))
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 xblock has finished initializing.
return
(
self
.
q
(
css
=
'{} .acid-block'
.
format
(
self
.
context_selector
))
.
present
and
self
.
browser
.
execute_script
(
"return $({!r}).data('initialized')"
.
format
(
self
.
context_selector
)
)
Promise
(
_is_finished_loading
,
'Finished initializing the xblock.'
)
.
fulfill
(
)
)
def
test_passed
(
self
,
test_selector
):
...
...
common/test/acceptance/tests/test_studio.py
View file @
b0859941
...
...
@@ -25,7 +25,7 @@ from ..pages.studio.textbooks import TextbooksPage
from
..pages.xblock.acid
import
AcidView
from
..fixtures.course
import
CourseFixture
,
XBlockFixtureDesc
from
.helpers
import
UniqueCourseTest
,
load_data_str
from
.helpers
import
UniqueCourseTest
class
LoggedOutTest
(
WebAppTest
):
...
...
@@ -170,7 +170,6 @@ class XBlockAcidBase(WebAppTest):
acid_block
=
AcidView
(
self
.
browser
,
unit
.
components
[
0
]
.
preview_selector
)
self
.
validate_acid_block_preview
(
acid_block
)
@skip
(
'Temporarily diabling because it is failing in Jenkins. TE-369'
)
def
test_acid_block_editor
(
self
):
"""
Verify that all expected acid block tests pass in studio editor
...
...
@@ -189,7 +188,6 @@ class XBlockAcidBase(WebAppTest):
self
.
assertTrue
(
acid_block
.
scope_passed
(
'settings'
))
@skip
(
'Temporarily diabling because it is failing in Jenkins. TE-369'
)
class
XBlockAcidNoChildTest
(
XBlockAcidBase
):
"""
Tests of an AcidBlock with no children
...
...
@@ -226,7 +224,6 @@ class XBlockAcidParentBase(XBlockAcidBase):
super
(
XBlockAcidParentBase
,
self
)
.
validate_acid_block_preview
(
acid_block
)
self
.
assertTrue
(
acid_block
.
child_tests_passed
)
@skip
(
'Intermittently failing, needs a better page definition that waits until the unit is fully rendered'
)
def
test_acid_block_preview
(
self
):
"""
Verify that all expected acid block tests pass in studio preview
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment