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
a1bc5a11
Commit
a1bc5a11
authored
Oct 18, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add synchronization logic to fill, check, and select
parent
a16c567b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
common/djangoapps/terrain/ui_helpers.py
+17
-4
No files found.
common/djangoapps/terrain/ui_helpers.py
View file @
a1bc5a11
...
...
@@ -408,28 +408,34 @@ def css_click(css_selector, index=0, wait_time=30):
@world.absorb
def
css_check
(
css_selector
,
index
=
0
,
wait_time
=
30
):
def
css_check
(
css_selector
,
wait_time
=
30
):
"""
Checks a check box based on a CSS selector, first waiting for the element
to be present and clickable. This is just a wrapper for calling "click"
because that's how selenium interacts with check boxes and radio buttons.
Then for synchronization purposes, wait for the element to be checked.
This method will return True if the check worked.
"""
return
css_click
(
css_selector
=
css_selector
,
index
=
index
,
wait_time
=
wait_time
)
css_click
(
css_selector
=
css_selector
,
wait_time
=
wait_time
)
wait_for
(
lambda
_
:
css_find
(
css_selector
)
.
selected
)
return
True
@world.absorb
def
select_option
(
name
,
value
,
index
=
0
,
wait_time
=
30
):
def
select_option
(
name
,
value
,
wait_time
=
30
):
'''
A method to select an option
Then for synchronization purposes, wait for the option to be selected.
This method will return True if the selection worked.
'''
select_css
=
"select[name='{}']"
.
format
(
name
)
option_css
=
"option[value='{}']"
.
format
(
value
)
css_selector
=
"{} {}"
.
format
(
select_css
,
option_css
)
return
css_click
(
css_selector
=
css_selector
,
index
=
index
,
wait_time
=
wait_time
)
css_click
(
css_selector
=
css_selector
,
wait_time
=
wait_time
)
wait_for
(
lambda
_
:
css_has_value
(
select_css
,
value
))
return
True
@world.absorb
...
...
@@ -442,7 +448,14 @@ def id_click(elem_id):
@world.absorb
def
css_fill
(
css_selector
,
text
,
index
=
0
):
"""
Set the value of the element to the specified text.
Note that this will replace the current value completely.
Then for synchronization purposes, wait for the value on the page.
"""
retry_on_exception
(
lambda
:
css_find
(
css_selector
)[
index
]
.
fill
(
text
))
wait_for
(
lambda
_
:
css_has_value
(
css_selector
,
text
,
index
=
index
))
return
True
@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