Modifying how the session checking works to prevent getting stuck on home page

This commit is contained in:
Collin Duncan 2023-08-28 14:23:08 +02:00
parent 466ff7c32e
commit 09de8ecff3
No known key found for this signature in database

View file

@ -57,8 +57,8 @@ export class BaanReserverenService {
session: this.session,
})
if (this.page.url().includes(BAAN_RESERVEREN_ROOT_URL)) {
// Check session via reload to see if we are still logged in via cookies
await this.page.reload()
// Check session by going to /reservations to see if we are still logged in via cookies
await this.navigateToReservations()
if (this.page.url().includes('?reason=LOGGED_IN')) {
return SessionAction.Login
}
@ -201,6 +201,15 @@ export class BaanReserverenService {
})
}
private async navigateToReservations() {
this.loggerService.debug('Navigating to waiting list')
await this.page
.goto(`${BAAN_RESERVEREN_ROOT_URL}/${BaanReserverenUrls.Reservations}`)
.catch((e) => {
throw new RunnerWaitingListNavigationError(e)
})
}
private async openWaitingListDialog() {
this.loggerService.debug('Opening waiting list dialog')
await this.page.waitForNetworkIdle()