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
5d84cd06
Commit
5d84cd06
authored
Oct 17, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add synchronization logic for waiting after adding components in acceptance tests
parent
4b225de3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
+23
-8
No files found.
cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
View file @
5d84cd06
...
...
@@ -2,10 +2,18 @@
#pylint: disable=C0111
from
lettuce
import
world
from
nose.tools
import
assert_equal
,
assert_
true
,
assert_
in
# pylint: disable=E0611
from
nose.tools
import
assert_equal
,
assert_in
# pylint: disable=E0611
from
terrain.steps
import
reload_the_page
def
_is_expected_element_count
(
css
,
expected_number
):
"""
Returns whether the number of elements found on the page by css locator
the same number that you expected.
"""
return
len
(
world
.
css_find
(
css
))
==
expected_number
@world.absorb
def
create_component_instance
(
step
,
category
,
component_type
=
None
,
is_advanced
=
False
):
"""
...
...
@@ -20,19 +28,26 @@ def create_component_instance(step, category, component_type=None, is_advanced=F
"""
assert_in
(
category
,
[
'problem'
,
'html'
,
'video'
,
'discussion'
])
component_button_css
=
'.large-{}-icon'
.
format
(
category
.
lower
())
component_button_css
=
'span.large-{}-icon'
.
format
(
category
.
lower
())
if
category
==
'problem'
:
module_css
=
'section.xmodule_CapaModule'
else
:
module_css
=
'section.xmodule_{}Module'
.
format
(
category
.
title
())
# Count how many of that module is on the page. Later we will
# assert that one more was added.
# We need to use world.browser.find_by_css instead of world.css_find
# because it's ok if there are currently zero of them.
module_count_before
=
len
(
world
.
browser
.
find_by_css
(
module_css
))
world
.
css_click
(
component_button_css
)
if
category
in
(
'problem'
,
'html'
):
world
.
wait_for_invisible
(
component_button_css
)
click_component_from_menu
(
category
,
component_type
,
is_advanced
)
if
category
==
'problem'
:
expected_css
=
'section.xmodule_CapaModule'
else
:
expected_css
=
'section.xmodule_{}Module'
.
format
(
category
.
title
())
assert_true
(
world
.
is_css_present
(
expected_css
))
world
.
wait_for
(
lambda
_
:
_is_expected_element_count
(
module_css
,
module_count_before
+
1
))
@world.absorb
...
...
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