Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests for Modern Image Formats are failing on WP trunk #1634

Closed
westonruter opened this issue Nov 5, 2024 · 4 comments · Fixed by #1635
Closed

Unit tests for Modern Image Formats are failing on WP trunk #1634

westonruter opened this issue Nov 5, 2024 · 4 comments · Fixed by #1635
Assignees
Labels
[Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) [Type] Bug An existing feature is broken

Comments

@westonruter
Copy link
Member

There are currently 10 unit tests for Modern Image Formats which are failing on trunk:

There were 10 failures:
1) Test_WebP_Uploads_Image_Edit::test_it_should_restore_the_sources_array_from_the_backup_when_an_image_is_edited
Failed asserting that an image doesn't have the source with the "image/jpeg" mime type.

/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/data/class-testcase.php:48
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-image-edit.php:80

2) Test_WebP_Uploads_Load::test_it_should_not_create_the_original_mime_type_for_jpeg_images with data set "webp" ('webp')
Failed asserting that an image doesn't have the source with the "image/jpeg" mime type.

/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/data/class-testcase.php:48
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-load.php:58

3) Test_WebP_Uploads_Load::test_it_should_not_create_the_original_mime_type_for_jpeg_images with data set "avif" ('avif')
Failed asserting that an image doesn't have the source with the "image/jpeg" mime type.

/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/data/class-testcase.php:48
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-load.php:58

4) Test_WebP_Uploads_Load::test_it_should_create_a_webp_version_with_all_the_required_properties
Failed asserting that an image doesn't have the source with the "image/jpeg" mime type.

/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/data/class-testcase.php:48
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-load.php:266

5) Test_WebP_Uploads_Load::test_it_should_create_the_full_size_images_when_no_size_is_available
Failed asserting that an image doesn't have the source with the "image/jpeg" mime type.

/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/data/class-testcase.php:48
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-load.php:288

6) Test_WebP_Uploads_Load::test_it_should_remove_the_generated_webp_images_when_the_attachment_is_deleted
Failed asserting that file "/var/www/html/wp-content/uploads/2024/11/leaves-61-1080x720-webp.webp" does not exist.

/var/www/html/wp-content/plugins/performance/vendor/yoast/phpunit-polyfills/src/Polyfills/AssertionRenames.php:113
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-load.php:347

7) Test_WebP_Uploads_Load::test_it_should_remove_the_attached_webp_version_if_the_attachment_is_force_deleted
Failed asserting that file "/var/www/html/wp-content/uploads/2024/11/leaves-61-1080x720-webp.webp" does not exist.

/var/www/html/wp-content/plugins/performance/vendor/yoast/phpunit-polyfills/src/Polyfills/AssertionRenames.php:113
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-load.php:372

8) Test_WebP_Uploads_Load::test_it_should_remove_full_size_images_when_no_size_image_exists
Failed asserting that file "/var/www/html/wp-content/uploads/2024/11/leaves-61-1080x720-webp.webp" does not exist.

/var/www/html/wp-content/plugins/performance/vendor/yoast/phpunit-polyfills/src/Polyfills/AssertionRenames.php:113
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-load.php:395

9) Test_WebP_Uploads_Load::test_it_should_allow_the_upload_of_a_webp_image_if_at_least_one_editor_supports_the_format with data set "webp" ('webp')
Failed asserting that an image doesn't have the source with the "image/jpeg" mime type.

/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/data/class-testcase.php:48
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-load.php:709

10) Test_WebP_Uploads_Load::test_it_should_allow_the_upload_of_a_webp_image_if_at_least_one_editor_supports_the_format with data set "avif" ('avif')
Failed asserting that an image doesn't have the source with the "image/jpeg" mime type.

/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/data/class-testcase.php:48
/var/www/html/wp-content/plugins/performance/plugins/webp-uploads/tests/test-load.php:709

These tests aren't failing on 6.7-branch, so something has been committed to trunk (6.8-alpha) that is causing this failure.

@westonruter westonruter added [Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) [Type] Bug An existing feature is broken labels Nov 5, 2024
@westonruter westonruter added this to the webp-uploads n.e.x.t milestone Nov 5, 2024
@github-project-automation github-project-automation bot moved this to Not Started/Backlog 📆 in WP Performance 2024 Nov 5, 2024
@westonruter westonruter moved this from Not Started/Backlog 📆 to To Do 🔧 in WP Performance 2024 Nov 5, 2024
@mukeshpanchal27
Copy link
Member

mukeshpanchal27 commented Nov 5, 2024

The changes in [59317] have caused a unit test error in trunk, and this will also be backported to 6.7, so we can expect the same test error in the 6.7 branch shortly.

I’ve posted a comment on the ticket and hope Andrew will review it soon.

@azaozz
Copy link

azaozz commented Nov 5, 2024

Thanks for the ping!

If I'm not mistaken these tests confirm that originally uploaded image is not converted as expected, only the sub-sizes are? If that's the case thinking the tests can be fixed to confirm that this core bug is now fixed. See https://core.trac.wordpress.org/ticket/62305#comment:28.

@adamsilverstein
Copy link
Member

adamsilverstein commented Nov 6, 2024

If I'm not mistaken these tests confirm that originally uploaded image is not converted as expected,

Right, after this change this behavior is changed so the tests may need updating. Some manual testing would be good too to verify the behavior for JPEG->WebP or AVIF conversion (the changeset focused on HEIC->JPEG conversion)

@mukeshpanchal27 mukeshpanchal27 moved this from In Progress 🚧 to Code Review 👀 in WP Performance 2024 Nov 6, 2024
@github-project-automation github-project-automation bot moved this from Code Review 👀 to Done 😃 in WP Performance 2024 Nov 8, 2024
@azaozz
Copy link

azaozz commented Nov 8, 2024

to verify the behavior for JPEG->WebP

@adamsilverstein Yeah, seems plugins that add conversion settings would need to be updated to account for all supported image types in core. Adding just JPEG -> WebP won't convert HEIF images to WebP. See https://core.trac.wordpress.org/ticket/62365.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) [Type] Bug An existing feature is broken
Projects
Status: Done 😃
4 participants