Skip to content

tests: split the route overflow e2e matrix to avoid suite-level t... - #463

Closed
harshvardhan60792 wants to merge 1 commit into
Ducksss:mainfrom
harshvardhan60792:fix/108-tests-split-the-route-overflow-e2e-matri
Closed

harshvardhan60792 wants to merge 1 commit into
Ducksss:mainfrom
harshvardhan60792:fix/108-tests-split-the-route-overflow-e2e-matri

Conversation

@harshvardhan60792

@harshvardhan60792 harshvardhan60792 commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

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:release

Registry Checklist

  • Registry changes keep generated public/r output out of git.
  • Component changes update source, manifest, docs, and installer tests together.
  • Payload target code keeps Local API and hook examples transaction-safe.

Notes

Summary by CodeRabbit

  • Tests
    • Expanded route smoke-test coverage with independent checks for component pages.
    • Added validation for page titles, headings, and horizontal layout overflow.
    • Improved test reliability by waiting for fonts to load and excluding preview iframe requests.

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.
@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@harshvardhan60792 is attempting to deploy a commit to the ducksss' projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

Frontend end-to-end validation

Layer / File(s) Summary
Independent route checks
tests/e2e/frontend.e2e.spec.ts
The sequential route-walk test is replaced with independently named tests. Production runs cover all component pages, while development runs cover one component per category. Each test preserves title overrides, blocks preview iframe requests, waits for fonts, and checks the title, H1, and horizontal overflow.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: ducksss

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies splitting the route-overflow E2E matrix to prevent suite-level timeout flakes.
Description check ✅ Passed The description explains the change, verification performed, browser limitation, and includes all required template sections.
Linked Issues check ✅ Passed The change splits route checks, preserves assertions and coverage, isolates failures by path, and retains E2E_PORT compatibility for issue #108.
Out of Scope Changes check ✅ Passed The changes are limited to the relevant frontend E2E test and address the linked issue without unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e518f6b and e06fd8a.

📒 Files selected for processing (1)
  • tests/e2e/frontend.e2e.spec.ts

Comment on lines +532 to +535
h1: catalogTitle,
path: '/components',
title: new RegExp(catalogMetadataTitle),
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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));
}
JS

Repository: 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.

Suggested change
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.

@Ducksss

Ducksss commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Taking this — it's ported to dev as #470 with your authorship preserved on the commit, so closing this one in its favour rather than as a rejection.

The port was necessary because this PR targets main. This repo takes contributions against dev, and main/dev diverge through squash promotes, so merge-base between this branch and dev resolves all the way back to ddd8eb08 (v1.2.0) — simply retargeting the base would have rendered the PR as ~800 files / +65k lines instead of the single file it actually changes. A cherry-pick onto dev keeps the diff honest at +71/-64.

Worth flagging that as a side effect this change had never actually been tested: because it targeted main, pr-gate never triggered on it, and only Vercel and CodeRabbit reported here. #470 puts it through the real release gate for the first time.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: split the route overflow e2e matrix to avoid suite-level timeout flakes

2 participants