Skip to content
Merged
Show file tree
Hide file tree
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
Add test for the group block
  • Loading branch information
JustinyAhin committed Jul 29, 2022
commit bcadcb96957c35550f3f39bdc0af8e1aa439f72f

This file was deleted.

78 changes: 0 additions & 78 deletions packages/e2e-tests/specs/editor/blocks/group.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- wp:group -->
<div class="wp-block-group"></div>
<!-- /wp:group -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- wp:group -->
<div class="wp-block-group"></div>
<!-- /wp:group -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- wp:group -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>Group Block with a Paragraph</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
61 changes: 61 additions & 0 deletions test/e2e/specs/editor/blocks/group.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

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

test( 'can be created using the block inserter', async ( {
editor,
page,
} ) => {
// Search for the group block and insert it.
const inserterButton = page.locator(
'role=button[name="Toggle block inserter"i]'
);

await inserterButton.click();

await page.type(
'role=searchbox[name="Search for blocks and patterns"i]',
'Group'
);

await page.click(
'role=listbox[name="Blocks"i] >> role=option[name="Group"i]'
);

expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );

test( 'can be created using the slash inserter', async ( {
editor,
page,
} ) => {
await page.click( 'role=button[name="Add default block"i]' );
await page.keyboard.type( '/group' );
await expect(
page.locator( 'role=option[name="Group"i][selected]' )
).toBeVisible();
await page.keyboard.press( 'Enter' );

expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );

test( 'can have other blocks appended to it using the button appender', async ( {
editor,
page,
} ) => {
await editor.insertBlock( { name: 'core/group' } );
await page.click( 'role=button[name="Add block"i]' );
await page.click(
'role=listbox[name="Blocks"i] >> role=option[name="Paragraph"i]'
);
await page.keyboard.type( 'Group Block with a Paragraph' );

expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );
} );