Feature: Improved handling of wait times for page checks and reloads, using a 10s timeout for slower networks

This commit is contained in:
2025-11-13 14:37:17 +01:00
parent 9f56227608
commit 2959fc8c73
4 changed files with 20 additions and 11 deletions

View File

@@ -79,8 +79,9 @@ export default class BrowserFunc {
await page.goto(this.bot.config.baseURL)
// IMPROVED: Smart page readiness check after navigation
// FIXED: Use timeoutMs parameter with increased timeout for slower networks
const readyResult = await waitForPageReady(page, {
networkIdleMs: 1000,
timeoutMs: 15000, // FIXED: 15s timeout to handle slower network conditions
logFn: (msg) => this.bot.log(this.bot.isMobile, 'GO-HOME', msg, 'log')
})
@@ -199,8 +200,9 @@ export default class BrowserFunc {
await page.goto(this.bot.config.baseURL)
// IMPROVED: Wait for page ready after redirect
// FIXED: Use timeoutMs parameter with increased timeout
await waitForPageReady(page, {
networkIdleMs: 1000,
timeoutMs: 15000, // FIXED: 15s timeout to handle slower network conditions
logFn: (msg) => this.bot.log(this.bot.isMobile, 'GO-HOME', msg, 'log')
})
} else {
@@ -258,8 +260,9 @@ export default class BrowserFunc {
await this.goHome(target)
// IMPROVED: Smart page readiness check instead of fixed wait
// FIXED: Use timeoutMs parameter with increased timeout
await waitForPageReady(target, {
networkIdleMs: 1000,
timeoutMs: 15000, // FIXED: 15s timeout for dashboard recovery
logFn: (msg) => this.bot.log(this.bot.isMobile, 'BROWSER-FUNC', msg, 'log')
}).catch((error) => {
const errorMsg = error instanceof Error ? error.message : String(error)

View File

@@ -209,6 +209,7 @@ export default class BrowserUtil {
this.bot.log(this.bot.isMobile, 'RELOAD-BAD-PAGE', `Bad page detected (${errorType}), reloading!`)
await page.reload({ waitUntil: 'domcontentloaded' })
// IMPROVED: Use smart wait instead of fixed 1500ms delay
// FIXED: Use default 10s timeout for page reload
await waitForPageReady(page)
}