-
Notifications
You must be signed in to change notification settings - Fork 63
Add a fallback for broken provider image #1493
Conversation
Storybook and Tailwind configuration previews: Ready Storybook: https://wordpress.github.io/openverse-frontend/1493 Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again. You can check the GitHub pages deployment action list to see the current status of the deployments. |
Size Change: -751 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could accomplish this using just CSS: https://stackoverflow.com/a/33959259
It may even have the extra benefit of preventing people from trying to download the image from Openverse instead of visiting the provider directly for it (though I can't decide if that's a dark pattern for us to implement).
I'm fine with the JS solution you've taken here but if we can do it without JavaScript that would be great 🙂
Based on the medium urgency of this PR, the following reviewers are being This reminder is being automatically generated due to the urgency configuration. @obulat, if this PR is not ready for a review, please draft it to prevent reviewers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really good. Hopefully it will eliminate flakiness.
Fixes
Related to WordPress/openverse#615 by @obulat
Description
We are currently requesting provider media during the Playwright tests to render single image detail and audio detail pages. This creates flaky and slow tests. Until we create a solution to proxy those requests, we can block or mock the provider media requests entirely.
Blocking the provider media requests would result in a broken image on the image detail page during Playwright tests. To prevent this, this PR adds the logic to replace the provider image with the thumbnail on load error. Since the thumbnails have the same dimensions as the provider image they allow us to test that the different dimensions are treated correctly).
Testing Instructions
Search for 'birds', and open the first image result. Block the requests to 'Flickr', and reload the image.
![Screen Shot 2022-06-08 at 11 17 21 AM](https://user-images.githubusercontent.com/15233243/172583355-2362936a-9e3a-476b-8e63-545a780e2e93.png)
Visually, the page should be the same as before, but it should be using the 'thumbnail' from our API as the main image.
Also, try blocking the main thumbnail image. You should see the error image placeholder.
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin