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
8b0e7c57
Commit
8b0e7c57
authored
Jul 03, 2013
by
JonahStanley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made a new command css_has_class that will safely check the class and get around stale elements
parent
d86502bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
cms/djangoapps/contentstore/features/common.py
+1
-7
common/djangoapps/terrain/ui_helpers.py
+13
-0
No files found.
cms/djangoapps/contentstore/features/common.py
View file @
8b0e7c57
...
@@ -223,13 +223,7 @@ def shows_captions(step, show_captions):
...
@@ -223,13 +223,7 @@ def shows_captions(step, show_captions):
# Prevent cookies from overriding course settings
# Prevent cookies from overriding course settings
world
.
browser
.
cookies
.
delete
(
'hide_captions'
)
world
.
browser
.
cookies
.
delete
(
'hide_captions'
)
if
show_captions
==
'does not'
:
if
show_captions
==
'does not'
:
attempt
=
0
assert
world
.
css_has_class
(
'.video'
,
'closed'
)
while
attempt
<
5
:
try
:
assert
world
.
css_find
(
'.video'
)[
0
]
.
has_class
(
'closed'
)
except
:
attempt
+=
1
assert_true
(
attempt
<
5
,
"There was a stale reference exception in accessing the class of the video"
)
else
:
else
:
assert
world
.
is_css_not_present
(
'.video.closed'
)
assert
world
.
is_css_not_present
(
'.video.closed'
)
...
...
common/djangoapps/terrain/ui_helpers.py
View file @
8b0e7c57
...
@@ -183,6 +183,19 @@ def css_html(css_selector, index=0, max_attempts=5):
...
@@ -183,6 +183,19 @@ def css_html(css_selector, index=0, max_attempts=5):
@world.absorb
@world.absorb
def
css_has_class
(
css_selector
,
class_name
,
index
=
0
,
max_attempts
=
5
):
attempt
=
0
found
=
False
while
attempt
<
max_attempts
and
not
found
:
try
:
return
world
.
css_find
(
css_selector
)[
index
]
.
has_class
(
class_name
)
found
=
True
except
:
attempt
+=
1
return
False
@world.absorb
def
css_visible
(
css_selector
):
def
css_visible
(
css_selector
):
assert
is_css_present
(
css_selector
),
"{} is not present"
.
format
(
css_selector
)
assert
is_css_present
(
css_selector
),
"{} is not present"
.
format
(
css_selector
)
return
world
.
browser
.
find_by_css
(
css_selector
)
.
visible
return
world
.
browser
.
find_by_css
(
css_selector
)
.
visible
...
...
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