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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user