|
1 | 1 | import pytest
|
| 2 | +from time import sleep |
2 | 3 | from playwright.sync_api import expect
|
3 | 4 |
|
4 | 5 | from testapp.models import Book
|
@@ -69,15 +70,12 @@ def test_drag_down(adminpage, slug, direction, chapter, drag_selector):
|
69 | 70 | expect_fieldset_is_ordered(group_locator, direction)
|
70 | 71 | start_order = get_start_order(direction)
|
71 | 72 | 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}} |
75 | 74 | drag_handle = group_locator.locator(f'{chapter}_set-0 {drag_selector}')
|
76 | 75 | 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)) |
81 | 79 | expect(group_locator.locator(f'{chapter}_set-1 input._reorder_')).to_have_value(str(start_order))
|
82 | 80 | expect_fieldset_is_ordered(group_locator, direction)
|
83 | 81 |
|
|
0 commit comments