Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-drag-and-drop-v2
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
OpenEdx
xblock-drag-and-drop-v2
Commits
522a3c8e
Commit
522a3c8e
authored
Sep 29, 2014
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integration test for display_name and question text
parent
7635328f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
6 deletions
+36
-6
tests/integration/test_base.py
+6
-4
tests/integration/test_block_parameters.py
+30
-2
No files found.
tests/integration/test_base.py
View file @
522a3c8e
...
@@ -28,12 +28,14 @@ class BaseIntegrationTest(SeleniumTest):
...
@@ -28,12 +28,14 @@ class BaseIntegrationTest(SeleniumTest):
header1
=
self
.
browser
.
find_element_by_css_selector
(
'h1'
)
header1
=
self
.
browser
.
find_element_by_css_selector
(
'h1'
)
self
.
assertEqual
(
header1
.
text
,
'XBlock scenarios'
)
self
.
assertEqual
(
header1
.
text
,
'XBlock scenarios'
)
def
go_to_page
(
self
,
page_name
,
css_selector
=
'
div.mentoring
'
):
def
go_to_page
(
self
,
page_name
,
css_selector
=
'
section.xblock--drag-and-drop
'
):
"""
"""
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`
"""
"""
self
.
browser
.
get
(
self
.
live_server_url
)
self
.
browser
.
get
(
self
.
live_server_url
)
self
.
browser
.
find_element_by_link_text
(
page_name
)
.
click
()
self
.
browser
.
find_element_by_link_text
(
page_name
)
.
click
()
mentoring
=
self
.
browser
.
find_element_by_css_selector
(
css_selector
)
return
self
.
browser
.
find_element_by_css_selector
(
css_selector
)
return
mentoring
\ No newline at end of file
def
get_element_html
(
self
,
element
):
return
element
.
get_attribute
(
'innerHTML'
)
.
strip
()
\ No newline at end of file
tests/integration/test_block_parameters.py
View file @
522a3c8e
from
xml.sax.saxutils
import
escape
from
nose_parameterized
import
parameterized
from
workbench
import
scenarios
from
tests.integration.test_base
import
BaseIntegrationTest
from
tests.integration.test_base
import
BaseIntegrationTest
class
TestBlockParameters
(
BaseIntegrationTest
):
class
TestBlockParameters
(
BaseIntegrationTest
):
def
test_test
(
self
):
@parameterized.expand
([
pass
(
"plain1"
,
'title1'
,
'question1'
),
(
"plain2"
,
'title2'
,
'question2'
),
(
"html1"
,
'title with <b>HTML</b>'
,
'<span style="color:red">Span title</span>'
),
(
"html2"
,
'Q: <b>HTML</b>?'
,
'<span style="color:red">Span question</span>'
),
])
def
test_block_parameters
(
self
,
_
,
display_name
,
question_text
):
const_page_name
=
"Test block parameters"
const_page_id
=
'test_block_title'
scenarios
.
add_xml_scenario
(
const_page_id
,
const_page_name
,
"""
<vertical_demo><drag-and-drop-v2
display_name='{display_name}' question_text='{question_text}'
/></vertical_demo>
"""
.
format
(
display_name
=
escape
(
display_name
),
question_text
=
escape
(
question_text
))
)
self
.
addCleanup
(
scenarios
.
remove_scenario
,
const_page_id
)
page
=
self
.
go_to_page
(
const_page_name
)
problem_header
=
page
.
find_element_by_css_selector
(
'h2.problem-header'
)
self
.
assertEqual
(
self
.
get_element_html
(
problem_header
),
display_name
)
question
=
page
.
find_element_by_css_selector
(
"section.problem > p"
)
self
.
assertEqual
(
self
.
get_element_html
(
question
),
question_text
)
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