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 Playwright E2E test to change time zone test #8092

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
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
28 changes: 28 additions & 0 deletions tests/e2e/specs/settings/settings.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const { test, expect } = require('@wordpress/e2e-test-utils-playwright');

test.describe('General Settings', () => {
test('changes timezone', async ({ admin, page }) => {
await admin.visitAdminPage('options-general.php');

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

// 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');


// Revert to default timezone (cleanup step)
await page.locator('select#timezone_string').selectOption(defaultTimezone);
await page.click('#submit');
});
});
Loading