Conversation
Walkthrough
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate 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. Comment |
| const logoutBtn = page.getByTestId("logout-btn"); | ||
| await expect(logoutBtn).toHaveText("Go back to the login page"); | ||
| await page.reload(); | ||
| await expect(logoutBtn).toHaveText("Go back to the login page"); |
There was a problem hiding this comment.
This one ensures that the session is correctly removed after logout. Previously it was causing flakes, as session were there
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/web/playwright/insights.e2e.ts (1)
274-276: Escape dynamic regex input (future‑proof exact match).
new RegExp(\^${title}$`)` will misbehave if a future title contains regex metacharacters. It’s not a security risk here (constant array), but it can cause brittle tests and triggers linters.Apply this diff and add a small helper:
- const chartCard = page - .locator("[data-testid='panel-card'] h2") - .filter({ hasText: new RegExp(`^${title}$`) }); + const chartCard = page + .locator("[data-testid='panel-card'] h2") + .filter({ hasText: new RegExp(`^${escapeRegex(title)}$`) });Add once in this file (top-level is fine):
function escapeRegex(s: string) { return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); }apps/web/playwright/fixtures/users.ts (1)
687-691: LGTM. Minor hardening + DRY opportunity.Solid flake guard. Optionally: assert URL after navigation and reuse the same assertion in both logout helpers to avoid drift.
- logout: async () => { - await page.goto("/auth/logout"); - const logoutBtn = page.getByTestId("logout-btn"); - await expect(logoutBtn).toHaveText("Go back to the login page"); - await page.reload(); - await expect(logoutBtn).toHaveText("Go back to the login page"); - }, + logout: async () => { + await page.goto("/auth/logout"); + await expect(page).toHaveURL(/\/auth\/logout$/); + await assertLogoutScreen(page); + await page.reload(); + await assertLogoutScreen(page); + },Add once in this file and reuse from the other
logout(lines 585–591) too:async function assertLogoutScreen(page: Page) { const logoutBtn = page.getByTestId("logout-btn"); await expect(logoutBtn).toHaveText("Go back to the login page"); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
apps/web/playwright/fixtures/users.ts(1 hunks)apps/web/playwright/insights.e2e.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
**/*.ts: For Prisma queries, only select data you need; never useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
apps/web/playwright/fixtures/users.tsapps/web/playwright/insights.e2e.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()in hot paths like loops
Files:
apps/web/playwright/fixtures/users.tsapps/web/playwright/insights.e2e.ts
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
apps/web/playwright/fixtures/users.tsapps/web/playwright/insights.e2e.ts
🪛 ast-grep (0.39.5)
apps/web/playwright/insights.e2e.ts
[warning] 275-275: 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(^${title}$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Detect changes
E2E results are ready! |
Uh oh!
There was an error while loading. Please reload this page.