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
b757ff7d
Commit
b757ff7d
authored
Feb 05, 2016
by
Jillian Vogel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed string format , DRY ddt
parent
81af37f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
60 deletions
+19
-60
tests/integration/test_interaction.py
+19
-60
No files found.
tests/integration/test_interaction.py
View file @
b757ff7d
...
@@ -582,13 +582,14 @@ class MultipleBlocksDataInteraction(InteractionTestBase, BaseIntegrationTest):
...
@@ -582,13 +582,14 @@ class MultipleBlocksDataInteraction(InteractionTestBase, BaseIntegrationTest):
self
.
interact_with_keyboard_help
(
scroll_down
=
900
)
self
.
interact_with_keyboard_help
(
scroll_down
=
900
)
self
.
interact_with_keyboard_help
(
scroll_down
=
0
,
use_keyboard
=
True
)
self
.
interact_with_keyboard_help
(
scroll_down
=
0
,
use_keyboard
=
True
)
@ddt
class
ZoneAlignInteractionTest
(
InteractionTestBase
,
BaseIntegrationTest
):
class
ZoneAlignInteractionTest
(
InteractionTestBase
,
BaseIntegrationTest
):
"""
"""
Verifying Drag and Drop XBlock interactions using zone alignment.
Verifying Drag and Drop XBlock interactions using zone alignment.
"""
"""
PAGE_TITLE
=
'Drag and Drop v2'
PAGE_TITLE
=
'Drag and Drop v2'
PAGE_ID
=
'drag_and_drop_v2'
PAGE_ID
=
'drag_and_drop_v2'
ACTION_KEYS
=
(
None
,
Keys
.
RETURN
,
Keys
.
SPACE
,
Keys
.
CONTROL
+
'm'
,
Keys
.
COMMAND
+
'm'
)
def
setUp
(
self
):
def
setUp
(
self
):
super
(
ZoneAlignInteractionTest
,
self
)
.
setUp
()
super
(
ZoneAlignInteractionTest
,
self
)
.
setUp
()
...
@@ -606,7 +607,7 @@ class ZoneAlignInteractionTest(InteractionTestBase, BaseIntegrationTest):
...
@@ -606,7 +607,7 @@ class ZoneAlignInteractionTest(InteractionTestBase, BaseIntegrationTest):
self
.
assertEquals
(
self
.
_get_style
(
item_wrapper_selector
,
'textAlign'
),
align
)
self
.
assertEquals
(
self
.
_get_style
(
item_wrapper_selector
,
'textAlign'
),
align
)
# Items placed in zones with align setting are children of the zone
# Items placed in zones with align setting are children of the zone
zone_item_selector
=
'
%
s .option'
%
item_wrapper_selector
zone_item_selector
=
'
{item_wrapper_selector} .option'
.
format
(
item_wrapper_selector
=
item_wrapper_selector
)
prev_placed_items
=
self
.
_page
.
find_elements_by_css_selector
(
zone_item_selector
)
prev_placed_items
=
self
.
_page
.
find_elements_by_css_selector
(
zone_item_selector
)
self
.
place_item
(
item_id
,
zone_id
,
action_key
)
self
.
place_item
(
item_id
,
zone_id
,
action_key
)
...
@@ -650,61 +651,19 @@ class ZoneAlignInteractionTest(InteractionTestBase, BaseIntegrationTest):
...
@@ -650,61 +651,19 @@ class ZoneAlignInteractionTest(InteractionTestBase, BaseIntegrationTest):
self
.
assertRegexpMatches
(
self
.
_get_style
(
target_item_selector
,
'left'
),
r'^\d+(\.\d+)?px$'
)
self
.
assertRegexpMatches
(
self
.
_get_style
(
target_item_selector
,
'left'
),
r'^\d+(\.\d+)?px$'
)
self
.
assertRegexpMatches
(
self
.
_get_style
(
target_item_selector
,
'top'
),
r'^\d+(\.\d+)?px$'
)
self
.
assertRegexpMatches
(
self
.
_get_style
(
target_item_selector
,
'top'
),
r'^\d+(\.\d+)?px$'
)
def
test_zone_align_invalid
(
self
):
@data
(
"""
([
3
,
4
,
5
],
"Zone Invalid Align"
,
"start"
),
Test items placed in a zone with an invalid align setting.
([
6
,
7
,
8
],
"Zone Left Align"
,
"left"
),
"""
([
9
,
10
,
11
],
"Zone Right Align"
,
"right"
),
self
.
_assert_zone_align_item
(
3
,
'Zone Invalid Align'
,
'start'
)
([
12
,
13
,
14
],
"Zone Center Align"
,
"center"
),
self
.
_assert_zone_align_item
(
4
,
'Zone Invalid Align'
,
'start'
)
)
self
.
_assert_zone_align_item
(
5
,
'Zone Invalid Align'
,
'start'
)
@unpack
def
test_zone_align
(
self
,
items
,
zone
,
alignment
):
def
test_zone_align_invalid_key
(
self
):
reset
=
self
.
_get_reset_button
()
"""
for
item
in
items
:
Test items placed in a zone with an invalid align setting, via keyboard.
for
action_key
in
self
.
ACTION_KEYS
:
"""
self
.
_assert_zone_align_item
(
item
,
zone
,
alignment
,
action_key
)
self
.
_assert_zone_align_item
(
3
,
'Zone Invalid Align'
,
'start'
,
Keys
.
RETURN
)
# Reset exercise
self
.
_assert_zone_align_item
(
4
,
'Zone Invalid Align'
,
'start'
,
Keys
.
RETURN
)
self
.
scroll_down
(
pixels
=
200
)
self
.
_assert_zone_align_item
(
5
,
'Zone Invalid Align'
,
'start'
,
Keys
.
RETURN
)
reset
.
click
()
self
.
scroll_down
(
pixels
=
0
)
def
test_zone_align_left
(
self
):
"""
Test items placed in a zone with an left align setting.
"""
self
.
_assert_zone_align_item
(
6
,
'Zone Left Align'
,
'left'
)
self
.
_assert_zone_align_item
(
7
,
'Zone Left Align'
,
'left'
)
self
.
_assert_zone_align_item
(
8
,
'Zone Left Align'
,
'left'
)
def
test_zone_align_left_key
(
self
):
"""
Test items placed in a zone with an left align setting, via keyboard.
"""
self
.
_assert_zone_align_item
(
6
,
'Zone Left Align'
,
'left'
,
Keys
.
RETURN
)
self
.
_assert_zone_align_item
(
7
,
'Zone Left Align'
,
'left'
,
Keys
.
RETURN
)
self
.
_assert_zone_align_item
(
8
,
'Zone Left Align'
,
'left'
,
Keys
.
RETURN
)
def
test_zone_align_right
(
self
):
"""
Test items placed in a zone with a right align setting.
"""
self
.
_assert_zone_align_item
(
9
,
'Zone Right Align'
,
'right'
)
self
.
_assert_zone_align_item
(
10
,
'Zone Right Align'
,
'right'
)
self
.
_assert_zone_align_item
(
11
,
'Zone Right Align'
,
'right'
)
def
test_zone_align_right_key
(
self
):
"""
Test items placed in a zone with an right align setting, via keyboard.
"""
self
.
_assert_zone_align_item
(
9
,
'Zone Right Align'
,
'right'
,
Keys
.
RETURN
)
self
.
_assert_zone_align_item
(
10
,
'Zone Right Align'
,
'right'
,
Keys
.
RETURN
)
self
.
_assert_zone_align_item
(
11
,
'Zone Right Align'
,
'right'
,
Keys
.
RETURN
)
def
test_zone_align_center_key
(
self
):
"""
Test items placed in a zone with an center align setting, via keyboard.
note: Erratic bug in place_item(action_key=None) when there's too many zones?
Works consistently from keyboard and manual testing.
"""
self
.
_assert_zone_align_item
(
12
,
'Zone Center Align'
,
'center'
,
Keys
.
RETURN
)
self
.
_assert_zone_align_item
(
13
,
'Zone Center Align'
,
'center'
,
Keys
.
RETURN
)
self
.
_assert_zone_align_item
(
14
,
'Zone Center Align'
,
'center'
,
Keys
.
RETURN
)
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