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
6298a4ce
Commit
6298a4ce
authored
Mar 26, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed lettuce tests in cms that were broken in the last rebase
parent
0500ba4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
24 deletions
+30
-24
cms/djangoapps/contentstore/features/checklists.py
+16
-12
cms/djangoapps/contentstore/features/course-settings.py
+14
-12
No files found.
cms/djangoapps/contentstore/features/checklists.py
View file @
6298a4ce
#pylint: disable=C0111
#pylint: disable=W0621
from
lettuce
import
world
,
step
from
common
import
*
from
nose.tools
import
assert_true
,
assert_equal
from
terrain.steps
import
reload_the_page
from
selenium.common.exceptions
import
StaleElementReferenceException
############### ACTIONS ####################
@step
(
'I select Checklists from the Tools menu$'
)
def
i_select_checklists
(
step
):
expand_icon_css
=
'li.nav-course-tools i.icon-expand'
if
world
.
browser
.
is_element_present_by_css
(
expand_icon_css
):
css_click
(
expand_icon_css
)
world
.
css_click
(
expand_icon_css
)
link_css
=
'li.nav-course-tools-checklists a'
css_click
(
link_css
)
world
.
css_click
(
link_css
)
@step
(
'I have opened Checklists$'
)
...
...
@@ -20,7 +24,7 @@ def i_have_opened_checklists(step):
@step
(
'I see the four default edX checklists$'
)
def
i_see_default_checklists
(
step
):
checklists
=
css_find
(
'.checklist-title'
)
checklists
=
world
.
css_find
(
'.checklist-title'
)
assert_equal
(
4
,
len
(
checklists
))
assert_true
(
checklists
[
0
]
.
text
.
endswith
(
'Getting Started With Studio'
))
assert_true
(
checklists
[
1
]
.
text
.
endswith
(
'Draft a Rough Course Outline'
))
...
...
@@ -58,7 +62,7 @@ def i_select_a_link_to_the_course_outline(step):
@step
(
'I am brought to the course outline page$'
)
def
i_am_brought_to_course_outline
(
step
):
assert_equal
(
'Course Outline'
,
css_find
(
'.outline .title-1'
)[
0
]
.
text
)
assert_equal
(
'Course Outline'
,
world
.
css_find
(
'.outline .title-1'
)[
0
]
.
text
)
assert_equal
(
1
,
len
(
world
.
browser
.
windows
))
...
...
@@ -90,30 +94,30 @@ def i_am_brought_to_help_page_in_new_window(step):
def
verifyChecklist2Status
(
completed
,
total
,
percentage
):
def
verify_count
(
driver
):
try
:
statusCount
=
css_find
(
'#course-checklist1 .status-count'
)
.
first
statusCount
=
world
.
css_find
(
'#course-checklist1 .status-count'
)
.
first
return
statusCount
.
text
==
str
(
completed
)
except
StaleElementReferenceException
:
return
False
wait_for
(
verify_count
)
assert_equal
(
str
(
total
),
css_find
(
'#course-checklist1 .status-amount'
)
.
first
.
text
)
w
orld
.
w
ait_for
(
verify_count
)
assert_equal
(
str
(
total
),
world
.
css_find
(
'#course-checklist1 .status-amount'
)
.
first
.
text
)
# Would like to check the CSS width, but not sure how to do that.
assert_equal
(
str
(
percentage
),
css_find
(
'#course-checklist1 .viz-checklist-status-value .int'
)
.
first
.
text
)
assert_equal
(
str
(
percentage
),
world
.
css_find
(
'#course-checklist1 .viz-checklist-status-value .int'
)
.
first
.
text
)
def
toggleTask
(
checklist
,
task
):
css_click
(
'#course-checklist'
+
str
(
checklist
)
+
'-task'
+
str
(
task
))
world
.
css_click
(
'#course-checklist'
+
str
(
checklist
)
+
'-task'
+
str
(
task
))
def
clickActionLink
(
checklist
,
task
,
actionText
):
# toggle checklist item to make sure that the link button is showing
toggleTask
(
checklist
,
task
)
action_link
=
css_find
(
'#course-checklist'
+
str
(
checklist
)
+
' a'
)[
task
]
action_link
=
world
.
css_find
(
'#course-checklist'
+
str
(
checklist
)
+
' a'
)[
task
]
# text will be empty initially, wait for it to populate
def
verify_action_link_text
(
driver
):
return
action_link
.
text
==
actionText
wait_for
(
verify_action_link_text
)
w
orld
.
w
ait_for
(
verify_action_link_text
)
action_link
.
click
()
cms/djangoapps/contentstore/features/course-settings.py
View file @
6298a4ce
#pylint: disable=C0111
#pylint: disable=W0621
from
lettuce
import
world
,
step
from
common
import
*
from
terrain.steps
import
reload_the_page
from
selenium.webdriver.common.keys
import
Keys
import
time
...
...
@@ -25,9 +27,9 @@ DEFAULT_TIME = "12:00am"
def
test_i_select_schedule_and_details
(
step
):
expand_icon_css
=
'li.nav-course-settings i.icon-expand'
if
world
.
browser
.
is_element_present_by_css
(
expand_icon_css
):
css_click
(
expand_icon_css
)
world
.
css_click
(
expand_icon_css
)
link_css
=
'li.nav-course-settings-schedule a'
css_click
(
link_css
)
world
.
css_click
(
link_css
)
@step
(
'I have set course dates$'
)
...
...
@@ -97,9 +99,9 @@ def test_i_clear_the_course_start_date(step):
@step
(
'I receive a warning about course start date$'
)
def
test_i_receive_a_warning_about_course_start_date
(
step
):
assert_
css_with_text
(
'.message-error'
,
'The course must have an assigned start date.'
)
assert_true
(
'error'
in
css_find
(
COURSE_START_DATE_CSS
)
.
first
.
_element
.
get_attribute
(
'class'
))
assert_true
(
'error'
in
css_find
(
COURSE_START_TIME_CSS
)
.
first
.
_element
.
get_attribute
(
'class'
))
assert_
true
(
world
.
css_has_text
(
'.message-error'
,
'The course must have an assigned start date.'
)
)
assert_true
(
'error'
in
world
.
css_find
(
COURSE_START_DATE_CSS
)
.
first
.
_element
.
get_attribute
(
'class'
))
assert_true
(
'error'
in
world
.
css_find
(
COURSE_START_TIME_CSS
)
.
first
.
_element
.
get_attribute
(
'class'
))
@step
(
'The previously set start date is shown on refresh$'
)
...
...
@@ -124,9 +126,9 @@ def test_i_have_entered_a_new_course_start_date(step):
@step
(
'The warning about course start date goes away$'
)
def
test_the_warning_about_course_start_date_goes_away
(
step
):
assert_equal
(
0
,
len
(
css_find
(
'.message-error'
)))
assert_false
(
'error'
in
css_find
(
COURSE_START_DATE_CSS
)
.
first
.
_element
.
get_attribute
(
'class'
))
assert_false
(
'error'
in
css_find
(
COURSE_START_TIME_CSS
)
.
first
.
_element
.
get_attribute
(
'class'
))
assert_equal
(
0
,
len
(
world
.
css_find
(
'.message-error'
)))
assert_false
(
'error'
in
world
.
css_find
(
COURSE_START_DATE_CSS
)
.
first
.
_element
.
get_attribute
(
'class'
))
assert_false
(
'error'
in
world
.
css_find
(
COURSE_START_TIME_CSS
)
.
first
.
_element
.
get_attribute
(
'class'
))
@step
(
'My new course start date is shown on refresh$'
)
...
...
@@ -142,8 +144,8 @@ def set_date_or_time(css, date_or_time):
"""
Sets date or time field.
"""
css_fill
(
css
,
date_or_time
)
e
=
css_find
(
css
)
.
first
world
.
css_fill
(
css
,
date_or_time
)
e
=
world
.
css_find
(
css
)
.
first
# hit Enter to apply the changes
e
.
_element
.
send_keys
(
Keys
.
ENTER
)
...
...
@@ -152,7 +154,7 @@ def verify_date_or_time(css, date_or_time):
"""
Verifies date or time field.
"""
assert_equal
(
date_or_time
,
css_find
(
css
)
.
first
.
value
)
assert_equal
(
date_or_time
,
world
.
css_find
(
css
)
.
first
.
value
)
def
pause
():
...
...
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