Dev and Test run fixed. New Datepicker. Tests fixed. Message bookmarking fixed.

This commit is contained in:
aodulov
2025-12-18 14:06:45 +02:00
parent e9aec9a65d
commit 3a8f132b91
12 changed files with 347 additions and 24 deletions

View File

@@ -6,7 +6,7 @@ test.describe('Smoke Tests - Backend Refactor', () => {
const password = 'password123';
// 1. Register
const registerRes = await request.post('http://localhost:3001/api/auth/register', {
const registerRes = await request.post('http://localhost:3201/api/auth/register', {
data: { email, password }
});
expect(registerRes.ok()).toBeTruthy();
@@ -17,7 +17,7 @@ test.describe('Smoke Tests - Backend Refactor', () => {
const token = registerBody.data.token;
// 2. Get Exercises
const exercisesRes = await request.get('http://localhost:3001/api/exercises', {
const exercisesRes = await request.get('http://localhost:3201/api/exercises', {
headers: { Authorization: `Bearer ${token}` }
});
expect(exercisesRes.ok()).toBeTruthy();
@@ -26,7 +26,7 @@ test.describe('Smoke Tests - Backend Refactor', () => {
expect(Array.isArray(exercisesBody.data)).toBe(true);
// 3. Create Session
const sessionRes = await request.post('http://localhost:3001/api/sessions', {
const sessionRes = await request.post('http://localhost:3201/api/sessions', {
headers: { Authorization: `Bearer ${token}` },
data: {
id: "test-session-" + Date.now(),
@@ -40,7 +40,7 @@ test.describe('Smoke Tests - Backend Refactor', () => {
expect(sessionBody.data).toHaveProperty('id');
// 4. Get Active Session
const activeRes = await request.get('http://localhost:3001/api/sessions/active', {
const activeRes = await request.get('http://localhost:3201/api/sessions/active', {
headers: { Authorization: `Bearer ${token}` }
});
expect(activeRes.ok()).toBeTruthy();

View File

@@ -158,7 +158,7 @@ test.describe('V. User & System Management', () => {
await page.getByRole('button', { name: 'Login' }).click();
}
await page.getByRole('button', { name: /Профиль|Profile/ }).click();
await page.getByRole('button', { name: /^(Профиль|Profile)$/ }).click();
await expect(page.getByRole('heading', { name: 'Профиль', exact: true })).toBeVisible();
});
@@ -498,7 +498,7 @@ test.describe('V. User & System Management', () => {
const user = await createUniqueUser();
const apiContext = await playwrightRequest.newContext({
baseURL: 'http://127.0.0.1:3001',
baseURL: 'http://127.0.0.1:3201',
extraHTTPHeaders: {
'Authorization': `Bearer ${user.token}`
}

View File

@@ -15,10 +15,8 @@ type MyFixtures = {
// Extend the base test with our custom fixture
export const test = base.extend<MyFixtures>({
createUniqueUser: async ({ }, use) => {
// We use a new API context for setup to avoid polluting request history,
// although setup requests are usually separate anyway.
const apiContext = await request.newContext({
baseURL: 'http://127.0.0.1:3001' // Direct access to backend
baseURL: 'http://127.0.0.1:3201' // Direct access to backend
});
// Setup: Helper function to create a user
@@ -48,12 +46,6 @@ export const test = base.extend<MyFixtures>({
// Use the fixture
await use(createUser);
// Cleanup: In a real "test:full" env with ephemeral db, cleanup might not be needed.
// But if we want to be clean, we can delete the user.
// Requires admin privileges usually, or specific delete-me endpoint.
// Given the requirements "delete own account" exists (5.6), we could theoretically login and delete.
// For now we skip auto-cleanup to keep it simple, assuming test DB is reset periodically.
},
createAdminUser: async ({ createUniqueUser }, use) => {
@@ -65,7 +57,7 @@ export const test = base.extend<MyFixtures>({
try {
const { stdout, stderr } = await exec(`npx ts-node promote_admin.ts ${user.email}`, {
cwd: 'server',
env: { ...process.env, APP_MODE: 'test', DATABASE_URL: 'file:d:/Coding/gymflow/server/test.db', DATABASE_URL_TEST: 'file:d:/Coding/gymflow/server/test.db' }
env: { ...process.env, APP_MODE: 'test', DATABASE_URL: 'file:d:/Coding/gymflow/server/prisma/test.db', DATABASE_URL_TEST: 'file:d:/Coding/gymflow/server/prisma/test.db' }
});
if (stderr) {
console.error(`Promote Admin Stderr: ${stderr}`);