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
0be0df1b
Commit
0be0df1b
authored
Jul 03, 2013
by
Jonah Stanley
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #325 from edx/jonahstanley/fix-flakey-tests
Made a css_html to obtain the html of the css element.
parents
8dd32b2a
7fabac9a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
24 deletions
+38
-24
cms/djangoapps/contentstore/features/checklists.py
+2
-2
cms/djangoapps/contentstore/features/component.feature
+2
-1
cms/djangoapps/contentstore/features/course-updates.py
+2
-4
cms/djangoapps/contentstore/features/grading.py
+1
-1
cms/djangoapps/contentstore/features/static-pages.py
+7
-7
cms/djangoapps/contentstore/features/upload.py
+6
-6
common/djangoapps/terrain/ui_helpers.py
+18
-3
No files found.
cms/djangoapps/contentstore/features/checklists.py
View file @
0be0df1b
...
...
@@ -115,7 +115,7 @@ def clickActionLink(checklist, task, actionText):
# text will be empty initially, wait for it to populate
def
verify_action_link_text
(
driver
):
return
action_link
.
text
==
actionText
return
world
.
css_text
(
'#course-checklist'
+
str
(
checklist
)
+
' a'
,
index
=
task
)
==
actionText
world
.
wait_for
(
verify_action_link_text
)
action_link
.
click
(
)
world
.
css_click
(
'#course-checklist'
+
str
(
checklist
)
+
' a'
,
index
=
task
)
cms/djangoapps/contentstore/features/component.feature
View file @
0be0df1b
Feature
:
Component Adding
As a course author, I want to be able to add a wide variety of components
@skip
Scenario
:
I
can add components
Given
I have opened a new course in studio
And
I am editing a new unit
...
...
@@ -41,7 +42,7 @@ Feature: Component Adding
|
Adaptive
Hint
|
|
Video
|
@skip
Scenario
:
I
can delete Components
Given
I have opened a new course in studio
And
I am editing a new unit
...
...
cms/djangoapps/contentstore/features/course-updates.py
View file @
0be0df1b
...
...
@@ -60,8 +60,7 @@ def change_date(_step, new_date):
@step
(
u'I should see the date "([^"]*)"$'
)
def
check_date
(
_step
,
date
):
date_css
=
'span.date-display'
date_html
=
world
.
css_find
(
date_css
)
assert
date
==
date_html
.
html
assert
date
==
world
.
css_html
(
date_css
)
@step
(
u'I modify the handout to "([^"]*)"$'
)
...
...
@@ -74,8 +73,7 @@ def edit_handouts(_step, text):
@step
(
u'I see the handout "([^"]*)"$'
)
def
check_handout
(
_step
,
handout
):
handout_css
=
'div.handouts-content'
handouts
=
world
.
css_find
(
handout_css
)
assert
handout
in
handouts
.
html
assert
handout
in
world
.
css_html
(
handout_css
)
def
change_text
(
text
):
...
...
cms/djangoapps/contentstore/features/grading.py
View file @
0be0df1b
...
...
@@ -47,7 +47,7 @@ def confirm_change(step):
range_css
=
'.range'
all_ranges
=
world
.
css_find
(
range_css
)
for
i
in
range
(
len
(
all_ranges
)):
assert
all_ranges
[
i
]
.
html
!=
'0-50'
assert
world
.
css_html
(
range_css
,
index
=
i
)
!=
'0-50'
@step
(
u'I change assignment type "([^"]*)" to "([^"]*)"$'
)
...
...
cms/djangoapps/contentstore/features/static-pages.py
View file @
0be0df1b
...
...
@@ -9,14 +9,14 @@ from selenium.webdriver.common.keys import Keys
def
go_to_static
(
_step
):
menu_css
=
'li.nav-course-courseware'
static_css
=
'li.nav-course-courseware-pages'
world
.
css_
find
(
menu_css
)
.
click
(
)
world
.
css_
find
(
static_css
)
.
click
(
)
world
.
css_
click
(
menu_css
)
world
.
css_
click
(
static_css
)
@step
(
u'I add a new page'
)
def
add_page
(
_step
):
button_css
=
'a.new-button'
world
.
css_
find
(
button_css
)
.
click
(
)
world
.
css_
click
(
button_css
)
@step
(
u'I should( not)? see a "([^"]*)" static page$'
)
...
...
@@ -33,13 +33,13 @@ def click_edit_delete(_step, edit_delete, page):
button_css
=
'a.
%
s-button'
%
edit_delete
index
=
get_index
(
page
)
assert
index
!=
-
1
world
.
css_
find
(
button_css
)[
index
]
.
click
(
)
world
.
css_
click
(
button_css
,
index
=
index
)
@step
(
u'I change the name to "([^"]*)"$'
)
def
change_name
(
_step
,
new_name
):
settings_css
=
'#settings-mode'
world
.
css_
find
(
settings_css
)
.
click
(
)
world
.
css_
click
(
settings_css
)
input_css
=
'input.setting-input'
name_input
=
world
.
css_find
(
input_css
)
old_name
=
name_input
.
value
...
...
@@ -47,13 +47,13 @@ def change_name(_step, new_name):
name_input
.
_element
.
send_keys
(
Keys
.
END
,
Keys
.
BACK_SPACE
)
name_input
.
_element
.
send_keys
(
new_name
)
save_button
=
'a.save-button'
world
.
css_
find
(
save_button
)
.
click
(
)
world
.
css_
click
(
save_button
)
def
get_index
(
name
):
page_name_css
=
'section[data-type="HTMLModule"]'
all_pages
=
world
.
css_find
(
page_name_css
)
for
i
in
range
(
len
(
all_pages
)):
if
all_pages
[
i
]
.
html
==
'
\n
{name}
\n
'
.
format
(
name
=
name
):
if
world
.
css_html
(
page_name_css
,
index
=
i
)
==
'
\n
{name}
\n
'
.
format
(
name
=
name
):
return
i
return
-
1
cms/djangoapps/contentstore/features/upload.py
View file @
0be0df1b
...
...
@@ -16,14 +16,14 @@ HTTP_PREFIX = "http://localhost:8001"
def
go_to_uploads
(
_step
):
menu_css
=
'li.nav-course-courseware'
uploads_css
=
'li.nav-course-courseware-uploads'
world
.
css_
find
(
menu_css
)
.
click
(
)
world
.
css_
find
(
uploads_css
)
.
click
(
)
world
.
css_
click
(
menu_css
)
world
.
css_
click
(
uploads_css
)
@step
(
u'I upload the file "([^"]*)"$'
)
def
upload_file
(
_step
,
file_name
):
upload_css
=
'a.upload-button'
world
.
css_
find
(
upload_css
)
.
click
(
)
world
.
css_
click
(
upload_css
)
file_css
=
'input.file-input'
upload
=
world
.
css_find
(
file_css
)
...
...
@@ -32,7 +32,7 @@ def upload_file(_step, file_name):
upload
.
_element
.
send_keys
(
os
.
path
.
abspath
(
path
))
close_css
=
'a.close-button'
world
.
css_
find
(
close_css
)
.
click
(
)
world
.
css_
click
(
close_css
)
@step
(
u'I should( not)? see the file "([^"]*)" was uploaded$'
)
...
...
@@ -67,7 +67,7 @@ def no_duplicate(_step, file_name):
all_names
=
world
.
css_find
(
names_css
)
only_one
=
False
for
i
in
range
(
len
(
all_names
)):
if
file_name
==
all_names
[
i
]
.
html
:
if
file_name
==
world
.
css_html
(
names_css
,
index
=
i
)
:
only_one
=
not
only_one
assert
only_one
...
...
@@ -100,7 +100,7 @@ def get_index(file_name):
names_css
=
'td.name-col > a.filename'
all_names
=
world
.
css_find
(
names_css
)
for
i
in
range
(
len
(
all_names
)):
if
file_name
==
all_names
[
i
]
.
html
:
if
file_name
==
world
.
css_html
(
names_css
,
index
=
i
)
:
return
i
return
-
1
...
...
common/djangoapps/terrain/ui_helpers.py
View file @
0be0df1b
...
...
@@ -153,21 +153,36 @@ def click_link(partial_text):
@world.absorb
def
css_text
(
css_selector
):
def
css_text
(
css_selector
,
index
=
0
):
# Wait for the css selector to appear
if
world
.
is_css_present
(
css_selector
):
try
:
return
world
.
browser
.
find_by_css
(
css_selector
)
.
first
.
text
return
world
.
browser
.
find_by_css
(
css_selector
)
[
index
]
.
text
except
StaleElementReferenceException
:
# The DOM was still redrawing. Wait a second and try again.
world
.
wait
(
1
)
return
world
.
browser
.
find_by_css
(
css_selector
)
.
first
.
text
return
world
.
browser
.
find_by_css
(
css_selector
)
[
index
]
.
text
else
:
return
""
@world.absorb
def
css_html
(
css_selector
,
index
=
0
,
max_attempts
=
5
):
"""
Returns the HTML of a css_selector and will retry if there is a StaleElementReferenceException
"""
assert
is_css_present
(
css_selector
)
attempt
=
0
while
attempt
<
max_attempts
:
try
:
return
world
.
browser
.
find_by_css
(
css_selector
)[
index
]
.
html
except
:
attempt
+=
1
return
''
@world.absorb
def
css_visible
(
css_selector
):
assert
is_css_present
(
css_selector
)
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