refactor(clickTtPlayerRegistrationService): improve nationality selection logic

- Updated nationality selection to handle multiple selectors, enhancing flexibility in form filling.
- Added checks for 'WONoSelectionString' and specific values to improve validation during player registration.
- Streamlined the selection process by breaking out of the loop once a valid selection is made, improving efficiency.
This commit is contained in:
Torsten Schulz (local)
2026-03-11 17:32:02 +01:00
parent 7cb6b66971
commit 9d13a2e211

View File

@@ -460,12 +460,21 @@ class ClickTtPlayerRegistrationService {
await this._fillIfEmpty(form.locator('input[name$=".17"]').nth(1), member.city || '');
await this._fillIfEmpty(form.locator('input[name$=".5"]').last(), email || '');
const nationalitySelect = form.locator('select[name$=".31.1.1.5.13"]:not([disabled])').first();
if (await nationalitySelect.count()) {
const nationalitySelectors = [
'select[name$=".31.1.1.5.13"]:not([disabled])',
'select[name$=".27"]:not([disabled])'
];
for (const selector of nationalitySelectors) {
const nationalitySelect = form.locator(selector).first();
if (!(await nationalitySelect.count())) {
continue;
}
const currentValue = await nationalitySelect.inputValue().catch(() => 'WONoSelectionString');
if (!currentValue || currentValue === 'WONoSelectionString' || currentValue === '209') {
await this._selectOptionByLabelContains(nationalitySelect, 'Deutschland');
}
break;
}
const countrySelect = form.locator('select[name$=".21.3"]').first();