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

Fix broken the post-template-editor test. #32904

Merged
merged 4 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
17 changes: 17 additions & 0 deletions packages/e2e-tests/plugins/block-templates.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Plugin Name: Gutenberg Test Block Templates
* Plugin URI: https://github.com/WordPress/gutenberg
* Author: Gutenberg Team
*
* @package gutenberg-test-block-templates
*/

/**
* Activate Block Templates.
*/
function enqueue_block_templates() {
add_theme_support( 'block-templates' );
}

add_action( 'setup_theme', 'enqueue_block_templates' );
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
trashAllPosts,
openPreviewPage,
openDocumentSettingsSidebar,
activatePlugin,
deactivatePlugin,
} from '@wordpress/e2e-test-utils';

const openSidebarPanelWithTitle = async ( title ) => {
Expand Down Expand Up @@ -89,12 +91,14 @@ const createNewTemplate = async ( templateName ) => {

describe( 'Post Editor Template mode', () => {
beforeAll( async () => {
await activateTheme( 'tt1-blocks' );
torounit marked this conversation as resolved.
Show resolved Hide resolved
await trashAllPosts( 'wp_template' );
await trashAllPosts( 'wp_template_part' );
} );

afterAll( async () => {
await activateTheme( 'twentytwentyone' );
await deactivatePlugin( 'gutenberg-test-block-templates' );
} );

it( 'Allow to switch to template mode, edit the template and check the result', async () => {
Expand Down Expand Up @@ -142,6 +146,7 @@ describe( 'Post Editor Template mode', () => {
} );

it( 'Allow creating custom block templates in classic themes', async () => {
await activatePlugin( 'gutenberg-test-block-templates' );
gziolo marked this conversation as resolved.
Show resolved Hide resolved
await activateTheme( 'twentytwentyone' );
await createNewPost();
// Create a random post.
Expand Down