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 Permalink Settings - #16449
Adds Playwright E2E tests for the Settings → Permalinks (options-permalink.php) admin screen.
Why?
As part of expanding admin E2E test coverage #52895, General, Reading, Privacy, and Writing Settings already have coverage. Adding Permalink Settings verifies that custom category/tag bases persist and are used for category archive URLs.
How?
Added a PERMALINK_SETTINGS lock in tests/e2e/utils/locks.js.
Added tests/e2e/specs/permalink-settings.test.js with two tests:
Saving non-default category_base and tag_base values persists them and shows Permalink structure updated.
Setting a custom category base and opening a category archive verifies the URL uses that base.
Restores original permalink options and flushes rewrite rules after each test.
Testing Instructions
Run: npm run test:e2e -- tests/e2e/specs/permalink-settings.test.js
Confirm both tests pass and permalink options are restored afterward.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The tests leave permalink options inconsistent with restored rewrite rules, and the empty-category heading assertion times out and would still fail with posts because of its prefix.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The tests incorrectly expect leading slashes in normalized input values, and failed category deletion can skip cleanup, leaving rewrite rules that affect subsequent tests.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The permalink-only lock leaves settings saves able to overlap with other suites, risking lost notices and intermittent failures unless serialization or a shared lock covers the saves and redirected page loads.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Serialize settings specs that share the settings_errors transient
tests/e2e/specs/permalink-settings.test.js:27
This permalink-only lock allows saves to overlap with the General and Reading settings tests in the parallel project. These forms write the same settings_errors transient, which the redirected page consumes and deletes, so overlapping saves can replace or remove the expected notice and cause intermittent failures. Add this spec to SERIAL_SPECS in tests/e2e/playwright.config.js, or coordinate the settings suites with a shared lock covering each save and redirected page load.
The reason will be displayed to describe this comment to others. Learn more.
Could you cover this in one trip through Settings → Permalinks? Both tests set the same category base, submit the same form, and check the same notice and saved category value. Set both bases in that submission, check the persisted tag and category values after the redirect, then visit the category archive. That keeps the distinct checks and removes one settings save and restore per run.
You can also use the values returned by siteOptions.remember() as the snapshot for cleanup. The current beforeEach remembers all three options and each test immediately reads them again. Keep the rewrite flush after restoration and keep the lock. With the lock, 10 repeated cases passed. Removing it reproduced a lost tag-base value and a restore mismatch.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for consolidating this. One form submission now checks that both bases persist and that the custom category URL serves the right archive. The revised test passed five repeats with four workers, and all ten adjacent taxonomy cases passed. I also checked that the options, rewrite rules and category list returned to their starting values.
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 → Permalinks (
options-permalink.php) admin screen.Why?
As part of expanding admin E2E test coverage #52895, General, Reading, Privacy, and Writing Settings already have coverage. Adding Permalink Settings verifies that custom category/tag bases persist and are used for category archive URLs.
How?
PERMALINK_SETTINGSlock intests/e2e/utils/locks.js.tests/e2e/specs/permalink-settings.test.jswith two tests:category_baseandtag_basevalues persists them and showsPermalink structure updated.Testing Instructions
npm run test:e2e -- tests/e2e/specs/permalink-settings.test.jsUse of AI tools