Files
mockupAWS/frontend/tests/e2e/profile-update.spec.ts
Luca Sacchi Ricciardi beca854176
Some checks are pending
CI/CD - Build & Test / Backend Tests (push) Waiting to run
CI/CD - Build & Test / Frontend Tests (push) Waiting to run
CI/CD - Build & Test / Security Scans (push) Waiting to run
CI/CD - Build & Test / Docker Build Test (push) Blocked by required conditions
CI/CD - Build & Test / Terraform Validate (push) Waiting to run
Deploy to Production / Build & Test (push) Waiting to run
Deploy to Production / Security Scan (push) Blocked by required conditions
Deploy to Production / Build Docker Images (push) Blocked by required conditions
Deploy to Production / Deploy to Staging (push) Blocked by required conditions
Deploy to Production / E2E Tests (push) Blocked by required conditions
Deploy to Production / Deploy to Production (push) Blocked by required conditions
E2E Tests / Run E2E Tests (push) Waiting to run
E2E Tests / Visual Regression Tests (push) Blocked by required conditions
E2E Tests / Smoke Tests (push) Waiting to run
feat: add E2E test for profile update and delete account
2026-04-08 20:46:37 +02:00

46 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { test, expect } from '@playwright/test';
/**
* E2E tests for user profile management:
* - Update name/email via PUT /auth/me
* - Delete (deactivate) account via DELETE /auth/me
*/
test.describe('User Profile Management', () => {
const email = `test-${Date.now()}@example.com`;
const password = 'TestPass123!';
test.beforeAll(async ({ page }) => {
// Register a new user first
await page.goto('/register');
await page.fill('input[placeholder="Full name"]', 'John Doe');
await page.fill('input[placeholder="name@example.com"]', email);
await page.fill('input[placeholder="Password"]', password);
await page.click('button:has-text("Sign up")');
await expect(page).toHaveURL('/')
});
test('update profile information', async ({ page }) => {
// Open settings profile page
await page.goto('/settings/profile');
await page.fill('input[name="first_name"]', 'Jane');
await page.fill('input[name="last_name"]', 'Smith');
await page.fill('input[name="email"]', `jane.${Date.now()}@example.com`);
await page.click('button:has-text("Save Changes")');
await expect(page.locator('p')).toContainText('Jane Smith');
});
test('delete account (softdelete)', async ({ page }) => {
await page.goto('/settings/account');
await page.click('button:has-text("Delete Account")');
// Confirm modal (Playwright handles native confirm)
page.on('dialog', dialog => dialog.accept());
await expect(page).toHaveURL('/login');
// Verify login fails after deletion
await page.fill('input[placeholder="name@example.com"]', email);
await page.fill('input[placeholder="Password"]', password);
await page.click('button:has-text("Sign in")');
await expect(page.locator('div[role="alert"]')).toContainText('Invalid email or password');
});
});