-
Notifications
You must be signed in to change notification settings - Fork 234
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
Add new ImagePlaceholderAmp psammead component #8914
Conversation
…into amp-img-placeholder
When bumping The classes are basically rendering without the emotion styled suffix at the end, this can be shown by running However when running the dev server with |
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'm a bit concerned that this has added an extra 20 seconds to run the unit tests on my local machine against the main branch. Would be nice if people could check this on their machines as well.
I think this is due to the image placeholder component adding 6 amp fallback/placeholder images for each image on the page and snapshots like frontpage
with loads of images where each one has an extra 6 images added to it takes longer for jest to make it's comparisons. The snapshot's don't reflect the implementation, as each amp image is fetched and rendered based on screen size, meaning each image will have one fallback and one placeholder amp image not 6.
What are peoples thoughts on this? We could just go for the quick and easy fix here: #8811 (comment)
Just quickly thinking about this, I'd say the problem is us using snapshots to capture whole pages for tests. The fact we have an issue with our tests shouldn't influence the fix we choose imo. I'd suggest investigating alternatives to the affected tests and very seriously considering removing some as I don't think they add a lot of value. |
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.
As discussed imo adding 20 seconds to the tests is not critical but we should follow up straightaway with a PR to remove/replace the full page snapshot tests that are affected by this change.
@@ -42,6 +45,10 @@ const ImageWithPlaceholder = ({ | |||
<Image onLoad={() => setIsLoaded(true)} {...imageProps} /> | |||
); | |||
|
|||
const AmpImgWrapper = styled.div` | |||
position: relative; |
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.
what is this css needed for?
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.
Raise psammead PR as discussed to move this into psammead after merge
@HarveyPeachey In the original issue the example for this is on live. Do you have a local asset with which I can check if this has been fixed? Or a test asset to check it if we put it on test first? |
Resolves #8811
Overall change:
Uses new ImagePlaceholderAmp component
Code changes:
ImageWithPlaceholder
unit testsImagePlaceholderAmp
intoImageWithPlaceholder
unit testscross-team
label to this PR if it requires visibility across World Service teamsTesting:
CYPRESS_APP_ENV=local CYPRESS_SMOKE=false yarn test:e2e:interactive
)