helpers for abbruch and nicht-angetreten

This commit is contained in:
iw0 2024-05-01 16:25:36 +02:00
parent b211aeb41f
commit a8bc3284e4

View File

@ -260,6 +260,42 @@ const iWasDelayed = {
}
}
const iDidntTravel = {
name: "iDidntTravel",
match: node => node.classList.contains("antrags-typ-auswahl"),
execute: node => {
const noTravel = $$(node, "input#antragstyp-nicht-angetreten");
if (noTravel instanceof HTMLInputElement){
noTravel.dispatchEvent(new Event("change"));
return true;
}
return false;
}
}
const iWentBack = {
name: "iWentBack",
match: node => node.classList.contains("antrags-typ-auswahl"),
execute: node => {
const wentBack = $$(node, "input#antragstyp-abgebrochen");
if (wentBack instanceof HTMLInputElement){
wentBack.dispatchEvent(new Event("change"));
return true;
}
return false;
}
}
const focusTurnaroundStationInput = {
name: "focusTurnaroundStationInput",
expects: "node",
match: node => node instanceof Element && Array.from(node.children).some(c => c.classList.contains("abbruchbahnhof")),
execute: node => {
$$(node, ".abbruchbahnhof .fahrgastrechte-bahnhof__halt-search input").focus();
return true;
}
}
const moreThan60Minutes = {
name: "moreThan60Minutes",
match: node => node.classList.contains("verspaetungs-auswahl"),
@ -271,7 +307,10 @@ const moreThan60Minutes = {
const continueToForm = {
name: "continueToForm",
match: node => node.classList.contains("verspaetung-bestaetigung"),
execute: node => $$(node, 'button.fahrgastrechte-continue-button').dispatchEvent(_clickEv())
execute: node => {
$$(node, 'button.fahrgastrechte-continue-button').dispatchEvent(_clickEv()).focus();
return true;
}
}
const focusDepartureInput = {
@ -445,7 +484,7 @@ const enterPaymentDetails = {
const defaultStages = [
startClaim, fillData, clickContinue,
{"delay": [iWasDelayed, moreThan60Minutes, continueToForm,
focusDepartureInput, jumpToTimeInput], "nodep": [], "abort": []},
focusDepartureInput, jumpToTimeInput], "nodep": [iDidntTravel, focusDepartureInput], "abort": [iWentBack, focusDepartureInput, focusTurnaroundStationInput]},
activateAppellationDropdown, enterAppellationAndActivateTitleDropdown,
enterTitleAndActivateCountryDropdown, enterCountry,
enterTextPersonalData, /* continueToPayout, */ enterPaymentDetails