Skip to content

Commit 6beec0f

Browse files
committed
fix(tests): finesse element offset targets for drag-and-drop operations
1 parent f19ca4e commit 6beec0f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nested_admin/tests/drag_drop.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ def initialize_drag(self):
141141
document.documentElement.scrollTop += (top - 16);
142142
} else {
143143
el.scrollIntoView();
144+
top = el.getBoundingClientRect().top;
145+
if (top <= 15) {
146+
document.documentElement.scrollTop += (top - 16);
147+
}
144148
}
145149
""",
146150
source,
@@ -149,15 +153,15 @@ def initialize_drag(self):
149153

150154
(
151155
ActionChains(self.selenium)
152-
.move_to_element_with_offset(source, 5, 5)
156+
.move_to_element_with_offset(source, 3, 3)
153157
.click_and_hold()
154158
.perform()
155159
)
156160

157161
time.sleep(0.05)
158-
ActionChains(self.selenium).move_by_offset(0, -15).perform()
162+
ActionChains(self.selenium).move_by_offset(0, -10).perform()
159163
time.sleep(0.05)
160-
ActionChains(self.selenium).move_by_offset(0, 15).perform()
164+
ActionChains(self.selenium).move_by_offset(0, 10).perform()
161165

162166
with self.test_case.visible_selector(".ui-sortable-helper") as el:
163167
return el

0 commit comments

Comments
 (0)