Skip to content

Commit

Permalink
End-to-End Tests Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
karthick-murugan committed Jan 8, 2025
1 parent 449f398 commit fa54cee
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/fields/src/fields/template/template-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const TemplateEdit = ( {
onToggle();
} }
>
{ __( 'Swap template' ) }
{ __( 'Replace template' ) }
</MenuItem>
{
// The default template in a post is indicated by an empty string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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', {
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/specs/site-editor/pages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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,
} ) => {
Expand All @@ -321,7 +321,7 @@ test.describe( 'Pages', () => {
await expect(
page
.getByRole( 'menu', { name: 'Template options' } )
.getByText( 'Swap template' )
.getByText( 'Replace template' )
).toHaveCount( 0 );
} );
} );
14 changes: 9 additions & 5 deletions test/e2e/specs/site-editor/template-registration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit fa54cee

Please sign in to comment.