Skip to content

Commit cb4c77e

Browse files
committed
fix failing unit test for Django-5.0
1 parent f96d940 commit cb4c77e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

testapp/test_e2e_inline.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from time import sleep
23
from playwright.sync_api import expect
34

45
from testapp.models import Book
@@ -69,15 +70,12 @@ def test_drag_down(adminpage, slug, direction, chapter, drag_selector):
6970
expect_fieldset_is_ordered(group_locator, direction)
7071
start_order = get_start_order(direction)
7172
expect(group_locator.locator(f'{chapter}_set-0 input._reorder_')).to_have_value(str(start_order))
72-
if slug in ['book6']:
73-
adminpage.screenshot(path=f'../workdir/screenshot-{slug}-before.png')
74-
drag_kwargs = {'source_position': {'x': 200, 'y': 10}, 'target_position': {'x': 200, 'y': 10}}
73+
drag_kwargs = {'source_position': {'x': 190, 'y': 9}, 'target_position': {'x': 200, 'y': 10}}
7574
drag_handle = group_locator.locator(f'{chapter}_set-0 {drag_selector}')
7675
expect(drag_handle).to_be_visible()
77-
drag_handle.drag_to(group_locator.locator(f'{chapter}_set-4'), **drag_kwargs)
78-
if slug in ['book6']:
79-
adminpage.screenshot(path=f'../workdir/screenshot-{slug}-after.png')
80-
expect(group_locator.locator(f'{chapter}_set-0 input._reorder_')).to_have_value(str(start_order + direction * 4))
76+
drag_handle.drag_to(group_locator.locator(f'{chapter}_set-3'), **drag_kwargs)
77+
sleep(0.3) # sortablejs needs some time to update the order
78+
expect(group_locator.locator(f'{chapter}_set-0 input._reorder_')).to_have_value(str(start_order + direction * 3))
8179
expect(group_locator.locator(f'{chapter}_set-1 input._reorder_')).to_have_value(str(start_order))
8280
expect_fieldset_is_ordered(group_locator, direction)
8381

0 commit comments

Comments
 (0)