-
Notifications
You must be signed in to change notification settings - Fork 4.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
Use preview instead of publishing post in block bindings tests #62235
Use preview instead of publishing post in block bindings tests #62235
Conversation
Size Change: +1.85 kB (+0.11%) Total Size: 1.75 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.
Looks good to me!
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
You are still creating the posts as drafts and deleting them at the end of the testing. So I'm not sure that this change will affect anything 😅 |
While the functionality is still the same, it's less code, which can make it easier to understand, also less prone to breakage by not relying on utils to click the Save button and dismiss the notice. So I think it's a worthwhile change 😄 |
I agree the code looks better. Additionally, I started working on the pull request based on this comment by Ella: "Is there no preview util? This won't work with subdirectory installations, and breaks running tests in MAMP. We should honour the WP_BASE_URL." I should have pointed that out in the description, sorry. Doing it now. |
…ress#62235) * Use `openPreviewPage` instead of `publishPost` * Remove unused `BlockBindingsUtils` Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org> Co-authored-by: artemiomorales <artemiosans@git.wordpress.org> Co-authored-by: cbravobernal <cbravobernal@git.wordpress.org>
What?
Using the preview functionality instead of publishing a post when checking the frontend in block bindings tests.
Why?
To avoid publishing new posts when it is not needed. As mentioned in this comment, using the current approach "won't work with subdirectory installations, and breaks running tests in MAMP."
How?
Using
openPreviewPage
util instead ofpublishPost
. Additionally, it allows us to avoid having a custom util.Testing Instructions
Tests should pass.