Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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

This file was deleted.

43 changes: 0 additions & 43 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 -->
73 changes: 73 additions & 0 deletions test/e2e/specs/editor/blocks/group.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/**
* 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]'
);

if (
( await inserterButton.getAttribute( 'aria-pressed' ) ) === 'false'
) {
await inserterButton.click();
}

const searchField = page.locator( '.components-search-control__input' );
await searchField.type( 'Group' );

await page.locator( '.editor-block-list-item-group' ).click();

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

test( 'can be created using the slash inserter', async ( {
editor,
page,
} ) => {
await page.locator( 'role=button[name="Add default block"i]' ).click();
await page.keyboard.type( '/group' );
await page.waitForSelector(
`//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Group')]`
);
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,
} ) => {
// Search for the group block and insert it.
const inserterButton = page.locator(
'role=button[name="Toggle block inserter"i]'
);

if (
( await inserterButton.getAttribute( 'aria-pressed' ) ) === 'false'
) {
await inserterButton.click();
}

const searchField = page.locator( '.components-search-control__input' );
await searchField.type( 'Group' );

await page.locator( '.editor-block-list-item-group' ).click();
await page.locator( '.block-editor-button-block-appender' ).click();
await page.locator( '.editor-block-list-item-paragraph' ).click();
await page.keyboard.type( 'Group Block with a Paragraph' );

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