Skip to content
Open
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
34 changes: 34 additions & 0 deletions tests/e2e/specs/settings/settings.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { test, expect } = require('@wordpress/e2e-test-utils-playwright');

test.describe('General Settings', () => {
let defaultTimezone;

test.beforeEach(async ({ admin, page }) => {
await admin.visitAdminPage('options-general.php');

// Capture the default timezone
defaultTimezone = await page.locator('select#timezone_string').inputValue();
});

test.afterEach(async ({ page }) => {
// Revert to default timezone
await page.locator('select#timezone_string').selectOption(defaultTimezone);
await page.click('#submit');
});
test('changes timezone', async ({ admin, page }) => {

// Change timezone
await page.locator('select#timezone_string').selectOption('Africa/Libreville');
await page.click('#submit');

// Verify success message
await expect(page.locator('#setting-error-settings_updated')).toHaveText(
'Settings saved.Dismiss this notice.'
);

// Verify selected timezone persists
const selectedTimezone = await page.locator('select#timezone_string').inputValue();
await expect(selectedTimezone).toBe('Africa/Libreville');

});
});
Loading