-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Site Editor: Fix focus mode navigation (#67458)
Co-authored-by: youknowriad <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: carolinan <[email protected]>
- Loading branch information
1 parent
5742e9d
commit c3529ad
Showing
3 changed files
with
52 additions
and
1 deletion.
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
50 changes: 50 additions & 0 deletions
50
test/e2e/specs/site-editor/template-part-focus-mode.spec.js
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,50 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Template Part Focus mode', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyfour' ); | ||
} ); | ||
|
||
test.afterEach( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyone' ); | ||
} ); | ||
|
||
test( 'Should navigate to template part and back.', async ( { | ||
admin, | ||
page, | ||
editor, | ||
} ) => { | ||
await admin.visitAdminPage( 'site-editor.php?canvas=edit' ); | ||
await editor.setPreferences( 'core/edit-site', { | ||
welcomeGuide: false, | ||
} ); | ||
|
||
// Check that we're editing the template | ||
await expect( page.locator( 'h1' ) ).toContainText( 'Blog Home' ); | ||
await expect( page.locator( 'h1' ) ).toContainText( 'Template' ); | ||
|
||
// Click Template Part | ||
await editor.canvas | ||
.getByRole( 'document', { | ||
name: 'Header', | ||
} ) | ||
.click(); | ||
|
||
// Navigate to Focus mode | ||
await editor.clickBlockToolbarButton( 'Edit' ); | ||
|
||
// Check if focus mode is active | ||
await expect( page.locator( 'h1' ) ).toContainText( 'Header' ); | ||
await expect( page.locator( 'h1' ) ).toContainText( 'Template Part' ); | ||
|
||
// Go back | ||
await page.getByRole( 'button', { name: 'Back' } ).click(); | ||
|
||
// Check that we're editing the template | ||
await expect( page.locator( 'h1' ) ).toContainText( 'Blog Home' ); | ||
await expect( page.locator( 'h1' ) ).toContainText( 'Template' ); | ||
} ); | ||
} ); |