Files
gymflow/tests/login-successful-authentication.spec.ts
2025-12-06 20:21:41 +02:00

32 lines
1.2 KiB
TypeScript

// spec: specs/gymflow-test-plan.md
// seed: tests/core-auth.spec.ts
import { test, expect } from '@playwright/test';
test.describe('I. Core & Authentication', () => {
test('A. Login - Successful Authentication', async ({ page }) => {
// 1. Navigate to the login page (http://localhost:3000/).
await page.goto('http://localhost:3000/');
// 2. Enter a valid email in the email field.
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
// 3. Enter a valid password in the password field.
await page.locator('input[type="password"]').fill('admin123');
// 4. Click the 'Login' button.
await page.getByRole('button', { name: 'Login' }).click();
// Wait for navigation to complete
await page.waitForURL('http://localhost:3000/tracker');
await page.waitForLoadState('networkidle');
// Expected Results:
// - User is redirected to the main application dashboard (e.g., Tracker view).
// - We verify this by checking for the presence of the navigation bar with 'Tracker' button.
await expect(page.getByRole('button', { name: 'Tracker' })).toBeVisible();
// - No error messages are displayed.
await expect(page.locator('text=Invalid credentials')).not.toBeVisible();
});
});