From fa54ceecabb660edb3bab1625cac08e92e3b16af Mon Sep 17 00:00:00 2001 From: karthick-murugan Date: Wed, 8 Jan 2025 16:23:50 +0530 Subject: [PATCH] End-to-End Tests Updates --- .../fields/src/fields/template/template-edit.tsx | 2 +- .../various/post-editor-template-mode.spec.js | 8 ++++---- test/e2e/specs/site-editor/pages.spec.js | 6 +++--- .../site-editor/template-registration.spec.js | 14 +++++++++----- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/fields/src/fields/template/template-edit.tsx b/packages/fields/src/fields/template/template-edit.tsx index c17364568a4578..366c7c78182346 100644 --- a/packages/fields/src/fields/template/template-edit.tsx +++ b/packages/fields/src/fields/template/template-edit.tsx @@ -165,7 +165,7 @@ export const TemplateEdit = ( { onToggle(); } } > - { __( 'Swap template' ) } + { __( 'Replace template' ) } { // The default template in a post is indicated by an empty string diff --git a/test/e2e/specs/editor/various/post-editor-template-mode.spec.js b/test/e2e/specs/editor/various/post-editor-template-mode.spec.js index 981f8ccbbd5d38..1ca31fb7817f20 100644 --- a/test/e2e/specs/editor/various/post-editor-template-mode.spec.js +++ b/test/e2e/specs/editor/various/post-editor-template-mode.spec.js @@ -77,7 +77,7 @@ test.describe( 'Post Editor Template mode', () => { ).toBeVisible(); } ); - test( 'Swap templates and proper template resolution when switching to default template', async ( { + test( 'Replace templates and proper template resolution when switching to default template', async ( { editor, page, requestUtils, @@ -88,10 +88,10 @@ test.describe( 'Post Editor Template mode', () => { await page.reload(); await postEditorTemplateMode.disableTemplateWelcomeGuide(); await postEditorTemplateMode.openTemplatePopover(); - // Swap to a custom template, save and reload. + // Replace to a custom template, save and reload. await page .getByRole( 'menuitem', { - name: 'Swap template', + name: 'Replace template', } ) .click(); await page @@ -101,7 +101,7 @@ test.describe( 'Post Editor Template mode', () => { .click(); await editor.saveDraft(); await page.reload(); - // Swap to the default template. + // Replace to the default template. await postEditorTemplateMode.openTemplatePopover(); await page .getByRole( 'menuitem', { diff --git a/test/e2e/specs/site-editor/pages.spec.js b/test/e2e/specs/site-editor/pages.spec.js index 37b164e85a5973..89284bb613abd7 100644 --- a/test/e2e/specs/site-editor/pages.spec.js +++ b/test/e2e/specs/site-editor/pages.spec.js @@ -281,7 +281,7 @@ test.describe( 'Pages', () => { await templateOptionsButton.click(); await page .getByRole( 'menu', { name: 'Template options' } ) - .getByText( 'Swap template' ) + .getByText( 'Replace template' ) .click(); const templateItem = page.locator( '.block-editor-block-patterns-list__item-title' @@ -305,7 +305,7 @@ test.describe( 'Pages', () => { await expect( templateOptionsButton ).toHaveText( 'Single Entries' ); } ); - test( 'swap template options should respect the declared `postTypes`', async ( { + test( 'replace template options should respect the declared `postTypes`', async ( { page, editor, } ) => { @@ -321,7 +321,7 @@ test.describe( 'Pages', () => { await expect( page .getByRole( 'menu', { name: 'Template options' } ) - .getByText( 'Swap template' ) + .getByText( 'Replace template' ) ).toHaveCount( 0 ); } ); } ); diff --git a/test/e2e/specs/site-editor/template-registration.spec.js b/test/e2e/specs/site-editor/template-registration.spec.js index 2960367fc32ef1..d17652fc13b1c4 100644 --- a/test/e2e/specs/site-editor/template-registration.spec.js +++ b/test/e2e/specs/site-editor/template-registration.spec.js @@ -94,7 +94,7 @@ test.describe( 'Block template registration', () => { ).toBeHidden(); } ); - test( 'registered templates are available in the Swap template screen', async ( { + test( 'registered templates are available in the Replace template screen', async ( { admin, editor, page, @@ -106,10 +106,12 @@ test.describe( 'Block template registration', () => { attributes: { content: 'User-created post.' }, } ); - // Swap template. + // Replace template. await page.getByRole( 'button', { name: 'Post', exact: true } ).click(); await page.getByRole( 'button', { name: 'Template options' } ).click(); - await page.getByRole( 'menuitem', { name: 'Swap template' } ).click(); + await page + .getByRole( 'menuitem', { name: 'Replace template' } ) + .click(); await page.getByText( 'Plugin Template' ).click(); // Verify the template is applied. @@ -133,10 +135,12 @@ test.describe( 'Block template registration', () => { attributes: { content: 'User-created post.' }, } ); - // Swap template. + // Replace template. await page.getByRole( 'button', { name: 'Post', exact: true } ).click(); await page.getByRole( 'button', { name: 'Template options' } ).click(); - await page.getByRole( 'menuitem', { name: 'Swap template' } ).click(); + await page + .getByRole( 'menuitem', { name: 'Replace template' } ) + .click(); await page.getByText( 'Custom', { exact: true } ).click(); // Verify the theme template is applied.