My-Weekly-ToDo-List/tests/debug/login-basic-debug.spec.ts
mARTin-B78 230a4034e8
Some checks are pending
Playwright Tests / test (push) Waiting to run
Test and SonarQube / quality (push) Waiting to run
feat: rate limiting, token hashing, remove mock login route
Erste Abarbeitung des Repository-Audits (siehe TODO.md).

Sicherheit:
- Rate-Limiting für alle vier Auth-Endpunkte. Sie waren unbegrenzt aufrufbar,
  also beliebig viele Mails über den eigenen SMTP-Zugang und beliebig viele
  Rateversuche auf Verifizierungscodes.
- Passwort-Reset-Token nur noch als SHA-256-Hash in der Datenbank. Bisher
  Klartext: Lesezugriff auf die DB genuegte zur Kontouebernahme.
- Tote Mock-Login-Route entfernt. Sie verglich gegen ein hartcodiertes
  Fake-Passwort und war ueber die Middleware-Ausnahme fuer /api/auth/*
  ohne Anmeldung erreichbar.
- Passwort-Reset auf bcrypt-Kosten 12, wie beim Signup.

Reparaturen:
- npm test rief jest auf, obwohl es weder Jest-Config noch Jest-Tests gibt.
  Zeigt jetzt auf Playwright; jest/ts-jest/@types/jest entfernt.
- Falscher sonar.projectKey im Workflow.

Verifiziert per tsc gegen die geaenderten Bereiche: keine neuen Typfehler.

v1.117.0

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-06 20:01:30 +02:00

51 lines
1.9 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Login Page Core Functionality', () => {
test('should load the login page with core elements', async ({ page }) => {
await page.goto('http://localhost:3001/auth/login');
// Basic page verification
await expect(page).toHaveURL(/login/);
await expect(page).toHaveTitle(/Weekly To Do List/);
// Check that the page has essential structure
const h1Element = page.locator('h1');
await expect(h1Element).toBeVisible();
// Check for a login-related paragraph
const loginParagraph = page.getByText(/Sign in to your account|Welcome back!/);
await expect(loginParagraph).toBeVisible();
// Check for form elements
const emailInput = page.locator('input[name="email"]');
const passwordInput = page.locator('input[name="password"]');
const submitButton = page.locator('button[type="submit"]');
await expect(emailInput).toBeVisible();
await expect(passwordInput).toBeVisible();
await expect(submitButton).toBeVisible();
// Check for links
const signupLink = page.getByRole('link', { name: /Don't have an account|Create account/ });
const forgotPasswordLink = page.getByRole('link', { name: /Forgot your password/ });
await expect(signupLink).toBeVisible();
await expect(forgotPasswordLink).toBeVisible();
console.log('✅ Login page loaded successfully with core elements');
});
test('should have basic CSS structure', async ({ page }) => {
await page.goto('http://localhost:3001/auth/login');
// Check that the page has basic styling structure
const body = page.locator('body');
await expect(body).toBeVisible();
// Check for main wrapper div that should have Tailwind classes
const mainWrapper = page.locator('[class*="min-h-screen"]');
await expect(mainWrapper).toBeVisible();
console.log('✅ Basic CSS structure verified');
});
});