Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e test for activating themes in site editor #60707

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions test/e2e/specs/site-editor/activate-theme.spec.js
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();
} );
} );
Loading