Skip to content

Commit

Permalink
fix test test_e2e_upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Jan 17, 2025
1 parent 55196d3 commit 98fa148
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions testapp/tests/test_e2e_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def test_upload_image(page, mocker, settings, viewname):
expect(choose_file_button).to_be_visible() # that button would open the file selector
dropbox = page.locator('django-formset .dj-form figure.dj-dropbox')
expect(dropbox.locator('div.dj-empty-item')).to_have_text("Drag file here")
expect(dropbox.locator('img')).not_to_be_visible()
page.set_input_files('#id_avatar', 'testapp/assets/python-django.png')
img_element = dropbox.locator('img')
expect(img_element).to_be_visible()
img_element = dropbox.locator('img[src^="/media/"]')
img_src = img_element.get_attribute('src')
match = re.match(r'^/media/((upload_temp/python-django[_A-Za-z0-9]*?)_h128(.png))$', img_src)
match = re.match(r'^/media/((upload_temp/python-django[_A-Za-z0-9]*?)_h\d+(.png))$', img_src)
assert match is not None
thumbnail_url = match.group(1)
assert (settings.MEDIA_ROOT / thumbnail_url).exists() # the thumbnail
Expand Down

0 comments on commit 98fa148

Please sign in to comment.