Skip to content
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

Make tests resilient against transforms added by plugins #14632

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions packages/e2e-tests/specs/block-transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ const getTransformResult = async ( blockContent, transformName ) => {
return getEditedPostContent();
};

describe( 'Block transforms', () => {
// Skipping all the tests when plugins are enabled
// makes sure the tests are not executed, and no unused snapshots errors are thrown.
const maybeDescribe = process.env.POPULAR_PLUGINS ?
describe :
describe.skip;

maybeDescribe( 'Block transforms', () => {
// Todo: Remove the filter as soon as all fixtures are corrected,
// and its direct usage on the editor does not trigger errors.
// Currently some fixtures trigger errors (mainly media related)
Expand Down Expand Up @@ -166,21 +172,21 @@ describe( 'Block transforms', () => {
( { originalBlock, availableTransforms }, fixture ) => (
map(
availableTransforms,
( distinationBlock ) => ( [
( destinationBlock ) => ( [
originalBlock,
fixture,
distinationBlock,
destinationBlock,
] )
)
)
);

it.each( testTable )(
'block %s in fixture %s into the %s block',
async ( originalBlock, fixture, distinationBlock ) => {
async ( originalBlock, fixture, destinationBlock ) => {
const { content } = transformStructure[ fixture ];
expect(
await getTransformResult( content, distinationBlock )
await getTransformResult( content, destinationBlock )
).toMatchSnapshot();
}
);
Expand Down