pruebas e2e

This commit is contained in:
2025-12-23 11:36:48 -03:00
parent f695ed7213
commit c2d73b97db
30 changed files with 252 additions and 19 deletions
+33
View File
@@ -0,0 +1,33 @@
import { test, expect } from '@playwright/test';
test.describe('Student Flow', () => {
test('should login and view catalog', async ({ page }) => {
// 1. Register/Login
// For simplicity, we assume registration or reuse existing
await page.goto('/auth/login');
// Register link?
// await page.click('text=Sign up');
// ... fill registration ...
// OR just login if we seed the DB.
// For E2E on fresh DB, we might need to register first.
// Let's try to register a new user every time to be safe
// Let's try to register a new user every time to be safe
const email = `student_${Date.now()}@test.com`;
await page.goto('/auth/register');
await page.fill('[placeholder="John Doe"]', 'Test Student');
await page.fill('[placeholder="name@company.com"]', email);
await page.fill('[placeholder="••••••••"]', 'password123');
await page.click('button[type="submit"]');
// Should redirect to dashboard/catalog
await expect(page).toHaveURL('/', { timeout: 15000 });
await expect(page.locator('h1')).toContainText('Available Courses', { timeout: 10000 });
// Check if the course from instructor flow is visible (might need refresh)
await page.reload();
// await expect(page.locator('text=Playwright E2E Course')).toBeVisible();
});
});