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
9d1118ae
Commit
9d1118ae
authored
Sep 29, 2014
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed data-based scenarios and simplified test scenario preparation
parent
3e1567d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
192 deletions
+12
-192
tests/integration/data/drag_and_drop-whats_up.json
+0
-89
tests/integration/data/drag_and_drop_html-whats_up.json
+0
-89
tests/integration/test_base.py
+9
-10
tests/integration/test_block_parameters.py
+3
-4
No files found.
tests/integration/data/drag_and_drop-whats_up.json
deleted
100644 → 0
View file @
3e1567d8
{
"zones"
:
[
{
"index"
:
1
,
"width"
:
200
,
"title"
:
"Zone A"
,
"height"
:
100
,
"y"
:
"200"
,
"x"
:
"100"
,
"id"
:
"zone-1"
},
{
"index"
:
2
,
"width"
:
200
,
"title"
:
"Zone B"
,
"height"
:
100
,
"y"
:
0
,
"x"
:
0
,
"id"
:
"zone-2"
}
],
"items"
:
[
{
"displayName"
:
"A"
,
"feedback"
:
{
"incorrect"
:
"No A"
,
"correct"
:
"Yes A"
},
"zone"
:
"Zone A"
,
"backgroundImage"
:
""
,
"id"
:
0
,
"size"
:
{
"width"
:
"190px"
,
"height"
:
"auto"
}
},
{
"displayName"
:
"B"
,
"feedback"
:
{
"incorrect"
:
"No B"
,
"correct"
:
"Yes B"
},
"zone"
:
"Zone B"
,
"backgroundImage"
:
""
,
"id"
:
1
,
"size"
:
{
"width"
:
"190px"
,
"height"
:
"auto"
}
},
{
"displayName"
:
"X"
,
"feedback"
:
{
"incorrect"
:
""
,
"correct"
:
""
},
"zone"
:
"none"
,
"backgroundImage"
:
""
,
"id"
:
2
,
"size"
:
{
"width"
:
"100px"
,
"height"
:
"100px"
}
},
{
"displayName"
:
""
,
"feedback"
:
{
"incorrect"
:
""
,
"correct"
:
""
},
"zone"
:
"none"
,
"backgroundImage"
:
"http://i1.kym-cdn.com/entries/icons/square/000/006/151/tumblr_lltzgnHi5F1qzib3wo1_400.jpg"
,
"id"
:
3
,
"size"
:
{
"width"
:
"190px"
,
"height"
:
"auto"
}
}
],
"state"
:
{
"items"
:
{},
"finished"
:
true
},
"feedback"
:
{
"start"
:
"Intro Feed"
,
"finish"
:
"Final Feed"
},
"targetImg"
:
"http://i0.kym-cdn.com/photos/images/newsfeed/000/030/404/1260585284155.png"
}
tests/integration/data/drag_and_drop_html-whats_up.json
deleted
100644 → 0
View file @
3e1567d8
{
"zones"
:
[
{
"index"
:
1
,
"width"
:
200
,
"title"
:
"Zone <i>A</i>"
,
"height"
:
100
,
"y"
:
"200"
,
"x"
:
"100"
,
"id"
:
"zone-1"
},
{
"index"
:
2
,
"width"
:
200
,
"title"
:
"Zone <b>B</b>"
,
"height"
:
100
,
"y"
:
0
,
"x"
:
0
,
"id"
:
"zone-2"
}
],
"items"
:
[
{
"displayName"
:
"<b>A</b>"
,
"feedback"
:
{
"incorrect"
:
"No <b>A</b>"
,
"correct"
:
"Yes <b>A</b>"
},
"zone"
:
"Zone <i>A</i>"
,
"backgroundImage"
:
""
,
"id"
:
0
,
"size"
:
{
"width"
:
"190px"
,
"height"
:
"auto"
}
},
{
"displayName"
:
"<i>B</i>"
,
"feedback"
:
{
"incorrect"
:
"No <i>B</i>"
,
"correct"
:
"Yes <i>B</i>"
},
"zone"
:
"Zone <b>B</b>"
,
"backgroundImage"
:
""
,
"id"
:
1
,
"size"
:
{
"width"
:
"190px"
,
"height"
:
"auto"
}
},
{
"displayName"
:
"X"
,
"feedback"
:
{
"incorrect"
:
""
,
"correct"
:
""
},
"zone"
:
"none"
,
"backgroundImage"
:
""
,
"id"
:
2
,
"size"
:
{
"width"
:
"100px"
,
"height"
:
"100px"
}
},
{
"displayName"
:
""
,
"feedback"
:
{
"incorrect"
:
""
,
"correct"
:
""
},
"zone"
:
"none"
,
"backgroundImage"
:
"http://i1.kym-cdn.com/entries/icons/square/000/006/151/tumblr_lltzgnHi5F1qzib3wo1_400.jpg"
,
"id"
:
3
,
"size"
:
{
"width"
:
"190px"
,
"height"
:
"auto"
}
}
],
"state"
:
{
"items"
:
{},
"finished"
:
true
},
"feedback"
:
{
"start"
:
"Intro Feed"
,
"finish"
:
"Final <b>Feed</b>"
},
"targetImg"
:
"http://i0.kym-cdn.com/photos/images/newsfeed/000/030/404/1260585284155.png"
}
tests/integration/test_base.py
View file @
9d1118ae
# Imports ###########################################################
# Imports ###########################################################
from
xml.sax.saxutils
import
escape
from
workbench
import
scenarios
from
workbench
import
scenarios
from
workbench.test.selenium_test
import
SeleniumTest
from
workbench.test.selenium_test
import
SeleniumTest
from
tests.utils
import
load_scenarios_from_path
# Classes ###########################################################
# Classes ###########################################################
class
BaseIntegrationTest
(
SeleniumTest
):
class
BaseIntegrationTest
(
SeleniumTest
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -15,17 +14,18 @@ class BaseIntegrationTest(SeleniumTest):
...
@@ -15,17 +14,18 @@ class BaseIntegrationTest(SeleniumTest):
self
.
browser
.
get
(
self
.
live_server_url
)
# Needed to load scenarios once
self
.
browser
.
get
(
self
.
live_server_url
)
# Needed to load scenarios once
scenarios
.
SCENARIOS
.
clear
()
scenarios
.
SCENARIOS
.
clear
()
for
identifier
,
title
,
xml
in
self
.
_get_scenarios_for_test
():
scenarios
.
add_xml_scenario
(
identifier
,
title
,
xml
)
self
.
addCleanup
(
scenarios
.
remove_scenario
,
identifier
)
self
.
browser
.
get
(
self
.
live_server_url
)
self
.
browser
.
get
(
self
.
live_server_url
)
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
_get_scenarios_for_test
(
self
):
def
_make_scenario_xml
(
self
,
display_name
,
question_text
,
completed
):
return
load_scenarios_from_path
(
'integration/data'
)
return
"""
<vertical_demo>
<drag-and-drop-v2 display_name='{display_name}' question_text='{question_text}' weight='1' completed='{completed}'/>
</vertical_demo>
"""
.
format
(
display_name
=
escape
(
display_name
),
question_text
=
escape
(
question_text
),
completed
=
completed
)
def
go_to_page
(
self
,
page_name
,
css_selector
=
'section.xblock--drag-and-drop'
):
def
go_to_page
(
self
,
page_name
,
css_selector
=
'section.xblock--drag-and-drop'
):
"""
"""
...
@@ -47,4 +47,4 @@ class SingleScenarioIntegrationTest(BaseIntegrationTest):
...
@@ -47,4 +47,4 @@ class SingleScenarioIntegrationTest(BaseIntegrationTest):
def
_get_scenarios_for_test
(
self
):
def
_get_scenarios_for_test
(
self
):
identifier
,
title
,
scenario
=
self
.
_get_scenario_for_test
()
identifier
,
title
,
scenario
=
self
.
_get_scenario_for_test
()
self
.
_page_title
=
title
self
.
_page_title
=
title
return
[(
identifier
,
title
,
scenario
)]
return
[(
identifier
,
title
,
scenario
)]
\ No newline at end of file
tests/integration/test_block_parameters.py
View file @
9d1118ae
from
xml.sax.saxutils
import
escape
from
xml.sax.saxutils
import
escape
from
nose_parameterized
import
parameterized
from
nose_parameterized
import
parameterized
from
tests.utils
import
make_scenario_from_data
from
workbench
import
scenarios
from
workbench
import
scenarios
from
tests.integration.test_base
import
BaseIntegrationTest
from
tests.integration.test_base
import
BaseIntegrationTest
...
@@ -16,7 +15,7 @@ class TestBlockParameters(BaseIntegrationTest):
...
@@ -16,7 +15,7 @@ class TestBlockParameters(BaseIntegrationTest):
def
test_block_parameters
(
self
,
_
,
display_name
,
question_text
):
def
test_block_parameters
(
self
,
_
,
display_name
,
question_text
):
const_page_name
=
"Test block parameters"
const_page_name
=
"Test block parameters"
const_page_id
=
'test_block_title'
const_page_id
=
'test_block_title'
scenario_xml
=
make_scenario_from_data
(
None
,
display_name
,
question_text
,
False
)
scenario_xml
=
self
.
_make_scenario_xml
(
display_name
,
question_text
,
False
)
scenarios
.
add_xml_scenario
(
const_page_id
,
const_page_name
,
scenario_xml
)
scenarios
.
add_xml_scenario
(
const_page_id
,
const_page_name
,
scenario_xml
)
self
.
addCleanup
(
scenarios
.
remove_scenario
,
const_page_id
)
self
.
addCleanup
(
scenarios
.
remove_scenario
,
const_page_id
)
...
@@ -27,8 +26,8 @@ class TestBlockParameters(BaseIntegrationTest):
...
@@ -27,8 +26,8 @@ class TestBlockParameters(BaseIntegrationTest):
question
=
page
.
find_element_by_css_selector
(
"section.problem > p"
)
question
=
page
.
find_element_by_css_selector
(
"section.problem > p"
)
self
.
assertEqual
(
self
.
get_element_html
(
question
),
question_text
)
self
.
assertEqual
(
self
.
get_element_html
(
question
),
question_text
)
def
_get_scenario
s
_for_test
(
self
):
def
_get_scenario_for_test
(
self
):
return
[]
return
None
,
None
,
None
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