Some test fixes

This commit is contained in:
AG
2025-12-06 20:21:41 +02:00
parent 890f4f0958
commit cd0eef9ad6
23 changed files with 48 additions and 44 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,3 @@
# Logs
logs
*.log
npm-debug.log*
@@ -15,7 +14,6 @@ server/prisma/dev.db
test-results/
playwright-report/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea

View File

@@ -5,14 +5,17 @@ export default defineConfig({
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
workers: 1,
reporter: 'html',
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
launchOptions: {
headless: false
}
},
webServer: {
command: 'npm run dev:full',
command: 'rm -f server/prisma/prisma/dev.db && npm run migrate:deploy --prefix server && npm run dev:full & wait-on http-get://localhost:3000',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},

View File

@@ -6,7 +6,9 @@
"scripts": {
"start": "node dist/index.js",
"dev": "ts-node-dev -r dotenv/config --respawn --transpile-only src/index.ts",
"build": "tsc"
"build": "tsc",
"migrate:deploy": "npx prisma migrate deploy"
},
"dependencies": {
"@google/generative-ai": "^0.24.1",

Binary file not shown.

View File

@@ -7,8 +7,8 @@ test.describe('III. Workout Tracking', () => {
test('C. Active Session - Finish Session', async ({ page }) => {
// 1. Start a 'Free Workout' session.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('spinbutton').fill('83');
@@ -17,8 +17,8 @@ test.describe('III. Workout Tracking', () => {
// 2. Log at least one set.
await page.getByRole('textbox', { name: '0' }).fill('Bench Press');
await page.getByRole('button', { name: 'Bench Press' }).click();
await page.getByPlaceholder('0').nth(1).fill('80');
await page.getByPlaceholder('0').nth(2).fill('5');
await page.getByRole('spinbutton').nth(1).fill('80');
await page.getByRole('spinbutton').nth(2).fill('5');
await page.getByRole('button', { name: 'Log Set' }).click();
// 3. Click 'Finish' button.

View File

@@ -7,8 +7,8 @@ test.describe('III. Workout Tracking', () => {
test('C. Active Session - Log Bodyweight Set', async ({ page }) => {
// 1. Start a 'Free Workout' session.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('spinbutton').fill('83');

View File

@@ -7,8 +7,8 @@ test.describe('III. Workout Tracking', () => {
test('C. Active Session - Log Cardio Set', async ({ page }) => {
// 1. Start a 'Free Workout' session.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('spinbutton').fill('83');

View File

@@ -7,8 +7,8 @@ test.describe('III. Workout Tracking', () => {
test('C. Active Session - Log Strength Set', async ({ page }) => {
// 1. Start a 'Free Workout' session (ensure body weight is set).
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('spinbutton').fill('83');

View File

@@ -7,8 +7,8 @@ test.describe('III. Workout Tracking', () => {
test('C. Active Session - Plan Progression and Jump to Step', async ({ page }) => {
// 1. Start a session from a workout plan with multiple steps.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// Create a plan with multiple exercises

View File

@@ -7,8 +7,8 @@ test.describe('III. Workout Tracking', () => {
test('C. Active Session - Quit Session Without Saving', async ({ page }) => {
// 1. Start a 'Free Workout' session.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('spinbutton').fill('83');

View File

@@ -7,7 +7,7 @@ test.describe('User Interface & Experience', () => {
test('Adaptive GUI - Fluid Layout Responsiveness', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://192.168.50.234:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.getByRole('textbox', { name: '0' }).first().fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin');
await page.getByRole('button', { name: 'Login' }).click();

View File

@@ -7,7 +7,7 @@ test.describe('User Interface & Experience', () => {
test('Adaptive GUI - Responsive Charts in Stats', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://192.168.50.234:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.getByRole('textbox', { name: '0' }).first().fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin');
await page.getByRole('button', { name: 'Login' }).click();

View File

@@ -7,8 +7,8 @@ test.describe('II. Workout Management', () => {
test('B. Exercise Library - Create Custom Exercise (Bodyweight with %)', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// 2. Navigate to the 'Profile' section.

View File

@@ -7,8 +7,8 @@ test.describe('II. Workout Management', () => {
test('B. Exercise Library - Create Custom Exercise (Strength)', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// 2. Navigate to the 'Profile' section.

View File

@@ -7,8 +7,8 @@ test.describe('III. Workout Tracking', () => {
test('B. Idle State - Body Weight Defaults from Profile', async ({ page }) => {
// 1. Log in as a regular user with a weight set in their profile.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// Ensure the weight is set in the profile before navigating to tracker

View File

@@ -7,8 +7,8 @@ test.describe('III. Workout Tracking', () => {
test('B. Idle State - Start Free Workout', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// 2. Ensure the tracker is in the idle state. (This is the default view after login)

View File

@@ -7,8 +7,8 @@ test.describe('III. Workout Tracking', () => {
test('B. Idle State - Start Quick Log', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// 2. Ensure the tracker is in the idle state. (This is the default view after login)

View File

@@ -9,8 +9,8 @@ test.describe('I. Core & Authentication', () => {
await page.goto('http://localhost:3000/');
// Log in as admin to create a new user for testing first-time login
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// Navigate to profile and create a new user with a short password

View File

@@ -9,7 +9,7 @@ test.describe('I. Core & Authentication', () => {
await page.goto('http://localhost:3000/');
// 2. Enter an invalid email or password.
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('invalid@gymflow.ai');
await page.locator('input[type="email"]').fill('invalid@gymflow.com');
await page.locator('input[type="password"]').fill('wrongpassword');
// 3. Click the 'Login' button.

View File

@@ -9,15 +9,16 @@ test.describe('I. Core & Authentication', () => {
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');
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('admin1234');
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:

View File

@@ -7,8 +7,8 @@ test.describe('IV. Data & Progress', () => {
test('A. Session History - Delete Sporadic Set', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// 2. Log at least one sporadic set.

View File

@@ -7,8 +7,8 @@ test.describe('V. User & System Management', () => {
test('A. User Profile - Change Password (Too Short)', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// 2. Navigate to the 'Profile' section.
@@ -27,7 +27,7 @@ test.describe('V. User & System Management', () => {
// (Implicitly tested by the fact that the error message is displayed and no success message)
// Reset password to original for subsequent tests
await page.getByRole('textbox', { name: 'New Password' }).fill('admin1234');
await page.getByRole('textbox', { name: 'New Password' }).fill('admin123');
await page.getByRole('button', { name: 'OK' }).click();
await expect(page.getByText('Password changed')).toBeVisible();
});

View File

@@ -7,8 +7,8 @@ test.describe('V. User & System Management', () => {
test('A. User Profile - Change Password', async ({ page }) => {
// 1. Log in as a regular user.
await page.goto('http://localhost:3000/');
await page.getByRole('textbox', { name: 'user@gymflow.ai' }).fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin1234');
await page.locator('input[type="email"]').fill('admin@gymflow.ai');
await page.locator('input[type="password"]').fill('admin123');
await page.getByRole('button', { name: 'Login' }).click();
// 2. Navigate to the 'Profile' section.
@@ -34,7 +34,7 @@ test.describe('V. User & System Management', () => {
// Change password back to original for subsequent tests
await page.getByRole('button', { name: 'Profile' }).click();
await page.getByRole('textbox', { name: 'New Password' }).fill('admin1234');
await page.getByRole('textbox', { name: 'New Password' }).fill('admin123');
await page.getByRole('button', { name: 'OK' }).click();
await expect(page.getByText('Password changed')).toBeVisible();
});