Fixing the save button from not being clicked for waitlists in Dutch; Adding some network idle waits for logging in and out; Accepting dialog when deleting a waitlist entry

This commit is contained in:
Collin Duncan 2023-08-31 17:39:03 +02:00
parent 8f4b6bca44
commit 68719cfa67
No known key found for this signature in database

View file

@ -111,6 +111,7 @@ export class BaanReserverenService {
.catch((e: Error) => { .catch((e: Error) => {
throw new RunnerLoginSubmitError(e) throw new RunnerLoginSubmitError(e)
}) })
await this.page.waitForNetworkIdle()
this.startSession(username) this.startSession(username)
} }
@ -119,6 +120,7 @@ export class BaanReserverenService {
await this.page.goto( await this.page.goto(
`${BAAN_RESERVEREN_ROOT_URL}/${BaanReserverenUrls.Logout}`, `${BAAN_RESERVEREN_ROOT_URL}/${BaanReserverenUrls.Logout}`,
) )
await this.page.waitForNetworkIdle()
this.endSession() this.endSession()
} }
@ -202,7 +204,7 @@ export class BaanReserverenService {
} }
private async navigateToReservations() { private async navigateToReservations() {
this.loggerService.debug('Navigating to waiting list') this.loggerService.debug('Navigating to reservations')
await this.page await this.page
.goto(`${BAAN_RESERVEREN_ROOT_URL}/${BaanReserverenUrls.Reservations}`) .goto(`${BAAN_RESERVEREN_ROOT_URL}/${BaanReserverenUrls.Reservations}`)
.catch((e) => { .catch((e) => {
@ -253,8 +255,17 @@ export class BaanReserverenService {
) )
} }
const acceptedDialogPromise = new Promise<void>((res, rej) => {
this.page.on('dialog', async (dialog) => {
await dialog.accept().catch(rej)
res()
})
setTimeout(rej, 10000)
})
const deleteButton = await rows[0].$('a.wl-delete') const deleteButton = await rows[0].$('a.wl-delete')
await deleteButton?.click() await deleteButton?.click()
await acceptedDialogPromise
} }
private async openWaitingListDialog() { private async openWaitingListDialog() {
@ -378,7 +389,7 @@ export class BaanReserverenService {
private async confirmWaitingListDetails() { private async confirmWaitingListDetails() {
this.loggerService.debug('Confirming waiting list details') this.loggerService.debug('Confirming waiting list details')
const saveButton = await this.page.$('input[type="submit"][value="Save"]') const saveButton = await this.page.$('input[type="submit"]')
await saveButton?.click().catch((e) => { await saveButton?.click().catch((e) => {
throw new RunnerWaitingListConfirmError(e) throw new RunnerWaitingListConfirmError(e)
}) })