diff --git a/internal/gui/window_visibility_darwin_test.go b/internal/gui/window_visibility_darwin_test.go index 515f8e4ae..fb7cc14d6 100644 --- a/internal/gui/window_visibility_darwin_test.go +++ b/internal/gui/window_visibility_darwin_test.go @@ -20,8 +20,16 @@ import ( // says otherwise. The page here records what it saw as it was hidden, and // reports that record once it is shown again; without hideWebview's signal // it remains a visible page with running animations. +// +// The page reads document.hidden as app.js does, from magpie's signal. +// WebKit does turn an ordered-out window's document.hidden on, but in its +// own time and without a visibilitychange of its own, so a page reading +// WebKit's value saw itself visible whenever magpie's signal arrived first, +// recorded nothing, and the window was shown again after a fixed pause with +// nothing to report (#4924). The window is now shown again only once the +// page has said it saw itself hidden. func TestClosingWindowMarksPageOutOfSight(t *testing.T) { - out, err := runAppKit(t, 30*time.Second, []string{"MAGPIE_TEST_WINDOW_VISIBILITY=1"}) + out, err := runAppKit(t, 2*time.Minute, []string{"MAGPIE_TEST_WINDOW_VISIBILITY=1"}) if err != nil || !strings.Contains(string(out), "window visibility: ok") { t.Fatalf("window visibility: %v\n%s", err, out) } @@ -33,7 +41,7 @@ func TestClosingWindowMarksPageOutOfSight(t *testing.T) { // told it is back and keeps what it was drawn with: Settings' currency and // number units never reached it (blrbrzkj on Discord). func TestPanelHiddenByWailsMarksPageOutOfSight(t *testing.T) { - out, err := runAppKit(t, 30*time.Second, []string{"MAGPIE_TEST_WINDOW_VISIBILITY=panel"}) + out, err := runAppKit(t, 2*time.Minute, []string{"MAGPIE_TEST_WINDOW_VISIBILITY=panel"}) if err != nil || !strings.Contains(string(out), "window visibility: ok") { t.Fatalf("panel visibility: %v\n%s", err, out) } @@ -45,6 +53,7 @@ func init() { return } ready := make(chan struct{}, 1) + hidden := make(chan url.Values, 1) reports := make(chan url.Values, 1) app := application.New(application.Options{ Name: "magpie window visibility regression", @@ -58,13 +67,22 @@ func init() { html.magpie-out-of-sight #probe{animation-play-state:paused!important}