Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-utils
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
xblock-utils
Commits
a0e77eeb
Commit
a0e77eeb
authored
Apr 30, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16 from edx/braden/test-improvements
Minor improvements to test base classes
parents
b2a17fa3
2d6f9796
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
xblockutils/base_test.py
+7
-3
No files found.
xblockutils/base_test.py
View file @
a0e77eeb
...
@@ -49,6 +49,11 @@ class SeleniumXBlockTest(SeleniumTest):
...
@@ -49,6 +49,11 @@ class SeleniumXBlockTest(SeleniumTest):
import
workbench.views
import
workbench.views
workbench
.
views
.
handler
.
csrf_exempt
=
True
workbench
.
views
.
handler
.
csrf_exempt
=
True
def
wait_until_visible
(
self
,
elem
):
""" Wait until the given element is visible """
wait
=
WebDriverWait
(
elem
,
self
.
timeout
)
wait
.
until
(
lambda
e
:
e
.
is_displayed
(),
u"{} should be visible"
.
format
(
elem
.
text
))
def
wait_until_hidden
(
self
,
elem
):
def
wait_until_hidden
(
self
,
elem
):
""" Wait until the DOM element elem is hidden """
""" Wait until the DOM element elem is hidden """
wait
=
WebDriverWait
(
elem
,
self
.
timeout
)
wait
=
WebDriverWait
(
elem
,
self
.
timeout
)
...
@@ -89,7 +94,7 @@ class SeleniumXBlockTest(SeleniumTest):
...
@@ -89,7 +94,7 @@ class SeleniumXBlockTest(SeleniumTest):
SCENARIOS
.
clear
()
SCENARIOS
.
clear
()
add_xml_scenario
(
"test"
,
"Test Scenario"
,
xml
)
add_xml_scenario
(
"test"
,
"Test Scenario"
,
xml
)
def
go_to_view
(
self
,
view_name
=
'student_view'
,
student_id
=
None
):
def
go_to_view
(
self
,
view_name
=
'student_view'
,
student_id
=
"student_1"
):
"""
"""
Navigate to the page `page_name`, as listed on the workbench home
Navigate to the page `page_name`, as listed on the workbench home
Returns the DOM element on the visited page located by the `css_selector`
Returns the DOM element on the visited page located by the `css_selector`
...
@@ -100,13 +105,12 @@ class SeleniumXBlockTest(SeleniumTest):
...
@@ -100,13 +105,12 @@ class SeleniumXBlockTest(SeleniumTest):
self
.
browser
.
get
(
url
)
self
.
browser
.
get
(
url
)
return
self
.
browser
.
find_element_by_css_selector
(
'.workbench .preview > div.xblock-v1:first-child'
)
return
self
.
browser
.
find_element_by_css_selector
(
'.workbench .preview > div.xblock-v1:first-child'
)
def
load_root_xblock
(
self
):
def
load_root_xblock
(
self
,
student_id
=
"student_1"
):
"""
"""
Load (in Python) the XBlock at the root of the current scenario.
Load (in Python) the XBlock at the root of the current scenario.
"""
"""
dom_node
=
self
.
browser
.
find_element_by_css_selector
(
'.workbench .preview > div.xblock-v1:first-child'
)
dom_node
=
self
.
browser
.
find_element_by_css_selector
(
'.workbench .preview > div.xblock-v1:first-child'
)
usage_id
=
dom_node
.
get_attribute
(
'data-usage'
)
usage_id
=
dom_node
.
get_attribute
(
'data-usage'
)
student_id
=
"none"
runtime
=
WorkbenchRuntime
(
student_id
)
runtime
=
WorkbenchRuntime
(
student_id
)
return
runtime
.
get_block
(
usage_id
)
return
runtime
.
get_block
(
usage_id
)
...
...
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