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

E2E Tests: Make attributes and innerblocks optional in insertBlock #44933

Merged

Conversation

walbo
Copy link
Member

@walbo walbo commented Oct 13, 2022

What?

Update the types for insertBlock to make attributes and innerBlocks optional.

Why?

attributes and innerBlocks has a default value and the users don't need to set these. This makes the types align with the code.

Testing Instructions

Create a simple E2E test using @wordpress/e2e-test-utils-playwright, TypeScript and insertBlock.

Ex:

import { test, expect } from '@wordpress/e2e-test-utils-playwright';

test.describe( 'Paragraph', () => {
	test.beforeEach( async ( { admin } ) => {
		await admin.createNewPost();
	} );

	test( 'can insert block', async ( { editor } ) => {
		await editor.insertBlock( {
			name: 'core/paragraph',
		} );
		expect( await editor.getEditedPostContent() ).toMatchSnapshot();
	} );
} );

TypeScript validation should pass.

Screenshots or screencast

image

@walbo walbo added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Code Quality Issues or PRs that relate to code quality labels Oct 13, 2022
@walbo walbo requested review from talldan and kevin940726 October 13, 2022 11:48
Copy link
Member

@kevin940726 kevin940726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! my bad. Thanks for fixing it!

@walbo walbo merged commit db3b647 into trunk Oct 13, 2022
@walbo walbo deleted the fix/e2e-insertBlock-optional-attributes-and-innerBlocks branch October 13, 2022 13:16
@github-actions github-actions bot added this to the Gutenberg 14.4 milestone Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants