From 985c9074bd172de9549bfa1e1b8583a2db9f4610 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 2 Mar 2026 11:46:19 +0100 Subject: [PATCH] fix(myTischtennis): add detailed diagnostics for login failures - Introduced failure diagnostics logging during the login process to capture URL, cookie names, and body preview on errors. - Enhanced error handling to provide clearer insights into login issues, particularly related to CAPTCHA and password failures. - Improved console warnings for better visibility into authentication problems encountered during login attempts. --- backend/clients/myTischtennisClient.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/clients/myTischtennisClient.js b/backend/clients/myTischtennisClient.js index 96d75421..4b1274d2 100644 --- a/backend/clients/myTischtennisClient.js +++ b/backend/clients/myTischtennisClient.js @@ -585,6 +585,7 @@ class MyTischtennisClient { } if (!authCookieObj || !authCookieObj.value) { let errorText = null; + let failureDiagnostics = null; try { const textContent = await page.locator('body').innerText({ timeout: 1000 }); if (textContent?.includes('Captcha-Bestätigung fehlgeschlagen')) { @@ -593,12 +594,24 @@ class MyTischtennisClient { if (!errorText && textContent?.includes('Passwort')) { errorText = 'Login vermutlich fehlgeschlagen (Passwort oder CAPTCHA)'; } + + const currentUrl = page.url(); + const allCookies = await context.cookies(); + const cookieNames = allCookies.map((c) => c.name); + failureDiagnostics = { + url: currentUrl, + cookieNames, + bodyPreview: String(textContent || '').slice(0, 320) + }; } catch (_e) { // ignore text read errors } if (!errorText && detectedSubmitError) { errorText = detectedSubmitError; } + if (failureDiagnostics) { + console.warn('[myTischtennisClient.playwright] Login failure diagnostics:', failureDiagnostics); + } return { success: false, error: errorText