Repository navigation
tests: split the route overflow e2e matrix to avoid suite-level t... - #463
harshvardhan60792 wants to merge 1 commit into
Conversation
The route-overflow e2e test walked ~24 routes sequentially in one Playwright test, so one slow navigation could push the whole matrix over the per-test timeout even though each route passed alone; splitting it into one test per route (named by path) keeps every route covered while isolating failures and timeouts to the specific route.
|
@harshvardhan60792 is attempting to deploy a commit to the ducksss' projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe frontend route overflow smoke test now generates independent Playwright tests from shared route data. Each test preserves route coverage and validates page title, H1 content, and horizontal overflow after DOM and font readiness. ChangesFrontend end-to-end validation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/e2e/frontend.e2e.spec.ts`:
- Around line 532-535: Update the assertion using catalogMetadataTitle in the h1
metadata check to avoid interpreting its literal pipe character as regex
alternation. Prefer passing catalogMetadataTitle directly if supported;
otherwise escape the value before constructing the RegExp, while preserving the
existing title assertion behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 17dfe578-8643-4fe3-a053-05753f062a88
📒 Files selected for processing (1)
tests/e2e/frontend.e2e.spec.ts
| h1: catalogTitle, | ||
| path: '/components', | ||
| title: new RegExp(catalogMetadataTitle), | ||
| }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== file exists and line count =="
wc -l tests/e2e/frontend.e2e.spec.ts || true
echo "== relevant lines =="
sed -n '500,555p' tests/e2e/frontend.e2e.spec.ts | cat -n
echo "== catalogMetadataTitle definitions/usages =="
rg -n "catalogMetadataTitle|catalogTitle" tests/e2e/frontend.e2e.spec.ts tests || true
echo "== regex behavior probe =="
node - <<'JS'
const catalogMetadataTitle = 'Catalog Title | Something';
const re = new RegExp(catalogMetadataTitle);
for (const value of ['Catalog', 'Catalog Title | Something', 'Other']) {
console.log(value, '=>', re.test(value));
}
JSRepository: Ducksss/payload-components
Length of output: 4285
Escape catalogMetadataTitle before using it as a regex.
catalogMetadataTitle includes a literal |, so new RegExp(catalogMetadataTitle) matches text before and after the pipe. Use the string directly for this assertion, or escape it first.
Proposed fix
- title: new RegExp(catalogMetadataTitle),
+ title: catalogMetadataTitle,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| h1: catalogTitle, | |
| path: '/components', | |
| title: new RegExp(catalogMetadataTitle), | |
| }, | |
| h1: catalogTitle, | |
| path: '/components', | |
| title: catalogMetadataTitle, | |
| }, |
🧰 Tools
🪛 ast-grep (0.45.0)
[warning] 533-533: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(catalogMetadataTitle)
Note: [CWE-1333] Inefficient Regular Expression Complexity
(regexp-from-variable)
[warning] 533-533: Do not use variable for regular expressions
Context: new RegExp(catalogMetadataTitle)
Note: [CWE-1333] Inefficient Regular Expression Complexity. Security best practice.
(regexp-non-literal-typescript)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/e2e/frontend.e2e.spec.ts` around lines 532 - 535, Update the assertion
using catalogMetadataTitle in the h1 metadata check to avoid interpreting its
literal pipe character as regex alternation. Prefer passing catalogMetadataTitle
directly if supported; otherwise escape the value before constructing the
RegExp, while preserving the existing title assertion behavior.
|
Taking this — it's ported to The port was necessary because this PR targets Worth flagging that as a side effect this change had never actually been tested: because it targeted The change itself is the right fix for #108 — per-route tests mean a slow route can't push the matrix past the per-test timeout, failures name the route, and on CI a flaky route retries alone instead of dragging ~70 navigations with it. Thanks for it. |
Fixes #108
The route-overflow e2e test walked ~24 routes sequentially in one Playwright test, so one slow navigation could push the whole matrix over the per-test timeout even though each route passed alone; splitting it into one test per route (named by path) keeps every route covered while isolating failures and timeouts to the specific route.
Testing: Ran 'pnpm exec playwright test frontend.e2e.spec.ts --list' to confirm the single test now enumerates as 22 separate per-route tests named 'route exposes title, h1, and no horizontal overflow', and 'pnpm exec tsc --noEmit' to confirm the file type-checks clean (all pre-existing tsc errors are unrelated, in generated blog-source files). Could not execute the tests against a live browser in this sandbox -- Chromium fails to spawn here (spawn UNKNOWN) even with --no-sandbox -- so this is a narrower structural/type verification, not a full pnpm run test:e2e pass.
Summary
Verification
pnpm test:releaseRegistry Checklist
public/routput out of git.Notes
Summary by CodeRabbit