-
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.
Add e2e test for activating themes in site editor (#60707)
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org>
- Loading branch information
1 parent
690d933
commit 360a6b8
Showing
1 changed file
with
53 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Activate theme', () => { | ||
test.beforeEach( async ( { admin, page } ) => { | ||
await admin.visitAdminPage( 'themes.php' ); | ||
await page.getByLabel( 'Live Preview Emptytheme' ).click(); | ||
} ); | ||
test.afterEach( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyone' ); | ||
} ); | ||
test( 'activate block theme when live previewing from sidebar save button', async ( { | ||
admin, | ||
page, | ||
} ) => { | ||
await page | ||
.getByRole( 'button', { name: 'Activate Emptytheme' } ) | ||
.click(); | ||
await page | ||
.getByRole( 'button', { name: 'Activate', exact: true } ) | ||
.click(); | ||
await expect( | ||
page.getByRole( 'button', { name: 'Dismiss this notice' } ) | ||
).toContainText( 'Site updated' ); | ||
await admin.visitAdminPage( 'themes.php' ); | ||
await expect( page.getByLabel( 'Customize Emptytheme' ) ).toBeVisible(); | ||
} ); | ||
test( 'activate block theme when live previewing in edit mode', async ( { | ||
editor, | ||
admin, | ||
page, | ||
} ) => { | ||
// Wait for the loading to complete. | ||
await expect( page.locator( '.edit-site-canvas-loader' ) ).toHaveCount( | ||
0 | ||
); | ||
await editor.canvas.locator( 'body' ).click(); | ||
await page | ||
.getByRole( 'region', { name: 'Editor top bar' } ) | ||
.getByRole( 'button', { name: 'Activate Emptytheme' } ) | ||
.click(); | ||
await page | ||
.getByRole( 'button', { name: 'Activate', exact: true } ) | ||
.click(); | ||
await expect( | ||
page.getByRole( 'button', { name: 'Dismiss this notice' } ) | ||
).toContainText( 'Site updated' ); | ||
await admin.visitAdminPage( 'themes.php' ); | ||
await expect( page.getByLabel( 'Customize Emptytheme' ) ).toBeVisible(); | ||
} ); | ||
} ); |
360a6b8
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 360a6b8.
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/8663534515
📝 Reported issues:
/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js