-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Site Editor: Don't allow creating template part on the Patterns page …
…for non-block themes (#52656) * Don't allow template part to be created on the Patterns page for non-block themes * Remove unnecessary theme directory name in E2E test
- Loading branch information
Showing
2 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Hybrid theme', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'emptyhybrid' ); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyone' ); | ||
} ); | ||
|
||
test( 'should not show the Add Template Part button', async ( { | ||
admin, | ||
page, | ||
} ) => { | ||
await admin.visitAdminPage( | ||
'/site-editor.php', | ||
'postType=wp_template_part&path=/wp_template_part/all' | ||
); | ||
|
||
await expect( | ||
page.locator( 'role=button[name="Add New Template Part"i]' ) | ||
).toBeHidden(); | ||
|
||
// Back to Patterns page. | ||
await page.click( | ||
'role=region[name="Navigation"i] >> role=button[name="Back"i]' | ||
); | ||
|
||
await page.click( | ||
'role=region[name="Navigation"i] >> role=button[name="Create pattern"i]' | ||
); | ||
|
||
await expect( | ||
page.locator( 'role=menuitem[name="Create template part"i]' ) | ||
).toBeHidden(); | ||
} ); | ||
} ); |
5fadae5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 5fadae5.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5576153331
📝 Reported issues:
/test/e2e/specs/editor/various/post-editor-template-mode.spec.js