refactor(clickTtPlayerRegistrationService): streamline application entry handling

- Replaced the method for ensuring application entry visibility with a more direct approach to open the application entry, improving code clarity and reducing complexity.
- Enhanced error handling to provide clearer feedback when the application entry cannot be found, ensuring better user guidance during the registration process.
This commit is contained in:
Torsten Schulz (local)
2026-03-11 16:14:25 +01:00
parent 5c9901209c
commit cf376a8f68

View File

@@ -101,8 +101,7 @@ class ClickTtPlayerRegistrationService {
await this._openAuthenticatedClickTt(page, { username, password, trace });
await this._selectClubContext(page, associationMemberNumber, trace);
await this._ensureApplicationEntryVisible(page, trace);
await this._clickByText(page, 'Spielberechtigungen beantragen', trace);
await this._openApplicationEntry(page, trace);
await this._fillSearchForm(page, memberJson);
await this._clickByText(page, 'Personen suchen', trace);
await page.waitForLoadState('domcontentloaded');
@@ -316,22 +315,22 @@ class ClickTtPlayerRegistrationService {
return false;
}
async _ensureApplicationEntryVisible(page, trace) {
async _openApplicationEntry(page, trace) {
await this._dismissConsentOverlays(page, trace);
const directEntry = await this._hasTextTarget(page, 'Spielberechtigungen beantragen');
if (directEntry) {
return;
const labels = [
'Spielberechtigungen beantragen',
'Spielberechtigungen'
];
for (const label of labels) {
if (await this._hasTextTarget(page, label)) {
await this._clickByText(page, label, trace);
return true;
}
}
if (await this._hasTextTarget(page, 'Persönlicher Bereich')) {
this._trace(trace, 'step', {
name: 'open-personal-area'
});
await this._clickByText(page, 'Persönlicher Bereich', trace);
await page.waitForLoadState('domcontentloaded');
await this._dismissConsentOverlays(page, trace);
}
throw new HttpError('Click-TT-Element nicht gefunden: Spielberechtigungen', 500);
}
async _selectClubContext(page, associationMemberNumber, trace) {