Skip to content

Commit

Permalink
add Django-5 to test-matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Apr 12, 2024
1 parent 8f1e814 commit 98d1634
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions testapp/tests/test_e2e_optgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def test_many_counties(page, form, viewname):
assert selector.evaluate('elem => Array.from(elem.selectedOptions).map(o => o.value)') == expected


#@pytest.mark.xfail("Playwrite ")
@pytest.mark.urls(__name__)
@pytest.mark.parametrize('viewname', ['sortable_counties'])
def test_sortable_counties(page, form, viewname):
Expand All @@ -223,20 +224,20 @@ def test_sortable_counties(page, form, viewname):
expect(select_left.locator('option')).to_have_count(250)
expect(select_right.locator('optgroup')).to_have_count(0)
expect(select_right.locator('option')).to_have_count(0)
select_left.locator('optgroup:nth-child(6) option:first-child').click()
select_left.locator('optgroup:nth-child(6) option:last-child').click(modifiers=['Shift'])
select_left.locator('optgroup').nth(5).locator('option').first.click()
select_left.locator('optgroup').nth(5).locator('option').last.click(modifiers=['Shift'])
page.locator('django-formset button.dj-move-selected-right ').click()
expect(select_right.locator('optgroup')).to_have_count(1)
expect(select_right.locator('option')).to_have_count(5)
assert select_right.locator('optgroup').get_attribute('label') == "Colorado"
expect(select_right.locator('optgroup option:first-child')).to_have_text("Adams (CO)")
expect(select_right.locator('optgroup option:last-child')).to_have_text("Baca (CO)")
before = [select_right.locator(f'optgroup option:nth-child({i})').get_attribute('value') for i in range(1, 6)]
select_right.locator('optgroup:first-child option:last-child').drag_to(select_right.locator('optgroup:first-child option:first-child'))
select_right.locator('optgroup:first-child option:nth-child(2)').drag_to(select_right.locator('optgroup option:last-child'))
sleep(0.3) # Sortable.js has a delay of 300ms
after = [select_right.locator(f'optgroup option:nth-child({i})').get_attribute('value') for i in range(1, 6)]
before.insert(0, before.pop(4))
expect(select_right.locator('optgroup option').first).to_have_text("Adams (CO)")
expect(select_right.locator('optgroup option').last).to_have_text("Baca (CO)")
before = [select_right.locator('optgroup option').nth(i).get_attribute('value') for i in range(5)]
select_right.locator('optgroup').first.locator('option').last.drag_to(select_right.locator('optgroup').first.locator('option').first)
select_right.locator('optgroup').first.locator('option').nth(1).drag_to(select_right.locator('optgroup').locator('option').last)
sleep(0.4) # Sortable.js has a delay of 300ms
after = [select_right.locator('optgroup option').nth(i).get_attribute('value') for i in range(5)]
before.insert(0, before.pop(4)) # emulate dragging
before.append(before.pop(1))
assert after == before
assert selector.evaluate('elem => Array.from(elem.selectedOptions).map(o => o.value)') == after

0 comments on commit 98d1634

Please sign in to comment.