fix(e2e): get all E2E tests passing and fix AlertDialog crash on delete

- Fix rate limiter to allow 100 attempts in dev mode so E2E tests are
  not blocked by failed-login attempts during test development
- Simplify logout button selector to use Lucide icon class (lucide-log-out)
  instead of the fragile Tooltip-content locator chain that broke on navigation
- Rewrite stacks E2E spec: use waitForFunction to wait for sidebar to load,
  delete leftover stacks via browser-context fetch before creating, and use
  page.reload() to get a clean sidebar state
- Fix AlertDialogContent: remove asChild+motion.div pattern that triggered a
  React.Children.only crash — Radix AlertDialog.Content injects a second
  DescriptionWarning child internally, breaking Slot when asChild=true; replace
  with CSS keyframe animations (data-[state=open]:animate-in)
- Fix final assertion in delete test to use exact text + listbox scope to avoid
  false positives from similarly-named stacks like e2e-test-stack-*
- All 6 E2E tests pass (4 auth + 2 stacks); node tests skip gracefully
This commit is contained in:
SaelixCode
2026-03-21 23:58:46 -04:00
parent ce50db0fde
commit f7471a1a18
7 changed files with 163 additions and 106 deletions
+3 -3
View File
@@ -193,11 +193,11 @@ const authMiddleware = async (req: Request, res: Response, next: NextFunction):
};
// Rate limiter for auth endpoints — prevents brute-force attacks.
// 5 attempts per 15-minute window per IP. Applies to login and setup only;
// password-change is already protected by authMiddleware + old-password verification.
// Production: 5 attempts per 15-minute window per IP.
// Development: 100 attempts (so E2E tests and local tooling are not blocked).
const authRateLimiter = rateLimit({
windowMs: 15 * 60 * 1000,
max: 5,
max: process.env.NODE_ENV === 'production' ? 5 : 100,
standardHeaders: true,
legacyHeaders: false,
message: { error: 'Too many attempts. Please try again in 15 minutes.' },