# GymFlow Application Test Plan

## Application Overview

Comprehensive test plan for the GymFlow web application, covering authentication, workout management, tracking, data visualization, user/admin management, and adaptive GUI responsiveness. This plan is based on the provided requirements.md.

## Test Scenarios

### 1. I. Core & Authentication

**Seed:** `tests/core-auth.spec.ts`

#### 1.1. A. Login - Successful Authentication

**File:** `tests/core-auth.spec.ts`

**Steps:**
  1. Navigate to the login page (http://192.168.50.234:3000/).
  2. Enter a valid email in the email field.
  3. Enter a valid password in the password field.
  4. Click the 'Login' button.

**Expected Results:**
  - User is redirected to the main application dashboard (e.g., Tracker view).
  - No error messages are displayed.

#### 1.2. A. Login - Invalid Credentials

**File:** `tests/core-auth.spec.ts`

**Steps:**
  1. Navigate to the login page.
  2. Enter an invalid email or password.
  3. Click the 'Login' button.

**Expected Results:**
  - An error message 'Invalid credentials' or similar is displayed.
  - User remains on the login page.

#### 1.3. A. Login - First-Time Password Change

**File:** `tests/core-auth.spec.ts`

**Steps:**
  1. Navigate to the login page.
  2. Log in with a first-time user's temporary credentials.
  3. Enter a new password (at least 4 characters).
  4. Click 'Save' or 'Change Password' button.

**Expected Results:**
  - User is prompted to change password on first login.
  - New password is set successfully.
  - User is logged into the application.
  - No error messages are displayed.

#### 1.4. A. Login - First-Time Password Change (Password too short)

**File:** `tests/core-auth.spec.ts`

**Steps:**
  1. Navigate to the login page.
  2. Log in with a first-time user's temporary credentials.
  3. Enter a new password less than 4 characters.
  4. Click 'Save' or 'Change Password' button.

**Expected Results:**
  - An error message 'Password too short' is displayed.
  - User remains on the password change screen.

#### 1.5. A. Login - Language Selection (English)

**File:** `tests/core-auth.spec.ts`

**Steps:**
  1. Navigate to the login page.
  2. Select 'English' from the language dropdown.

**Expected Results:**
  - All UI text elements on the login page are displayed in English.

#### 1.6. A. Login - Language Selection (Russian)

**File:** `tests/core-auth.spec.ts`

**Steps:**
  1. Navigate to the login page.
  2. Select 'Русский' from the language dropdown.

**Expected Results:**
  - All UI text elements on the login page are displayed in Russian.

#### 1.7. B. Navigation - Desktop Navigation Rail

**File:** `tests/core-auth.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Ensure the browser window is wide enough to trigger desktop layout (e.g., >768px width).
  3. Verify the vertical navigation rail is present on the left side.
  4. Click on each navigation item (Tracker, Plans, History, Stats, AI Coach, Profile).

**Expected Results:**
  - The corresponding section of the application is displayed for each click.
  - The navigation rail remains visible and functional.

#### 1.8. B. Navigation - Mobile Bottom Navigation Bar

**File:** `tests/core-auth.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Ensure the browser window is narrow enough to trigger mobile layout (e.g., <768px width).
  3. Verify the bottom navigation bar is present.
  4. Click on each navigation item (Tracker, Plans, History, Stats, AI Coach, Profile).

**Expected Results:**
  - The corresponding section of the application is displayed for each click.
  - The bottom navigation bar remains visible and functional.

### 2. II. Workout Management

**Seed:** `tests/workout-management.spec.ts`

#### 2.1. A. Workout Plans - Create New Plan

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Plans' section.
  3. Click the 'Add New Plan' or '+' FAB button.
  4. Enter a 'Plan Name' (e.g., 'My New Strength Plan').
  5. Enter a 'Description' (e.g., 'Focus on compound lifts').
  6. Add an exercise to the plan.
  7. Click 'Save'.

**Expected Results:**
  - A new plan with the specified name and description appears in the plans list.
  - The plan contains the added exercise.
  - No error messages are displayed.

#### 2.2. A. Workout Plans - Edit Existing Plan

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Plans' section.
  3. Create a new plan (if none exist).
  4. Click the 'Edit' icon for an existing plan.
  5. Modify the 'Plan Name' and 'Description'.
  6. Add/remove exercises, or reorder them.
  7. Click 'Save'.

**Expected Results:**
  - The plan is updated with the new name, description, and exercise list.
  - No error messages are displayed.

#### 2.3. A. Workout Plans - Delete Plan

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Plans' section.
  3. Create a new plan (if none exist).
  4. Click the 'Delete' icon for an existing plan.
  5. Confirm deletion when prompted.

**Expected Results:**
  - The plan is removed from the list.
  - No error messages are displayed.

#### 2.4. A. Workout Plans - Reorder Exercises within a Plan

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Plans' section.
  3. Create a plan with at least two exercises.
  4. Enter the plan editor.
  5. Drag an exercise to a new position.
  6. Verify the order changes.
  7. Click 'Save'.

**Expected Results:**
  - Exercises are reordered correctly within the plan editor.
  - The reordered plan is saved and reflected in the view.

#### 2.5. A. Workout Plans - Start Session from Plan

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Plans' section.
  3. Create a plan with at least one exercise.
  4. Click 'Start' button for the created plan.
  5. If a plan description is present, confirm the plan start.

**Expected Results:**
  - The application transitions to the 'Active Session' view.
  - The session starts with the selected plan's exercises.
  - The timer starts running.

#### 2.5a. A. Workout Plans - Create Plan from Session

**File:** `tests/plan-from-session.spec.ts`

**Steps:**
  1. User completes a session with multiple sets (e.g., 2 sets of Pushups, 1 set of Squats).
  2. Navigate to 'History'.
  3. Click 'Create Plan' from the session menu.
  4. Verify the Plan Editor opens.
  5. **Verify Steps**: The plan should contain exactly 3 steps (Pushups, Pushups, Squats).

**Expected Results:**
  - The Plan Editor is pre-filled.
  - Plan steps mirror the session sets 1:1.


#### 2.6. B. Exercise Library - Create Custom Exercise (Strength)

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Exercise Manager'.
  4. Click 'Create Exercise'.
  5. Enter an exercise name (e.g., 'Custom Bicep Curl').
  6. Select 'Strength' as the type.
  7. Click 'Create'.

**Expected Results:**
  - The new exercise appears in the exercise list.
  - The exercise type is correctly displayed as Strength.
  - No error messages.

#### 2.7. B. Exercise Library - Create Custom Exercise (Bodyweight with %)

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Exercise Manager'.
  4. Click 'Create Exercise'.
  5. Enter an exercise name (e.g., 'Advanced Push-up').
  6. Select 'Bodyweight' as the type.
  7. Enter '50' for 'Body Weight Percentage'.
  8. Click 'Create'.

**Expected Results:**
  - The new exercise appears in the exercise list.
  - The exercise type is correctly displayed as Bodyweight with 50% body weight percentage.
  - No error messages.

#### 2.8. B. Exercise Library - Edit Exercise Name

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Exercise Manager'.
  4. Click the 'Edit' icon for an existing exercise.
  5. Change the exercise name.
  6. Click 'Save'.

**Expected Results:**
  - The exercise name is updated in the list.
  - No error messages.

#### 2.9. B. Exercise Library - Archive/Unarchive Exercise

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Exercise Manager'.
  4. Click the 'Archive' icon for an existing exercise.
  5. Verify the exercise is marked as archived (or disappears if filtered).
  6. Toggle 'Show Archived' checkbox.
  7. Click the 'Unarchive' icon for the same exercise.

**Expected Results:**
  - Exercise is archived and unarchived successfully.
  - Visibility changes correctly based on 'Show Archived' filter.

#### 2.10. B. Exercise Library - Filter Exercises by Name

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Exercise Manager'.
  4. Enter a partial exercise name into the filter field.
  5. Verify only matching exercises are displayed.

**Expected Results:**
  - The exercise list is dynamically filtered to show only exercises whose names contain the typed text.

#### 2.11. B. Exercise Library - New Exercise Name field capitalization (mobile)

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Plans' section.
  3. Click the 'Add New Plan' or '+' FAB button.
  4. Click 'Add Exercise', then 'Create Exercise'.
  5. Verify the virtual keyboard for the 'Exercise Name' field suggests capitalizing each word (e.g., `text-transform: capitalize` or `inputmode="text" autocapitalize="words"`).

**Expected Results:**
  - The 'Name' input field for new exercises correctly prompts for capitalization on mobile keyboards, enhancing user experience.

#### 2.12. B. Exercise Library - Create Unilateral Exercise

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section -> 'Exercise Manager'.
  3. Click 'Create Exercise'.
  4. Enter name 'One Arm Row'.
  5. Select 'Strength' type.
  6. Toggle the 'Unilateral' switch to ON.
  7. Click 'Create'.

**Expected Results:**
  - The new exercise is created.
  - It is marked as unilateral in the database/UI logic (though visual indicator might differ).

#### 2.13. B. Exercise Library - Create Special Type Exercises

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Create a 'Static' exercise (e.g., 'Plank').
  3. Create a 'High Jump' exercise (e.g., 'Box Jump').
  4. Create a 'Long Jump' exercise (e.g., 'Broad Jump').
  5. Create a 'Plyometric' exercise (e.g., 'Burpees').

**Expected Results:**
  - All exercises are created successfully with their respective types.

#### 2.14. A. Workout Plans - Create Plan with AI (Parametrized)

**File:** `tests/ai-plan-creation.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Plans' section.
  3. Click the '+' FAB button.
  4. Select 'With AI' option.
  5. **Verify Defaults**: Duration 60, Equipment 'No equipment', Level 'Intermediate', Intensity 'Moderate'.
  6. **Modify Inputs**: 
     - Set Duration to 45 mins.
     - Set Equipment to 'Free weights'.
     - Set Level to 'Advanced'.
  7. Click 'Generate' (mocks AI response).
  8. **Iterative Flow**: 
     - Verify preview table appears.
     - Click 'Generate' again.
     - Click 'Save Plan'.

**Expected Results:**
  - A new plan is created with the AI-suggested content.
  - The plan appears in the plans list.
  - New exercises are created with correct `type` and `isUnilateral` flags.

#### 2.15. B. Tracker - Empty State AI Prompt

**File:** `tests/workout-management.spec.ts`

**Steps:**
  1. Log in as a regular user with no existing plans.
  2. Navigate to the 'Tracker' section (Idle View).
  3. Verify the placeholder message "No workout plans yet." is displayed.
  4. Click the "Ask your AI coach to create one" link.

**Expected Results:**
  - User is navigated to the Plans view.
  - The AI Side Sheet is automatically opened.

### 3. III. Workout Tracking

**Seed:** `tests/workout-tracking.spec.ts`

#### 3.1. B. Idle State - Start Free Workout

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Ensure the tracker is in the idle state.
  3. Enter a body weight in the input field (e.g., '75.5').
  4. Click 'Free Workout' button.

**Expected Results:**
  - The application transitions to 'Active Session' view.
  - The timer starts.
  - The entered body weight is displayed in the active session header.

#### 3.2. B. Idle State - Start Quick Log

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Ensure the tracker is in the idle state.
  3. Click 'Quick Log' button.

**Expected Results:**
  - The application transitions to 'Sporadic Logging' view.

#### 3.3. B. Idle State - Body Weight Defaults from Profile

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Change weight in profile to '75.5'.
  3. Navigate to the 'Tracker' section (Idle View).
  4. Ensure the 'My Weight' field defaults to '75.5'.

**Expected Results:**
  - The 'My Weight' field in the Idle View defaults to the weight specified in the user's profile.

#### 3.4. C. Active Session - Log Strength Set

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a 'Free Workout' session (ensure body weight is set).
  2. Select a Strength exercise (e.g., 'Bench Press').
  3. Enter 'Weight' (e.g., '80') and 'Reps' (e.g., '5').
  4. Click 'Log Set'.

**Expected Results:**
  - The set is added to the session history.
  - Input fields are cleared.
  - No error messages are displayed.

#### 3.5. C. Active Session - Log Bodyweight Set

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a 'Free Workout' session.
  2. Select a Bodyweight exercise (e.g., 'Pull-up').
  3. Enter 'Weight' as positive (e.g., '10') and verify. Then enter negative (e.g. '-30') and verify.
  4. Enter 'Reps' (e.g., '8').
  5. Click 'Log Set'.

**Expected Results:**
  - The set is added to the session history.
  - Input fields are cleared.
  - Body weight percentage is used in calculations.
  - Displayed weight includes sign: `+10 kg` or `-30 kg`.
  - No error messages are displayed.

#### 3.6. C. Active Session - Log Cardio Set

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a 'Free Workout' session.
  2. Select a Cardio exercise (e.g., 'Running').
  3. Enter 'Time (sec)' (e.g., '300') and 'Distance (m)' (e.g., '1000').
  4. Click 'Log Set'.

**Expected Results:**
  - The set is added to the session history.
  - Input fields are cleared.
  - No error messages are displayed.

#### 3.7. C. Active Session - Edit Logged Set

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a 'Free Workout' session.
  2. Log at least one set.
  3. Click the 'Edit' icon for a logged set.
  4. Modify 'Weight' or 'Reps'.
  5. Click 'Save'.

**Expected Results:**
  - The set's details are updated in the session history.
  - No error messages.

#### 3.8. C. Active Session - Delete Logged Set

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a 'Free Workout' session.
  2. Log at least one set.
  3. Click the 'Delete' icon for a logged set.
  4. Confirm deletion.

**Expected Results:**
  - The set is removed from the session history.
  - No error messages.

#### 3.9. C. Active Session - Finish Session

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a 'Free Workout' session.
  2. Log at least one set.
  3. Click 'Finish' button.
  4. Confirm finishing the session.

**Expected Results:**
  - Session data is saved.
  - User is returned to the 'Idle State' of the Tracker.
  - No error messages.

#### 3.10. C. Active Session - Quit Session Without Saving

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a 'Free Workout' session.
  2. Log at least one set.
  3. Click 'More' (three dots) menu.
  4. Select 'Quit Without Saving'.
  5. Confirm quitting.

**Expected Results:**
  - Session data is discarded.
  - User is returned to the 'Idle State' of the Tracker.
  - No error messages.

#### 3.11. C. Active Session - Plan Progression and Jump to Step

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a session from a workout plan with multiple steps.
  2. Log sets for the first exercise in the plan until it's considered complete.
  3. Observe the plan progression to the next step.
  4. Click on the plan progression bar to expand the plan list.
  5. Click on a different (e.g., third) step in the expanded plan list.

**Expected Results:**
  - The current exercise automatically advances to the next planned exercise.
  - Clicking a step in the plan list navigates the active session to that exercise.

#### 3.12. D. Sporadic Logging - Log Strength Sporadic Set

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to 'Quick Log' mode.
  3. Select a Strength exercise.
  4. Enter 'Weight' and 'Reps'.
  5. Click 'Log Set'.

**Expected Results:**
  - The sporadic set is added to today's history in the Sporadic Logging view.
  - Input fields are cleared.
  - A success message is briefly displayed.

#### 3.13. D. Sporadic Logging - Exercise Search and Clear

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to 'Quick Log' mode.
  3. Type a partial exercise name into the 'Select Exercise' field (e.g., 'ben').
  4. Verify the list of exercises is filtered.
  5. Click on the 'Select Exercise' field again (or focus it).

**Expected Results:**
  - The exercise list filters dynamically as the user types.
  - The search field content is cleared on focus.

#### 3.14. C. Active Session - Log Unilateral Set

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a Free Workout (or Plan with unilateral exercise).
  2. Select a Unilateral exercise (created in 2.12).
  3. Enter Weight/Reps.
  4. Select 'L' from the Side selector.
  5. Click 'Log Set'.
  6. Repeat for 'R' side.
  7. Repeat for 'A' side.
  8. Click 'Edit' on one of the logged sets.
  9. Change side using the 'L'/'A'/'R' buttons and save.

**Expected Results:**
  - Sets are logged with the correct 'Left'/'Right'/'Alternately' indicators visible in the history.
  - The Edit mode correctly shows 'L'/'A'/'R' buttons and updates the set side upon save.

#### 3.15. C. Active Session - Log Special Type Set

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Start a Free Workout.
  2. Select a Static exercise -> Enter Duration.
  3. Select a High Jump exercise -> Enter Height.
  4. Select a Long Jump exercise -> Enter Distance.
  5. Select a Plyometric exercise -> Enter Reps.
  6. Log a set for each.

**Expected Results:**
  - Each set is logged with the correct specific metric (Height, Distance, Duration, etc.).

#### 3.16. C. Rest Timer - Manual Edit & Validation

**File:** `tests/rest-timer.spec.ts`

**Steps:**
  1. Start a Free Workout (or Quick Log).
  2. Expand the Rest Timer FAB.
  3. Click 'Edit'.
  4. Type '90' -> Verify '1:30' (if auto-format implemented) or manual '1:30'.
  5. Attempt to type non-digits -> Verify they are ignored.
  6. Attempt to type '10:99' (invalid seconds) -> Verify it corrects to '10:59'.
  7. Save.

**Expected Results:**
  - Input field accepts only valid characters.
  - Seconds are clamped to 59.
  - Timer value updates correctly upon save.

#### 3.17. C. Rest Timer - Context & Persistence

**File:** `tests/rest-timer.spec.ts`

**Steps:**
  1. Start a Free Workout (Idle Timer defaults to 2:00 or user profile setting).
  2. Edit timer to '0:45'.
  3. Start timer.
  4. Quit session (or navigate to Quick Log).
  5. Start Quick Log (or new Free Session).
  6. Verify timer default is now '0:45'.

**Expected Results:**
  - Timer value persists across different session modes (active to sporadic).
  - Last manually set value becomes the new default for manual modes.

#### 3.17. B. Idle State - Days Off Training Logic

**File:** `tests/workout-tracking.spec.ts`

**Steps:**
  1. Log in as a new user (0 workouts).
  2. Verify message: "Do your very first workout today.".
  3. Start and Finish a Free Workout.
  4. Verify message: "Last workout: Today".

**Expected Results:**
  - Messages update dynamically based on workout history.
  - "Ready?" text is NOT visible.

#### 3.18. C. Rest Timer - Plan Integration

**File:** `tests/rest-timer.spec.ts`

**Steps:**
  1. Create a Plan with Step A (Rest: 30s) and Step B (Rest: 60s).
  2. Start the Plan.
  3. Verify Timer shows '0:30'. Start it.
  4. Log Set for Step A while timer is running.
  5. Verify Timer continues running (does not reset).
  6. Reset Timer manually (or wait for finish).
  7. Verify Timer now shows '1:00' (for Step B).

**Expected Results:**
  - Timer accurately reflects specific rest times per step.
  - Active timer is NOT interrupted by logging sets (smart non-reset).
  - Timer updates duration to next step's rest time once idle/reset, but remains PAUSED/IDLE (does not auto-start).





### 4. IV. Data & Progress

**Seed:** `tests/data-progress.spec.ts`

#### 4.1. A. Session History - View Past Sessions

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Complete at least one workout session and log at least one sporadic set.
  3. Navigate to the 'History' section.

**Expected Results:**
  - All past workout sessions and sporadic sets are displayed, grouped by date.
  - Each entry shows key summary information (date, duration, plan name, total work, exercise count).

#### 4.2. A. Session History - View Detailed Session

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Complete at least one workout session.
  3. Navigate to the 'History' section.
  4. Click on a workout session entry.

**Expected Results:**
  - A detailed view of the session opens, showing all individual sets with their metrics.
  - Session start/end times and body weight are displayed.

#### 4.3. A. Session History - Edit Past Session Details

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Complete a workout session.
  3. Navigate to the 'History' section.
  4. Open the detailed view of a session.
  5. Modify the 'Start Time', 'End Time', or 'Body Weight'.
  6. Click 'Save'.

**Expected Results:**
  - Session details are updated successfully.
  - The changes are reflected in the history view.

#### 4.4. A. Session History - Edit Individual Set in Past Session

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Complete a workout session with multiple sets.
  3. Navigate to the 'History' section.
  4. Open the detailed view of a session.
  5. Click the 'Edit' icon for an individual set.
  6. Modify a metric (e.g., weight, reps).
  7. Click 'Save'.

**Expected Results:**
  - The individual set's metrics are updated.
  - The changes are reflected in the detailed session view.

#### 4.5. A. Session History - Verify Edit Fields per Exercise Type

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Create exercises of different types (Strength, Cardio, etc.).
  3. Log a session containing these exercises.
  4. Navigate to History and open the session details.
  5. Click 'Edit' (pencil icon) for each set.
  6. Verify the edit modal displays the correct fields for that exercise type (e.g. Weight/Reps for Strength, Time/Distance for Cardio).

**Expected Results:**
  - The correct input fields are visible for each exercise type.
  - No irrelevant fields are displayed.

#### 4.6. A. Session History - Delete Past Session

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Complete a workout session.
  3. Navigate to the 'History' section.
  4. Click the 'Delete' icon for a session.
  5. Confirm deletion.

**Expected Results:**
  - The session is permanently removed from the history.
  - No error messages.

#### 4.7. A. Session History - Edit Sporadic Set

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Log at least one sporadic set.
  3. Navigate to the 'History' section.
  4. Locate and click the 'Edit' icon for a sporadic set.
  5. Modify a metric (e.g., weight, reps, duration).
  6. Click 'Save'.

**Expected Results:**
  - The sporadic set's metrics are updated.
  - The changes are reflected in the history view.

#### 4.8. A. Session History - Delete Sporadic Set

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Log at least one sporadic set.
  3. Navigate to the 'History' section.
  4. Locate and click the 'Delete' icon for a sporadic set.
  5. Confirm deletion.

**Expected Results:**
  - The sporadic set is permanently removed from the history.

#### 4.9. A. Session History - Export CSV

**File:** `tests/history-export.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Complete at least one workout session.
  3. Navigate to the 'History' section.
  4. Click the 'Export CSV' button (Download icon).

**Expected Results:**
  - A CSV file is downloaded.
  - The CSV filename contains 'gymflow_history'.
  - The CSV content contains headers and data rows corresponding to the user's workout history.
  - No error messages.

#### 4.10. B. Performance Statistics - View Volume Chart

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Complete at least two workout sessions with logged sets.
  3. Navigate to the 'Stats' section.

**Expected Results:**
  - The 'Total Volume' line chart is displayed.
  - The chart accurately reflects the total weight lifted per session over time.

#### 4.11. B. Performance Statistics - View Set Count Chart

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Complete at least two workout sessions with logged sets.
  3. Navigate to the 'Stats' section.

**Expected Results:**
  - The 'Set Count' bar chart is displayed.
  - The chart accurately reflects the number of sets performed per session over time.

#### 4.12. B. Performance Statistics - View Body Weight Chart

**File:** `tests/data-progress.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Log body weight at least twice (e.g., via profile or session start).
  3. Navigate to the 'Stats' section.

**Expected Results:**
  - The 'Body Weight' line chart is displayed.
  - The chart accurately reflects the user's body weight changes over time.

### 5. V. User & System Management

**Seed:** `tests/user-system-management.spec.ts`

#### 5.1. A. User Profile - Update Personal Information

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Modify 'Weight', 'Height', 'Birth Date', and 'Gender'.
  4. Click 'Save Profile'.

**Expected Results:**
  - Profile information is updated successfully.
  - A success snackbar message is displayed.
  - The updated information is reflected upon refreshing the profile or re-logging in.

#### 5.2. A. User Profile - Change Password

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Enter a new password (min 4 characters) in the 'Change Password' field.
  4. Click 'OK'.

**Expected Results:**
  - Password change is successful.
  - A success message is displayed.
  - The user can log in with the new password.

#### 5.3. A. User Profile - Change Password (Too Short)

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Enter a password less than 4 characters in the 'Change Password' field.
  4. Click 'OK'.

**Expected Results:**
  - An error message 'Password too short' is displayed.
  - Password is not changed.

#### 5.4. A. User Profile - Dedicated Daily Weight Logging

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Weight Tracker'.
  4. Enter today's weight (e.g., '72.3').
  5. Click 'Log' button.

**Expected Results:**
  - The weight is logged for the current day.
  - The new record appears in the weight history list.
  - A success snackbar message is displayed.

#### 5.5. A. User Profile - Language Preference Change

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Profile' section.
  3. Select a different language (e.g., 'Русский') from the language dropdown.
  4. Click 'Save Profile'.

**Expected Results:**
  - The UI language immediately switches to the selected language.
  - The preference persists across sessions.

#### 5.6. A. User Profile - Delete Own Account

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as a regular user (not admin).
  2. Navigate to the 'Profile' section.
  3. Locate 'Delete Account' section.
  4. Click 'Delete' button.
  5. Confirm deletion when prompted.

**Expected Results:**
  - User account is deleted.
  - User is logged out and redirected to the login page.

#### 5.7. B. AI Coach - Send a Message

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'AI Coach' section.
  3. Type a message into the input field (e.g., 'What's a good workout for chest?').
  4. Click 'Send' button.

**Expected Results:**
  - User's message appears in the chat.
  - AI Coach responds with relevant advice.
  - No error messages.

#### 5.8. C. Admin Panel - Create New User

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as an 'ADMIN' user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Admin Area'.
  4. Enter a new 'Email' and 'Password' for a new user.
  5. Click 'Create User'.

**Expected Results:**
  - A new user is created and appears in the user list.
  - A success message is displayed.
  - The new user can log in with the created credentials.

#### 5.9. C. Admin Panel - View User List

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as an 'ADMIN' user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Admin Area'.
  4. Click to expand 'Users List'.

**Expected Results:**
  - A list of all users (excluding the current admin) is displayed, showing their email, role, and blocked status.

#### 5.10. C. Admin Panel - Block/Unblock User

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as an 'ADMIN' user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Admin Area' and 'Users List'.
  4. Locate a non-admin user.
  5. Click the 'Block' icon for that user.
  6. Verify the user's status changes to 'Blocked'.
  7. Click the 'Unblock' icon for the same user.

**Expected Results:**
  - User is blocked and unblocked successfully.
  - Status updates are reflected in the user list.

#### 5.11. C. Admin Panel - Reset User Password

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as an 'ADMIN' user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Admin Area' and 'Users List'.
  4. Locate a non-admin user.
  5. Enter a new password (min 4 characters) in the 'Reset Password' field for that user.
  6. Click 'Reset Pass' button.

**Expected Results:**
  - User's password is reset.
  - A success alert is displayed.
  - The user can log in with the new password.

#### 5.12. C. Admin Panel - Delete User

**File:** `tests/user-system-management.spec.ts`

**Steps:**
  1. Log in as an 'ADMIN' user.
  2. Navigate to the 'Profile' section.
  3. Expand 'Admin Area' and 'Users List'.
  4. Locate a non-admin user.
  5. Click the 'Delete' icon for that user.
  6. Confirm deletion.

**Expected Results:**
  - The user is permanently removed from the system.
  - The user no longer appears in the user list.


#### 5.13. A. Default Exercises - Creation on Signup

**File:** `tests/default-exercises.spec.ts`

**Steps:**
  1. Register a NEW user via API or UI.
  2. Log in as that user.
  3. Navigate to Profile -> Exercise Manager (or query API).
  4. Verify the list of exercises.

**Expected Results:**
  - The user has a pre-populated list of exercises (e.g., Push-Ups, Squats, Sprint).
  - The exercises match the configuration in `server/default_exercises.csv`.
  - Properties like `type` and `isUnilateral` are correctly set.

### 6. VI. User Interface & Experience

**Seed:** `tests/ui-ux.spec.ts`

#### 6.1. A. Adaptive GUI - Mobile Navigation (Width < 768px)

**File:** `tests/ui-ux.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Resize the browser window to a mobile width (e.g., 375px).
  3. Verify the bottom navigation bar is visible and functional.
  4. Verify the desktop navigation rail is hidden.

**Expected Results:**
  - Bottom navigation bar is present with correct icons and labels.
  - Desktop navigation rail is not visible.

#### 6.2. A. Adaptive GUI - Desktop Navigation (Width >= 768px)

**File:** `tests/ui-ux.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Resize the browser window to a desktop width (e.g., 1280px).
  3. Verify the vertical navigation rail is visible and functional.
  4. Verify the mobile bottom navigation bar is hidden.

**Expected Results:**
  - Vertical navigation rail is present with correct icons and labels.
  - Mobile bottom navigation bar is not visible.

#### 6.3. A. Adaptive GUI - Fluid Layout Responsiveness

**File:** `tests/ui-ux.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate through various sections (e.g., Plans, Profile, History).
  3. Gradually resize the browser window from desktop to mobile widths and vice-versa.

**Expected Results:**
  - Content layouts adapt smoothly to different screen sizes without horizontal scrolling or overlapping elements.
  - All interactive elements remain accessible and usable.

#### 6.4. A. Adaptive GUI - Responsive Charts in Stats

**File:** `tests/ui-ux.spec.ts`

**Steps:**
  1. Log in as a regular user.
  2. Navigate to the 'Stats' section.
  3. Gradually resize the browser window from desktop to mobile widths and vice-versa.

**Expected Results:**
  - The volume, set count, and body weight charts resize and re-render correctly, maintaining readability and data integrity across different screen sizes.

### 7. VII. AI Coach Features

**Seed:** `tests/ai-coach.spec.ts`

#### 7.1. A. AI Coach - Basic Conversation & Markdown
**File:** `tests/ai-coach.spec.ts`

**Steps:**
1. Log in as a regular user.
2. Navigate to 'AI Coach'.
3. Type a message (e.g., "How to do a pushup?").
4. Click 'Send'.
5. Verify response appears.

**Expected Results:**
- AI responds with a message.
- Response renders Markdown correctly (e.g., bullet points, bold text).

#### 7.2. A. AI Coach - Bookmark Message
**File:** `tests/ai-coach.spec.ts`

**Steps:**
1. Send a message to AI Coach and receive a response.
2. Click the 'Bookmark' icon on the AI's response.
3. Verify a success notification (Snackbar).
4. Reload the page.

**Expected Results:**
- The message remains bookmarked (icon state persists).

#### 7.3. A. AI Coach - View Saved Messages
**File:** `tests/ai-coach.spec.ts`

**Steps:**
1. Bookmark at least one message.
2. Click the 'Saved Messages' icon in the top bar.
3. Verify the Saved Messages sheet opens.

**Expected Results:**
- The sheet displays the bookmarked message content.
- The content is rendered in Markdown.

#### 7.4. A. AI Coach - Delete Bookmark
**File:** `tests/ai-coach.spec.ts`

**Steps:**
1. Open Saved Messages sheet.
2. Click 'Delete' (trash icon) on a saved message.
3. Confirm if necessary (or verify immediate deletion).

**Expected Results:**
- The message is removed from the list.
- The bookmark icon in the main chat (if message is visible) updates to unbookmarked state.
