-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix embedding Twitter URLs with a trailing slash (Closes #12664) #14600
Fix embedding Twitter URLs with a trailing slash (Closes #12664) #14600
Conversation
I noticed that one of the e2e tests fails on Travis (https://travis-ci.com/WordPress/gutenberg/jobs/187295522#L1062):
It might be related to the change in logic. It should be further investigated.
We changed the configuration of Docker on Friday, I'm wondering if you had your local environment set up earlier and simple Docker restart would solve it. If not, let us know, we will revert the change which updates |
This looks like the right way to go, we just need those e2e tests fixing up. The embed e2e tests mock all embed requests so we're not reliant on external services responding, they might be down, or respond with something unexpected. In It should be straightforward to add those, but if any of it isn't clear (it might only be clear to me because I wrote it!) then ping me and I'm happy to help :) |
@gziolo @notnownikki Thank you both for you help! I'll see if I can find some time to look at this in the next few days and finish it out. |
aef7248
to
9f0f0ce
Compare
@notnownikki @gziolo Having difficulties fixing the e2e tests for this. I'd like to give this up to another contributor. Hopefully this issue is a little further along! |
Whoever picks this up, you may need a little help with the e2e tests, they're one of the more complex ones because of the amount of mocking we have to do to test the embed block reliably. I'm happy to fix up the tests if anyone wants to collaborate :) |
Is there an easy way to fix the test so we could include it in WordPress 5.2? The logic is fixed and tests are less important than having this working for end users. |
I can work on the test to get it working if that's ok with everyone? |
That would be awesome, I reopened PR to ensure it doesn’t get lost. |
Picking this up now. Fix is looking great, just the amount of mocking we have to do for embed tests not to randomly fail is... more than a little :) |
Looking at this more, and somehow there's an intermittent error. Sometimes the e2e tests pass, sometimes they don't, because sometimes the block gets the new preview and sometimes it doesn't. I'm guessing it's more to do with how state is being applied rather than external sites, as all the external requests for embed responses are mocked. Investigating more, it's not as simple as it seemed. |
Oh boy, this was tricky to track down, but I've figured out what's causing the test to fail. This PR is firing the slash removal if we However, the fix here fires immediately on setting the URL, and the WordPress URLs in the test have trailing slashes, and so it immediately resubmits without the slash. That's why the test intermittently passed for me locally, because things were happening fast enough for the preview to come back and the slash removal didn't fire sometimes. The root cause of the problem is The fix I'd like to do here is to check if we've finished fetching before firing off |
We can close this one again. #14705 should land soon 🎉 |
Description
Fixes #12664.
Fixed embedding tweets with a URL containing a trailing slash.
How has this been tested?
Manually tested the following cases:
I'm looking into including a e2e test as suggested by @notnownikki, and the failed tests in the TravisCI build.
However, I can't seem to run the e2e tests locally. I'm getting the following error:
Any idea on what I'm doing wrong or how to fix? I'm using the built-in local environment as suggested in End to End Testing
Types of changes
Bug fix - If the
<EmbedEdit />
component can't embed the URL, then it resubmits the URL without a trailing slash.Checklist: