Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns: Reinstate template parts mode spec #52780

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions test/e2e/specs/site-editor/template-parts-mode.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Template Parts for Classic themes', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'emptyhybrid' );
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test( 'can access template parts list page', async ( { admin, page } ) => {
await admin.visitAdminPage(
'site-editor.php',
'postType=wp_template_part&path=/wp_template_part/all'
);

await expect(
page.getByRole( 'table' ).getByRole( 'link', { name: 'header' } )
).toBeVisible();
} );

test( 'can view a template part', async ( { admin, editor, page } ) => {
await admin.visitAdminPage(
'site-editor.php',
'postType=wp_template_part&path=/wp_template_part/all'
);

const templatePart = page
.getByRole( 'table' )
.getByRole( 'link', { name: 'header' } );

await expect( templatePart ).toBeVisible();
await templatePart.click();

await expect(
page.getByRole( 'region', { name: 'Editor content' } )
).toBeVisible();

await editor.canvas.click( 'body' );

await expect(
editor.canvas.getByRole( 'document', {
name: 'Block: Site Title',
} )
).toBeVisible();
} );
} );