diff --git a/packages/e2e-tests/specs/editor/blocks/post-title.test.js b/packages/e2e-tests/specs/editor/blocks/post-title.test.js deleted file mode 100644 index 0f9fc610be3ee5..00000000000000 --- a/packages/e2e-tests/specs/editor/blocks/post-title.test.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * WordPress dependencies - */ -import { - createNewPost, - insertBlock, - saveDraft, - canvas, -} from '@wordpress/e2e-test-utils'; - -describe( 'Post Title block', () => { - beforeEach( async () => { - await createNewPost(); - } ); - - it( 'Can edit the post title', async () => { - // Create a block with some text that will trigger a list creation. - await insertBlock( 'Title' ); - const editablePostTitleSelector = - '.wp-block-post-title[contenteditable="true"]'; - await canvas().waitForSelector( editablePostTitleSelector ); - await canvas().focus( editablePostTitleSelector ); - - // Create a second list item. - await page.keyboard.type( 'Just tweaking the post title' ); - - await saveDraft(); - await page.reload(); - await page.waitForSelector( '.edit-post-layout' ); - const title = await canvas().$eval( - '.editor-post-title__input', - ( element ) => element.textContent - ); - expect( title ).toEqual( 'Just tweaking the post title' ); - } ); -} ); diff --git a/test/e2e/specs/editor/blocks/post-title.spec.js b/test/e2e/specs/editor/blocks/post-title.spec.js new file mode 100644 index 00000000000000..6959a1cd0bfa78 --- /dev/null +++ b/test/e2e/specs/editor/blocks/post-title.spec.js @@ -0,0 +1,36 @@ +/** + * WordPress dependencies + */ +const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); + +test.describe( 'Post Title block', () => { + test.beforeEach( async ( { admin } ) => { + await admin.createNewPost(); + } ); + + test( 'Can edit the post title', async ( { editor, page } ) => { + await editor.insertBlock( { name: 'core/post-title' } ); + + // Add the post title + await editor.canvas + .getByRole( 'textbox', { + name: 'Add title', + } ) + .fill( 'Just tweaking the post title' ); + + // Save the post draft and reload. + await page.getByRole( 'button', { name: 'Save draft' } ).click(); + await expect( + page + .getByRole( 'button', { name: 'Dismiss this notice' } ) + .filter( { hasText: 'Draft saved' } ) + ).toBeVisible(); + await page.reload(); + + const titleBlock = editor.canvas.getByRole( 'document', { + name: 'Block: Title', + } ); + await expect( titleBlock ).toBeVisible(); + await expect( titleBlock ).toHaveText( 'Just tweaking the post title' ); + } ); +} );