You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tests: Add E2E tests for Writing Settings - #16376
Adds Playwright E2E tests for the Settings → Writing (options-writing.php) admin screen.
Why?
As part of expanding admin E2E test coverage (#52895), general-settings.test.js and reading-settings.test.js already cover Settings screens. Adding coverage for Writing Settings verifies saving core writing options and that the default post category is applied to newly created posts.
How?
Added a WRITING_SETTINGS lock in tests/e2e/utils/locks.js so Writing Settings tests do not race with other tests.
Added tests/e2e/specs/writing-settings.test.js with two tests using siteOptions.remember() to restore modified options after each test:
Saving default_post_format, mailserver_url, mailserver_port, and mailserver_login persists the updated values and displays the Settings saved. notice.
Setting default_category in the UI and creating a post verifies the new post inherits that category.
Extended numeric option normalization in tests/e2e/fixtures/site.js for default_category and mailserver_port.
Testing Instructions
Run the E2E suite for the new spec: npm run test:e2e -- tests/e2e/specs/writing-settings.test.js
Confirm both tests pass and all modified Writing options are restored afterward.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The tests delete the active default category during cleanup, lack coordination with parallel taxonomy tests, and use installation defaults that cannot reliably verify persistence.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The writing-settings tests can race with the parallel taxonomy test and fail to restore default_link_category, risking intermittent CI failures and test-state leakage.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Restore default_link_category after the test
tests/e2e/specs/writing-settings.test.js:16
Please also remember and restore default_link_category. options.php always updates this Writing option, but options-writing.php omits its input when the link manager is disabled (the default). Saving either test's form therefore changes the installed value from 2 to 0, and the current teardown leaves that change behind. Add it here and to numeric option normalization so restoration comparisons remain reliable.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Incomplete locking permits parallel-test races that can erase saved update-service URLs and cause intermittent category-management test failures.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Acquire the Reading lock to prevent losing ping_sites
tests/e2e/specs/writing-settings.test.js:12
Please also acquire READING_SETTINGS to prevent this spec from overlapping with Reading's blog_public changes. If Writing loads while the site is private but submits after Reading restores public visibility, options.php clears the omitted ping_sites field, and neither spec restores it. Holding both locks prevents this interleaving and the lasting loss of update-service URLs.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The writing-settings test changes the default category without coordinating with the parallel taxonomy bulk-delete test, creating a race that can intermittently fail its checkbox assertion.
The reason will be displayed to describe this comment to others. Learn more.
Please have the category bulk-delete test in taxonomies.test.js take the same WRITING_SETTINGS lock. Both specs run in the parallel project. While this test makes its temporary category the default, the Uncategorized row gains a checkbox, and the taxonomy test expects it to have none. The restore in finally runs after that window. Sharing the lock for just the affected test would keep the rest of the taxonomy suite parallel.
Add Playwright E2E coverage for Settings -> Writing (options-writing.php), including saving writing options and verifying the default post category. Uses siteOptions.remember() and a WRITING_SETTINGS lock for isolation.
See #52895.
Restore the original default category before deleting the temporary term, and use non-default mail server values so save assertions verify persistence.
See #52895.
options.php always updates default_link_category on Writing saves, but options-writing.php omits the field when the link manager is disabled, so remember and restore it to avoid leaving 0 behind.
See #52895.
Prevent a parallel Reading test from flipping blog_public while Writing saves, which can clear ping_sites when that option becomes allowed without a form field.
Thanks for the review. Addressed in the latest push - the category bulk-delete test in taxonomies.test.js now takes the WRITING_SETTINGS lock, so it won’t overlap with the Writing Settings default-category change. The rest of the taxonomy suite stays unlocked/parallel.
The reason will be displayed to describe this comment to others. Learn more.
The shared lock addresses my earlier request. One change remains before landing. Please use getByLabel() for the five Writing Settings controls with explicit labels, as the E2E locator guide asks. For example, page.getByLabel( 'Default Post Category', { exact: true } ) exercises the label association when selecting the category. The other labels are Default Post Format, Mail Server, Port and Login Name.
The reason will be displayed to describe this comment to others. Learn more.
The five form controls now use their visible labels. The Writing, Reading and taxonomy specs passed together in 42 single-worker cases and 84 parallel cases. The shared lock also addresses the default-category race we reproduced during the earlier review. Thanks for following through on both changes.
AI review · gpt-6.2-astra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trac ticket: #52895
What?
Adds Playwright E2E tests for the Settings → Writing (
options-writing.php) admin screen.Why?
As part of expanding admin E2E test coverage (#52895),
general-settings.test.jsandreading-settings.test.jsalready cover Settings screens. Adding coverage for Writing Settings verifies saving core writing options and that the default post category is applied to newly created posts.How?
WRITING_SETTINGSlock intests/e2e/utils/locks.jsso Writing Settings tests do not race with other tests.tests/e2e/specs/writing-settings.test.jswith two tests usingsiteOptions.remember()to restore modified options after each test:default_post_format,mailserver_url,mailserver_port, andmailserver_loginpersists the updated values and displays theSettings saved.notice.default_categoryin the UI and creating a post verifies the new post inherits that category.tests/e2e/fixtures/site.jsfordefault_categoryandmailserver_port.Testing Instructions
npm run test:e2e -- tests/e2e/specs/writing-settings.test.jsUse of AI tools