Skip to content

Commit 360a6b8

Browse files
Add e2e test for activating themes in site editor (#60707)
Co-authored-by: ntsekouras <[email protected]> Co-authored-by: draganescu <[email protected]>
1 parent 690d933 commit 360a6b8

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
5+
6+
test.describe( 'Activate theme', () => {
7+
test.beforeEach( async ( { admin, page } ) => {
8+
await admin.visitAdminPage( 'themes.php' );
9+
await page.getByLabel( 'Live Preview Emptytheme' ).click();
10+
} );
11+
test.afterEach( async ( { requestUtils } ) => {
12+
await requestUtils.activateTheme( 'twentytwentyone' );
13+
} );
14+
test( 'activate block theme when live previewing from sidebar save button', async ( {
15+
admin,
16+
page,
17+
} ) => {
18+
await page
19+
.getByRole( 'button', { name: 'Activate Emptytheme' } )
20+
.click();
21+
await page
22+
.getByRole( 'button', { name: 'Activate', exact: true } )
23+
.click();
24+
await expect(
25+
page.getByRole( 'button', { name: 'Dismiss this notice' } )
26+
).toContainText( 'Site updated' );
27+
await admin.visitAdminPage( 'themes.php' );
28+
await expect( page.getByLabel( 'Customize Emptytheme' ) ).toBeVisible();
29+
} );
30+
test( 'activate block theme when live previewing in edit mode', async ( {
31+
editor,
32+
admin,
33+
page,
34+
} ) => {
35+
// Wait for the loading to complete.
36+
await expect( page.locator( '.edit-site-canvas-loader' ) ).toHaveCount(
37+
0
38+
);
39+
await editor.canvas.locator( 'body' ).click();
40+
await page
41+
.getByRole( 'region', { name: 'Editor top bar' } )
42+
.getByRole( 'button', { name: 'Activate Emptytheme' } )
43+
.click();
44+
await page
45+
.getByRole( 'button', { name: 'Activate', exact: true } )
46+
.click();
47+
await expect(
48+
page.getByRole( 'button', { name: 'Dismiss this notice' } )
49+
).toContainText( 'Site updated' );
50+
await admin.visitAdminPage( 'themes.php' );
51+
await expect( page.getByLabel( 'Customize Emptytheme' ) ).toBeVisible();
52+
} );
53+
} );

0 commit comments

Comments
 (0)