Unilateral flag is now editable
This commit is contained in:
@@ -13,6 +13,7 @@ import { Button } from './ui/Button';
|
||||
import { Card } from './ui/Card';
|
||||
import { Modal } from './ui/Modal';
|
||||
import { SideSheet } from './ui/SideSheet';
|
||||
import { Checkbox } from './ui/Checkbox';
|
||||
|
||||
interface ProfileProps {
|
||||
user: User;
|
||||
@@ -654,6 +655,14 @@ const Profile: React.FC<ProfileProps> = ({ user, onLogout, lang, onLanguageChang
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="px-1 py-2">
|
||||
<Checkbox
|
||||
checked={editingExercise.isUnilateral || false}
|
||||
onChange={(e) => setEditingExercise({ ...editingExercise, isUnilateral: e.target.checked })}
|
||||
label={t('unilateral_exercise', lang) || 'Unilateral exercise'}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</SideSheet>
|
||||
)}
|
||||
|
||||
68
tests/unilateral-edit.spec.ts
Normal file
68
tests/unilateral-edit.spec.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { test, expect } from './fixtures';
|
||||
|
||||
test('can enable unilateral flag for existing exercise', async ({ page, createUniqueUser }) => {
|
||||
console.log('START: Test started');
|
||||
const user = await createUniqueUser();
|
||||
console.log('USER created: ' + user.email);
|
||||
|
||||
// 1. Login
|
||||
console.log('Navigating to login...');
|
||||
await page.goto('http://localhost:3000/');
|
||||
console.log('Filling login form...');
|
||||
await page.fill('input[type="email"]', user.email);
|
||||
await page.fill('input[type="password"]', user.password);
|
||||
await page.click('button:has-text("Login")');
|
||||
console.log('Waiting for Tracker...');
|
||||
await expect(page.getByText('Tracker')).toBeVisible();
|
||||
|
||||
// 2. Create a standard exercise via Profile
|
||||
console.log('Navigating to Profile...');
|
||||
await page.getByText('Profile').click();
|
||||
console.log('Clicking Manage Exercises...');
|
||||
await page.getByRole('button', { name: 'Manage Exercises' }).click();
|
||||
|
||||
// Open create modal
|
||||
console.log('Clicking New Exercise...');
|
||||
await page.getByRole('button', { name: 'New Exercise' }).click();
|
||||
|
||||
const exName = `Test Uni ${Date.now()}`;
|
||||
console.log('Creating exercise:', exName);
|
||||
await page.getByLabel('Name').fill(exName);
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// Verify it exists in list
|
||||
console.log('Verifying creation...');
|
||||
await expect(page.getByText(exName)).toBeVisible();
|
||||
|
||||
// 3. Edit exercise to be Unilateral
|
||||
console.log('Finding row to edit...');
|
||||
const row = page.locator('div.flex.justify-between.items-center').filter({ hasText: exName }).first();
|
||||
console.log('Clicking Edit...');
|
||||
await row.getByRole('button', { name: 'Edit Exercise' }).click();
|
||||
|
||||
// Check the Unilateral checkbox
|
||||
console.log('Checking Unilateral...');
|
||||
await page.getByLabel('Unilateral exercise').check();
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
|
||||
// Verify "Unilateral" tag appears in the list
|
||||
console.log('Verifying Unilateral tag...');
|
||||
await expect(row).toContainText('Unilateral');
|
||||
|
||||
// 4. Verify in Tracker
|
||||
console.log('Navigating to Tracker...');
|
||||
await page.getByText('Tracker').click();
|
||||
|
||||
// Select the exercise
|
||||
console.log('Selecting exercise...');
|
||||
await page.getByLabel('Select Exercise').fill(exName);
|
||||
await page.getByRole('button', { name: exName }).click();
|
||||
|
||||
// Verify L/A/R buttons appear
|
||||
console.log('Checking buttons...');
|
||||
await expect(page.getByTitle('Left')).toBeVisible();
|
||||
await expect(page.getByTitle('Right')).toBeVisible();
|
||||
await expect(page.getByTitle('Alternately')).toBeVisible();
|
||||
|
||||
console.log('DONE: Test finished successfully');
|
||||
});
|
||||
Reference in New Issue
Block a user