-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[E2E] Embed block fixes #45345
[E2E] Embed block fixes #45345
Conversation
87579ad
to
76c1689
Compare
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
I don't know if it'll be enough to just change the embed blocks to be selected by the same aria-label as I've done in the first commit here. It seems to be used to select them on the page for a scenario where multiple embed blocks are present. I'm waiting for the tests to finish, but if they continue to fail, we will need to think of another way to select each block or re-organize the scenario so that a single embed block is tested per time, in the editor. UPDATE: Even if the tests pass, we might still need to rethink these scenarios or ask ourselves if we really want to keep the same I've looked at the three blocks in the editor, and they now have pretty much the same markup. To test, open a test edge site and add the following blocks to the page: Instagram, Twitter, and Youtube. Now, inspect their DOM structure in the Elements inspector. You'll see all of them have pretty much the same markup, with the only difference being the ID hash. Screenshot follows: |
Yeah, I remember seeing that when I was working on some oEmbeds related stuff in Gutenberg the other day. I agree that we'll probably want to differentiate more between them. This is something we'll need to address in Gutenberg though, and it likely won't make it into v8.9, Edit: The embed block tests are actually passing, it's the tests for embedding a URL that are failing now:
The class name for all of those is |
All embed blocks (the ones touched by our E2E tests at least) follow a similar naming/classification standard. They now all have the same ariaLabel and embed prefix for the .editor-block-list-item CSS class.
I think we can change those selectors to look for and
(Those are coming from https://github.com/WordPress/gutenberg/blob/a610923b7728f1192f9745a55390a7abb0df576e/packages/block-library/src/embed/embed-preview.js#L78) |
…her than a selector based off the aria-label attribute
I like that idea, but it seems this changeset is not part of 8.9? I couldn't find this attribute on embed blocks in a test site running 8.9. Am I missing anything? That being said, I did start working towards this, there's some initial work I committed today. The upgrade test is still failing just when it starts the edge part of the test, possibly related to https://github.com/Automattic/wp-calypso/blob/master/test/e2e/lib/gutenberg/gutenberg-editor-component.js#L203, but I'll look tomorrow (or you can if you're feeling adventurous). |
76c1689
to
4a89bf1
Compare
Oh, I was thinking we'd need to change the selectors only in the file I was mentioning, https://github.com/Automattic/wp-calypso/blob/38b51c6665cd2029a6fe6d0eca42893e7eefcf1c/test/e2e/specs/wp-calypso-gutenberg-post-editor-spec.js. Let me see if that does the trick. |
…ctors other than a selector based off the aria-label attribute" This reverts commit 4a89bf1.
Yep, that worked 🥳 The 'Click to Tweet' block seems to be the last remaining issue now. |
Found the relevant screencast in test artifacts: https://98647-102822243-gh.circle-artifacts.com/2/wp-calypso/test/e2e/screenshots/videos/136-2020-09-03T11-58-44.mpg Upon attempting to leave the editor, there's a "Leave app? Changes you made may not be saved" alert (even right after saving the post). Screengrab from the screencast: Seems like dirty state detection is broken 😕 cc/ @david-szabo97 since we've recently touched the |
I don't have all the context here, but when working with the Since @ockham found a workaround for some of the tests, if the click to edit is still a problem, another approach would be to select the |
Thanks Nik. A number of misunderstandings here, I'll try to clarify:
|
The reason for the "Changes you made may not be saved" warning after publishing a post that contains a "Click to Tweet" CoBlock seems to be that the block has a This seems rather inherent in the way the block works. In e2e tests, we could fix it by saving the post before publishing and viewing it, so that is already given the same slug as it would get upon publishing. |
FWIW, here's the relevant block's code: https://github.com/godaddy-wordpress/coblocks/blob/0d644c66e96292baed08472631c0892b6b71e186/src/blocks/click-to-tweet/edit.js#L37-L43 |
Filed upstream issue: godaddy-wordpress/coblocks#1663 |
@ockham Thanks for thoroughly documenting the issue as you worked towards fixing it ❤️ This looks good, let's 🚢 it! |
This reverts commit f8a2698.
This reverts commit f8a2698.
Changes proposed in this Pull Request
All embed blocks (the ones touched by our E2E tests at least) now follow a similar naming/classification standard. They now all have the same ariaLabel and embed prefix for the .editor-block-list-item CSS class.
This fixes the selectors so that the elements can be found on the page.
Outstanding questions
aria-labels
for these blocks? They are all "embed" blocks, but they serve different purposes.