-
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
Add: Generic end 2 end test to the block transforms. #12336
Add: Generic end 2 end test to the block transforms. #12336
Conversation
c86eed0
to
b7c0a55
Compare
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 PR needs to be refreshed since tests were moved to the new folder. I should have time next week to perform proper review of this PR if it updated :)
Is it still blocked given that we merged #13658 a few days ago? |
b7c0a55
to
b2d1c3d
Compare
Hi @gziolo, |
I'm on vacation this week and I don't want to block anyone else from reviewing and merging this one :)
7021600
to
ea59dfc
Compare
This PR is rebased and updated I think it is ready for the last checkup before the merge. |
@@ -0,0 +1,183 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
|
|||
exports[`test transforms individual transforms work as expected Code block should transform to Preformatted block. fixture: core__code 1`] = ` |
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 doesn't read very well. Ideally, it should be a readable sentence. E.g. RichText should insert character
.
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.
Is there any way to remove or reduce test transforms individual transforms work as expected
?
await page.click( '.editor-post-title .editor-post-title__block' ); | ||
} ); | ||
|
||
for ( const [ fixture, { originalBlock, availableTransforms } ] of Object.entries( EXPECTED_TRANSFORMS ) ) { |
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.
There is describe.each
API method, which you might also want to use here: https://jestjs.io/docs/en/api#describeeachtable-name-fn-timeout
It wouldn't have to be expressed using all those loops.
* | ||
* @return {Promise} Promise resolving with a string containing the block title. | ||
*/ | ||
export async function getBlockTitle( blockName ) { |
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.
How about making it more generic: getBlockSetting( blockName, settingName )
?
Another idea, what if we create a wrapper over data API? It might not scale to keep creating helpers each time we want to get some data from the store.
ea59dfc
to
e5f6171
Compare
e5f6171
to
79d5a5f
Compare
) | ||
); | ||
|
||
it.each( testTable )( |
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.
Awesome, looks great 👍
I'm seeing the following error after rebasing my PR:
https://travis-ci.com/WordPress/gutenberg/jobs/187395326#L1050 |
I think I know what has happened :) |
I guess this was the first problem this tests caught, it is a good sign :) |
Description
This is a second try on PR #10536, after a recommendation by @gziolo to try to make the PR smaller so it becomes easier to review.
In order to make the PR smaller, I temporarily created a list of test fixtures that intersects with the set of all fixtures so most fixtures are ignored. Another PR will follow that corrects the fixtures (mainly media ones) so they are reliable and can be used in this tests (e.g: don't trigger 404 requests).
All the mechanisms are present in this PR the only change that will happen in the other PR is the removal of the intersection and its list, the update of some media fixtures and the creation of new snapshots.
This is a high-level test that is going to Guarantee that every possible transform on Gutenberg is tested and works as expected (the result matches the save snapshot).
How has this been tested?
Verify all test cases pass.