diff --git a/services/api/src/middlewares/withAnalytics.ts b/services/api/src/middlewares/withAnalytics.ts index 7cc520fc7..9eba6ab07 100644 --- a/services/api/src/middlewares/withAnalytics.ts +++ b/services/api/src/middlewares/withAnalytics.ts @@ -23,6 +23,7 @@ const withAnalytics: MiddlewareBuilderBase = async ({ try { // We are only identifying One Project users by email, matching frontend logic const properties: Record = {}; + properties.authUserId = user.id; if (posthogSessionId) { properties.$session_id = posthogSessionId; diff --git a/tests/e2e/tests/decisions.spec.ts b/tests/e2e/tests/decisions.spec.ts index 56cb0ed16..34815242b 100644 --- a/tests/e2e/tests/decisions.spec.ts +++ b/tests/e2e/tests/decisions.spec.ts @@ -30,12 +30,25 @@ test.describe('Decisions', () => { authenticatedPage.getByRole('heading', { name: instance.name }), ).toBeVisible({ timeout: 15000 }); - // 5. Click the "Submit a proposal" button + // 5. Click the "Submit a proposal" button and capture the mutation response const submitButton = authenticatedPage.getByRole('button', { name: 'Submit a proposal', }); await expect(submitButton).toBeVisible({ timeout: 5000 }); - await submitButton.click(); + + const [response] = await Promise.all([ + authenticatedPage.waitForResponse( + (resp) => resp.url().includes('decision.createProposal'), + { timeout: 15000 }, + ), + submitButton.click(), + ]); + + // Log mutation result to help diagnose CI failures + const responseBody = await response.text(); + console.log('createProposal response status:', response.status()); + console.log('createProposal response body:', responseBody); + expect(response.status()).toBe(200); // 6. Wait for navigation to the proposal edit page // The URL pattern is /decisions/{slug}/proposal/{profileId}/edit