Skip to content

Commit

Permalink
(e2e)(template-parts) Add E2E test for editing the title of a new cus…
Browse files Browse the repository at this point in the history
…tom template part (#50195)

* Add (regression) E2E test for editing the title of a new custom template part

* Small formatting improvement

* Add jsdoc to the `editTemplateTitle` helper function

* Add improvements after code review

* Remove activateTheme call, it is not needed
  • Loading branch information
fullofcaffeine authored May 4, 2023
1 parent e57b687 commit fd64307
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/e2e/specs/editor/various/post-editor-template-mode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,32 @@ test.describe( 'Post Editor Template mode', () => {
).toBeVisible();
} );

test( 'Allow editing the title of a new custom template', async ( {
page,
postEditorTemplateMode,
} ) => {
async function editTemplateTitle( newTitle ) {
await page
.getByRole( 'button', { name: 'Template Options' } )
.click();

await page
.getByRole( 'textbox', { name: 'Title' } )
.fill( newTitle );

const editorContent = page.getByLabel( 'Editor Content' );
await editorContent.click();
}

await postEditorTemplateMode.createPostAndSaveDraft();
await postEditorTemplateMode.createNewTemplate( 'Foobar' );
await editTemplateTitle( 'Barfoo' );

await expect(
page.getByRole( 'button', { name: 'Template Options' } )
).toHaveText( 'Barfoo' );
} );

test.describe( 'Delete Post Template Confirmation Dialog', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
Expand Down

0 comments on commit fd64307

Please sign in to comment.