Skip to content

Commit

Permalink
Post Title block test: demo refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderBart committed Aug 17, 2021
1 parent 610d62a commit eda6e66
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions packages/e2e-tests/specs/editor/blocks/post-title.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,18 @@ describe( 'Post Title block', () => {
} );

it( 'Can edit the post title', async () => {
// Create a block with some text that will trigger a list creation.
await insertBlock( 'Post Title' );
const editablePostTitleSelector =
'.wp-block-post-title[contenteditable="true"]';
await page.waitForSelector( editablePostTitleSelector );
await page.focus( editablePostTitleSelector );

// Create a second list item.
await page.keyboard.type( 'Just tweaking the post title' );
const titleText = 'Just tweaking the post title';

await page.click( '[aria-label="Block: Post Title"]' );
await page.keyboard.type( titleText );

await saveDraft();
await page.reload();
await page.waitForSelector( '.edit-post-layout' );
const title = await page.$eval(
'.editor-post-title__input',
( element ) => element.value

await page.waitForSelector(
`.editor-post-title >> text="${ titleText }"`
);
expect( title ).toEqual( 'Just tweaking the post title' );
} );
} );

0 comments on commit eda6e66

Please sign in to comment.