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
5411fc76
Commit
5411fc76
authored
Mar 20, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored lettuce test of capa problems to use
world.css_click() helper instead of directly calling splinter.
parent
28674761
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
12 deletions
+15
-12
common/djangoapps/terrain/steps.py
+13
-0
lms/djangoapps/courseware/features/problems.py
+2
-12
No files found.
common/djangoapps/terrain/steps.py
View file @
5411fc76
...
...
@@ -9,6 +9,7 @@ from bs4 import BeautifulSoup
import
time
import
re
import
os.path
from
selenium.common.exceptions
import
WebDriverException
from
logging
import
getLogger
logger
=
getLogger
(
__name__
)
...
...
@@ -214,3 +215,15 @@ def save_the_course_content(path='/tmp'):
f
=
open
(
'
%
s/
%
s'
%
(
path
,
filename
),
'w'
)
f
.
write
(
output
)
f
.
close
@world.absorb
def
css_click
(
css_selector
):
try
:
world
.
browser
.
find_by_css
(
css_selector
)
.
click
()
except
WebDriverException
:
# Occassionally, MathJax or other JavaScript can cover up
# an element temporarily.
# If this happens, wait a second, then try again
time
.
sleep
(
1
)
world
.
browser
.
find_by_css
(
css_selector
)
.
click
()
lms/djangoapps/courseware/features/problems.py
View file @
5411fc76
from
lettuce
import
world
,
step
from
lettuce.django
import
django_url
from
selenium.webdriver.support.ui
import
Select
from
selenium.common.exceptions
import
WebDriverException
import
random
import
textwrap
import
time
...
...
@@ -208,20 +206,12 @@ def answer_problem(step, problem_type, correctness):
@step
(
u'I check a problem'
)
def
check_problem
(
step
):
try
:
world
.
browser
.
find_by_css
(
"input.check"
)
.
click
()
except
WebDriverException
:
# Occassionally, MathJax or other JavaScript can cover up
# the 'Check' input temporarily.
# If this happens, wait a second, then try again
time
.
sleep
(
1
)
world
.
browser
.
find_by_css
(
"input.check"
)
.
click
()
world
.
css_click
(
"input.check"
)
@step
(
u'I reset the problem'
)
def
reset_problem
(
step
):
world
.
browser
.
find_by_css
(
'input.reset'
)
.
click
(
)
world
.
css_click
(
'input.reset'
)
@step
(
u'My "([^"]*)" answer is marked "([^"]*)"'
)
...
...
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