Skip to content

Tests: Verify timezone persistence and restore the original setting - #14207

Closed
lancewillett wants to merge 3 commits into
WordPress:trunkfrom
lancewillett:test/e2e-timezone-persistence
Closed

lancewillett wants to merge 3 commits into
WordPress:trunkfrom
lancewillett:test/e2e-timezone-persistence

Conversation

@lancewillett

@lancewillett lancewillett commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

The invalid-timezone tests currently leave the site using Lisbon and check only the form returned after submission. Capture and restore the stored timezone options, confirm successful saves, and reload settings to verify the last valid value persisted after an invalid submission.

Retains the three existing invalid inputs. Selects a different valid timezone when the site already uses Lisbon. Setup and cleanup use WP-CLI to preserve both timezone_string and gmt_offset, including offsets that the settings form displays incorrectly. The test still submits valid and invalid timezone values through the browser. Carries forward the useful improvements from #8092 into the existing spec.

Trac: https://core.trac.wordpress.org/ticket/52895

Validation: all three cases passed three repetitions in local Chromium on multisite with retries disabled (9 checks). Additional probes verified restoration of UTC+0:30, UTC−0:30, UTC+5:30, and an already-Lisbon setting. An intentional failure away from Settings also preserved the original stored options. Probe code was removed and local settings restored. The scoped E2E audit, JavaScript type checking, syntax, and whitespace checks passed.

Use of AI Tools

AI assistance: Yes
Tool: OpenAI Codex
Model: GPT-6
Used for: Implementing the test changes, running local validation, auditing the diff, and drafting this description.

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props lancewillett, lucatume.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@lancewillett

lancewillett commented Oct 12, 2026 •

Copy link
Copy Markdown
Member Author

Review of e08b2a4. No blockers, and no changes requested to the test.

  • Scope is right: everything lands in the existing tests/e2e/specs/general-settings-invalid-timezone.test.js. The three invalid inputs are kept.
  • The valid save is now proven every time: the test picks a timezone that differs from the starting value, uses a real selectOption(), and asserts "Settings saved." Before, the proof was implicit and void when the site already held Europe/Lisbon.
  • The rejection is now explicit: it asserts the "not valid" notice, the value on the response, and the value again on a fresh page load.
  • State is restored: afterEach reloads a fresh form, restores the captured value through the form, and asserts the result. Restoring through the form keeps UTC-offset choices intact. The spec no longer leaves the site on Europe/Lisbon.
  • CI: both E2E jobs passed on this head.

One change requested, to the description:

  • Replace the footer with the AI disclosure section. The description ends with an "AI review" footer, which reads as a reviewer's sign-off on the author's own text. The pull request template asks for a "Use of AI Tools" section that says which tools were used and for what.

Track later, outside this diff: the spec still finds its controls by #timezone_string and #submit. Label and role lookups would match the newer specs.

AI review · claude-opus-5-5

@lancewillett
lancewillett requested review from lucatume and a balanced review from Copilot October 16, 2026 17:48
@lancewillett

Copy link
Copy Markdown
Member Author

Fixed in 9d6a06c. The settings form displays UTC+0:30 and UTC−0:30 as UTC+0, so restoring its selected value silently changed the original offset—even while the test passed.

Setup and cleanup now preserve the stored timezone_string and gmt_offset through WP-CLI. The browser assertions remain unchanged. Repeated tests and offset-restoration probes passed, including cleanup after an intentional test failure.

AI review · gpt-6

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

CLI site targeting can leave subsite settings unrestored, and dotenv output can break setup JSON parsing.

2 open findings
What changed in this PR

Strengthens the existing invalid-timezone tests to verify persistence and restore the site's original timezone settings.

Changes:

  • Captures and restores both timezone options through WP-CLI.
  • Selects a different valid timezone and checks save feedback.
  • Reloads settings to verify persistence after each invalid submission.
File Description
tests/​e2e/​specs/​general-settings-invalid-timezone.test.js Adds option restoration and stronger persistence assertions.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/e2e/specs/general-settings-invalid-timezone.test.js Outdated
Comment thread tests/e2e/specs/general-settings-invalid-timezone.test.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No blocking issues remain, and both previously reported concerns are addressed.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@lancewillett

Copy link
Copy Markdown
Member Author

wporg-sync pushed a commit that referenced this pull request Oct 19, 2026
Check successful timezone saves, rejection of invalid values, and persistence after reloading General Settings. Preserve and restore both `timezone_string` and `gmt_offset`, including half-hour offsets, using WP-CLI against the same site as the browser.

Keep dotenv output quiet when reading the saved options as JSON.

Developed in: #14207

Props juhise, lucatume.
See #52895.


git-svn-id: https://develop.svn.wordpress.org/trunk@64584 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 19, 2026
Check successful timezone saves, rejection of invalid values, and persistence after reloading General Settings. Preserve and restore both `timezone_string` and `gmt_offset`, including half-hour offsets, using WP-CLI against the same site as the browser.

Keep dotenv output quiet when reading the saved options as JSON.

Developed in: WordPress/wordpress-develop#14207

Props juhise, lucatume.
See #52895.

Built from https://develop.svn.wordpress.org/trunk@64584


git-svn-id: http://core.svn.wordpress.org/trunk@63734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants