-
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.
Fix custom template creation regression (#50797)
* Fix custom template creation regression * update custom template description to match post editor modal * add regression test * use `getByRole` in e2e tests
- Loading branch information
1 parent
1939eae
commit d6a482e
Showing
4 changed files
with
48 additions
and
13 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
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,43 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Templates', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'emptytheme' ); | ||
} ); | ||
test.afterEach( async ( { requestUtils } ) => { | ||
await requestUtils.deleteAllTemplates( 'wp_template' ); | ||
} ); | ||
test( 'Create a custom template', async ( { admin, page } ) => { | ||
const templateName = 'demo'; | ||
await admin.visitSiteEditor(); | ||
await page.getByRole( 'button', { name: 'Templates' } ).click(); | ||
await page.getByRole( 'button', { name: 'Add New Template' } ).click(); | ||
await page | ||
.getByRole( 'button', { | ||
name: 'A custom template can be manually applied to any post or page.', | ||
} ) | ||
.click(); | ||
// Fill the template title and submit. | ||
const newTemplateDialog = page.locator( | ||
'role=dialog[name="Create custom template"i]' | ||
); | ||
const templateNameInput = newTemplateDialog.locator( | ||
'role=textbox[name="Name"i]' | ||
); | ||
await templateNameInput.fill( templateName ); | ||
await page.keyboard.press( 'Enter' ); | ||
// Close the pattern suggestions dialog. | ||
await page | ||
.getByRole( 'dialog', { name: 'Choose a pattern' } ) | ||
.getByRole( 'button', { name: 'Close' } ) | ||
.click(); | ||
await expect( | ||
page.locator( | ||
`role=button[name="Dismiss this notice"i] >> text="${ templateName }" successfully created.` | ||
) | ||
).toBeVisible(); | ||
} ); | ||
} ); |
d6a482e
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 d6a482e.
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/5045168004
📝 Reported issues:
/test/e2e/specs/site-editor/push-to-global-styles.spec.js
/test/e2e/specs/site-editor/template-revert.spec.js
/test/e2e/specs/site-editor/template-revert.spec.js