31 lines
1.2 KiB
TypeScript
31 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.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
|
|
|
|
// 3. Enter a valid password in the password field.
|
|
await page.locator('input[type="password"]').fill('admin1234');
|
|
|
|
// 4. Click the 'Login' button.
|
|
await page.getByRole('button', { name: 'Login' }).click();
|
|
|
|
// Wait for navigation to complete
|
|
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();
|
|
});
|
|
});
|