mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-08 09:30:27 +00:00
test(webview): allow for throttled timers and diagnose selector timeouts
This commit is contained in:
1 parent
1b00a16277
commit
3415364ab7
1 file changed
+12
-3
@@ -108,8 +108,10 @@ func RunProviderContract(t *testing.T, provider enginewebview.Provider, opts Con
|
||||
t.Fatalf("expected click count to be 1, got %v", clickCount)
|
||||
}
|
||||
|
||||
// Hidden WebViews can throttle timers on shared CI runners. Keep the
|
||||
// positive asynchronous waits within the same budget as navigation.
|
||||
found, err := page.WaitForSelector("#delayed", map[string]any{
|
||||
"timeoutMs": 5000,
|
||||
"timeoutMs": 10000,
|
||||
"pollIntervalMs": 25,
|
||||
"visible": true,
|
||||
})
|
||||
@@ -117,11 +119,18 @@ func RunProviderContract(t *testing.T, provider enginewebview.Provider, opts Con
|
||||
t.Fatalf("waitForSelector failed: %v", err)
|
||||
}
|
||||
if !found {
|
||||
t.Fatal("expected delayed selector to appear")
|
||||
diagnostic, diagnosticErr := page.Execute(`() => {
|
||||
const element = document.querySelector('#delayed');
|
||||
const rect = element && element.getBoundingClientRect();
|
||||
return {url: location.href, readyState: document.readyState,
|
||||
visibility: document.visibilityState, exists: !!element,
|
||||
width: rect && rect.width, height: rect && rect.height};
|
||||
}`)
|
||||
t.Fatalf("expected delayed selector to appear: state=%v, diagnostic error=%v", diagnostic, diagnosticErr)
|
||||
}
|
||||
|
||||
value, err := page.WaitForFunction(`() => window.__readyValue`, map[string]any{
|
||||
"timeoutMs": 5000,
|
||||
"timeoutMs": 10000,
|
||||
"pollIntervalMs": 25,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user