Skip to content
Closed
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
40 changes: 40 additions & 0 deletions tests/e2e/specs/general-settings.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { test, expect } from '@wordpress/e2e-test-utils-playwright';

test.describe( 'Settings -> General', () => {
test( 'Saving General Settings preserves the active theme options', async ( {
admin,
page,
requestUtils,
} ) => {
await admin.visitAdminPage( 'options.php' );
const stylesheet = await page.locator( '#stylesheet' ).inputValue();
const template = await page.locator( '#template' ).inputValue();
expect( stylesheet ).not.toBe( '' );
expect( template ).not.toBe( '' );

await admin.visitAdminPage( 'options-general.php' );
const tagline = page.getByLabel( 'Tagline', { exact: true } );
const originalTagline = await tagline.inputValue();
const updatedTagline = (
originalTagline + ' Updated in General Settings.'
).trimStart();

try {
await tagline.fill( updatedTagline );
await page.getByRole( 'button', { name: 'Save Changes' } ).click();
await expect(
page.locator( '#setting-error-settings_updated' )
).toContainText( 'Settings saved.' );
await expect( tagline ).toHaveValue( updatedTagline );

await admin.visitAdminPage( 'options.php' );
await expect( page.locator( '#stylesheet' ) ).toHaveValue( stylesheet );
await expect( page.locator( '#template' ) ).toHaveValue( template );
} finally {
await requestUtils.updateSiteSettings( {
description: originalTagline,
} );
}
} );
} );

Loading