feat(clickTtPlayerRegistrationService, MembersView): enhance Click-TT registration flow and UI feedback

- Replaced the abort confirmation flow with a new function to open the application after a search, improving user experience by directly navigating to the application.
- Updated error handling to provide clearer messages when a confirm dialog is encountered, enhancing traceability.
- Modified the MembersView to track application submission status and display detailed success/error messages, improving user feedback during the registration process.
- Introduced a new method to format and display trace details, aiding in debugging and user communication.
This commit is contained in:
Torsten Schulz (local)
2026-03-11 15:31:37 +01:00
parent 139d169fcc
commit 8fc754c235
3 changed files with 106 additions and 10 deletions

View File

@@ -86,7 +86,7 @@ class ClickTtPlayerRegistrationService {
await this._clickByText(page, 'Personen suchen', trace);
await page.waitForLoadState('domcontentloaded');
await this._abortIfConfirmFlow(page);
await this._openApplicationAfterSearch(page, trace);
await this._fillApplicationForm(page, memberJson, primaryEmail);
await this._clickByText(page, 'Weiter >>', trace);
await page.waitForLoadState('domcontentloaded');
@@ -288,11 +288,41 @@ class ClickTtPlayerRegistrationService {
await fillIfEmpty(13, email);
}
async _abortIfConfirmFlow(page) {
async _openApplicationAfterSearch(page, trace) {
const explicitApplicationLink = page.getByText(/Spielberechtigung beantragen/i).first();
if (await explicitApplicationLink.count()) {
let dialogSeen = false;
page.once('dialog', async (dialog) => {
dialogSeen = true;
this._trace(trace, 'dialog', {
kind: dialog.type(),
message: sanitizePageText(dialog.message())
});
await dialog.accept();
});
this._trace(trace, 'step', {
name: 'click',
label: 'Spielberechtigung beantragen',
selector: 'text=/Spielberechtigung beantragen/i'
});
await explicitApplicationLink.click();
await page.waitForLoadState('domcontentloaded');
this._trace(trace, 'step', {
name: 'search-result-application-opened',
dialogSeen,
url: page.url()
});
return;
}
const confirmLocator = page.locator('[onclick*="confirm("]').first();
if (await confirmLocator.count()) {
const text = sanitizePageText(await confirmLocator.innerText().catch(() => '') || await confirmLocator.getAttribute('value').catch(() => '') || '');
throw new HttpError(`Der Antrag befindet sich im noch nicht automatisierten click-TT-Confirm-/Neuanlage-Flow${text ? `: ${text}` : ''}`, 409);
const text = sanitizePageText(
await confirmLocator.innerText().catch(() => '') || await confirmLocator.getAttribute('value').catch(() => '') || ''
);
throw new HttpError(`Click-TT-Suchergebnis mit Confirm gefunden, aber kein klickbares Antragselement per Label erkannt${text ? `: ${text}` : ''}`, 409);
}
}