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
95a914db
Commit
95a914db
authored
Oct 07, 2014
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Impplemented review notes
parent
211cf90a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
15 deletions
+19
-15
tests/integration/data/test_data.json
+1
-2
tests/integration/data/test_html_data.json
+1
-2
tests/integration/test_base.py
+2
-1
tests/integration/test_custom_data_render.py
+0
-1
tests/integration/test_interaction.py
+4
-4
tests/integration/test_render.py
+11
-5
No files found.
tests/integration/data/test_data.json
View file @
95a914db
...
...
@@ -70,6 +70,5 @@
"feedback"
:
{
"start"
:
"Other Intro Feed"
,
"finish"
:
"Other Final Feed"
},
"targetImg"
:
"http://i0.kym-cdn.com/photos/images/newsfeed/000/030/404/1260585284155.png"
}
}
tests/integration/data/test_html_data.json
View file @
95a914db
...
...
@@ -70,6 +70,5 @@
"feedback"
:
{
"start"
:
"Intro <i>Feed</i>"
,
"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 @
95a914db
...
...
@@ -71,5 +71,5 @@ class BaseIntegrationTest(SeleniumTest):
def
get_element_classes
(
self
,
element
):
return
element
.
get_attribute
(
'class'
)
.
split
()
def
scroll_
by
(
self
,
y
):
def
scroll_
to
(
self
,
y
):
self
.
browser
.
execute_script
(
'window.scrollTo(0, {0})'
.
format
(
y
))
\ No newline at end of file
tests/integration/test_custom_data_render.py
View file @
95a914db
...
...
@@ -11,7 +11,6 @@ class TestCustomDataDragAndDropRendering(BaseIntegrationTest):
scenario_xml
=
self
.
_get_custom_scenario_xml
(
"integration/data/test_html_data.json"
)
self
.
_add_scenario
(
self
.
PAGE_ID
,
self
.
PAGE_TITLE
,
scenario_xml
)
self
.
browser
.
get
(
self
.
live_server_url
)
self
.
_page
=
self
.
go_to_page
(
self
.
PAGE_TITLE
)
header1
=
self
.
browser
.
find_element_by_css_selector
(
'h1'
)
...
...
tests/integration/test_interaction.py
View file @
95a914db
...
...
@@ -35,7 +35,7 @@ class InteractionTestFixture(BaseIntegrationTest):
return
"<vertical_demo><drag-and-drop-v2/></vertical_demo>"
@classmethod
def
_get_correct_item_
to
_zone
(
cls
):
def
_get_correct_item_
for
_zone
(
cls
):
return
{
item_key
:
definition
for
item_key
,
definition
in
cls
.
items_map
.
items
()
if
definition
.
zone_id
is
not
None
...
...
@@ -68,7 +68,7 @@ class InteractionTestFixture(BaseIntegrationTest):
def
test_correct_item_positive_feedback
(
self
):
feedback_popup
=
self
.
_page
.
find_element_by_css_selector
(
".popup-content"
)
for
definition
in
self
.
_get_correct_item_
to
_zone
()
.
values
():
for
definition
in
self
.
_get_correct_item_
for
_zone
()
.
values
():
self
.
drag_item_to_zone
(
definition
.
item_id
,
definition
.
zone_id
)
self
.
assertEqual
(
self
.
get_element_html
(
feedback_popup
),
definition
.
feedback_positive
)
...
...
@@ -86,7 +86,7 @@ class InteractionTestFixture(BaseIntegrationTest):
feedback_message
=
self
.
_get_feedback_message
()
self
.
assertEqual
(
self
.
get_element_html
(
feedback_message
),
self
.
feedback
[
'intro'
])
# precondition check
items
=
self
.
_get_correct_item_
to
_zone
()
items
=
self
.
_get_correct_item_
for
_zone
()
get_locations
=
lambda
:
{
item_id
:
self
.
_get_item_by_value
(
item_id
)
.
location
for
item_id
in
items
.
keys
()}
initial_locations
=
get_locations
()
...
...
@@ -99,7 +99,7 @@ class InteractionTestFixture(BaseIntegrationTest):
# scrolling to have `reset` visible, otherwise it does not receive a click
# this is due to xblock workbench header that consumes top 40px - selenium scrolls so page so that target
# element is a the very top.
self
.
scroll_
by
(
100
)
self
.
scroll_
to
(
100
)
reset
=
self
.
_page
.
find_element_by_css_selector
(
".reset-button"
)
reset
.
click
()
...
...
tests/integration/test_render.py
View file @
95a914db
...
...
@@ -17,6 +17,12 @@ class TestDragAndDropRender(BaseIntegrationTest):
self
.
browser
.
get
(
self
.
live_server_url
)
self
.
_page
=
self
.
go_to_page
(
self
.
PAGE_TITLE
)
def
_test_style
(
self
,
item
,
style_settings
):
style
=
item
.
get_attribute
(
'style'
)
for
style_prop
,
expected_value
in
style_settings
.
items
():
expected
=
u"{0}: {1}"
.
format
(
style_prop
,
expected_value
)
self
.
assertIn
(
expected
,
style
)
def
test_items
(
self
):
items
=
self
.
_get_items
()
...
...
@@ -24,18 +30,18 @@ class TestDragAndDropRender(BaseIntegrationTest):
self
.
assertEqual
(
items
[
0
]
.
get_attribute
(
'data-value'
),
'0'
)
self
.
assertEqual
(
items
[
0
]
.
text
,
'A'
)
self
.
assertEqual
(
items
[
0
]
.
get_attribute
(
'style'
),
u"width: 190px; height: auto;"
)
self
.
assertIn
(
'ui-draggable'
,
self
.
get_element_classes
(
items
[
0
]))
self
.
_test_style
(
items
[
0
],
{
'width'
:
'190px'
,
'height'
:
'auto'
})
self
.
assertEqual
(
items
[
1
]
.
get_attribute
(
'data-value'
),
'1'
)
self
.
assertEqual
(
items
[
1
]
.
text
,
'B'
)
self
.
assertEqual
(
items
[
1
]
.
get_attribute
(
'style'
),
u"width: 190px; height: auto;"
)
self
.
assertIn
(
'ui-draggable'
,
self
.
get_element_classes
(
items
[
1
]))
self
.
_test_style
(
items
[
1
],
{
'width'
:
'190px'
,
'height'
:
'auto'
})
self
.
assertEqual
(
items
[
2
]
.
get_attribute
(
'data-value'
),
'2'
)
self
.
assertEqual
(
items
[
2
]
.
text
,
'X'
)
self
.
assertEqual
(
items
[
2
]
.
get_attribute
(
'style'
),
u"width: 100px; height: 100px;"
)
self
.
assertIn
(
'ui-draggable'
,
self
.
get_element_classes
(
items
[
2
]))
self
.
_test_style
(
items
[
2
],
{
'width'
:
'100px'
,
'height'
:
'100px'
})
def
test_zones
(
self
):
zones
=
self
.
_get_zones
()
...
...
@@ -43,12 +49,12 @@ class TestDragAndDropRender(BaseIntegrationTest):
self
.
assertEqual
(
len
(
zones
),
2
)
self
.
assertEqual
(
zones
[
0
]
.
get_attribute
(
'data-zone'
),
'Zone A'
)
self
.
assertEqual
(
zones
[
0
]
.
get_attribute
(
'style'
),
u"top: 200px; left: 120px; width: 200px; height: 100px;"
)
self
.
assertIn
(
'ui-droppable'
,
self
.
get_element_classes
(
zones
[
0
]))
self
.
_test_style
(
zones
[
0
],
{
'top'
:
'200px'
,
'left'
:
'120px'
,
'width'
:
'200px'
,
'height'
:
'100px'
})
self
.
assertEqual
(
zones
[
1
]
.
get_attribute
(
'data-zone'
),
'Zone B'
)
self
.
assertEqual
(
zones
[
1
]
.
get_attribute
(
'style'
),
u"top: 360px; left: 120px; width: 200px; height: 100px;"
)
self
.
assertIn
(
'ui-droppable'
,
self
.
get_element_classes
(
zones
[
1
]))
self
.
_test_style
(
zones
[
1
],
{
'top'
:
'360px'
,
'left'
:
'120px'
,
'width'
:
'200px'
,
'height'
:
'100px'
})
def
test_feedback
(
self
):
feedback_message
=
self
.
_get_feedback_message
()
...
...
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