Skip to content

Commit

Permalink
Fix broken the post-template-editor test. (#32904)
Browse files Browse the repository at this point in the history
* Change to a theme that supports block-templates, and then delete wp_template and wp_template_part posts.

* add plugin for switch add_theme_support('block-templates')

* Update packages/e2e-tests/specs/experiments/post-editor-template-mode.test.js

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>

* Update packages/e2e-tests/specs/experiments/post-editor-template-mode.test.js

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
  • Loading branch information
2 people authored and youknowriad committed Jun 24, 2021
1 parent debe6cd commit 7a050ac
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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 activatePlugin( 'gutenberg-test-block-templates' );
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

0 comments on commit 7a050ac

Please sign in to comment.