Add WP Rocket settings no-broken-links check#329
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new end-to-end test to validate that links in the WP Rocket settings UI are not broken (returning 404 status). The test navigates through all WP Rocket settings tabs, collects all links, filters out non-navigational URLs, and verifies each link returns a non-404 status code.
Changes:
- Adds new Cucumber feature file for broken links testing with
@brokenlinks,@smoke, and@setuptags - Implements step definition that collects links from WP Rocket settings tabs, normalizes URLs, and validates HTTP responses
- Adds npm script
test:brokenlinksfor convenient test execution
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/features/broken-links.feature |
Defines the Cucumber scenario for broken links test with appropriate tags |
src/support/steps/broken-links.ts |
Implements the step definition with link collection, URL normalization, and HTTP validation logic |
package.json |
Adds test:brokenlinks npm script following existing project patterns |
…electors to selectors.ts
|
LGTM
Agree. Notes for test(better have screenshot of results):
|
|
@Mai-Saad, @jeawhanlee, thank you both. Below are two screenshots: one showing a test failure due to a 404 link, and another showing the full E2E run. In the E2E run, 61 tests passed and 1 failed; the failed test is unrelated and is due to missing Cloudflare credentials. |


Description
Fixes #301
Adds a new test to ensure links on WP Rocket settings screens are not broken.
Type of change
Detailed scenario
What was tested
npm run test:brokenlinksthat installs/activates WP Rocket and checks settings UI links return non‑404.How to test
Run
npm run test:brokenlinksAffected Features & Quality Assurance Scope
WP Rocket admin settings UI only (link integrity).
Technical description
Documentation
The step collects all a[href] within WP Rocket settings content across tabs, filters out non-navigational links and admin-post actions, normalizes URLs, and asserts none return 404.
New dependencies
None.
Risks
Potential flakiness from external sites (transient 5xx/timeout). Mitigated by only failing on 404 and allowing redirects.
Mandatory Checklist
Code validation
Code style
Unticked items justification
N/A
Additional Checks