From 347c1ef0e4fcb0756130d2445eb86c0091718b6f Mon Sep 17 00:00:00 2001 From: softworkz Date: Sat, 6 Dec 2025 20:06:34 +0100 Subject: [PATCH] Show_hide_visibility_roundtrip: Don't use shared window --- .../Tests/BrowserWindowTests.cs | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs index 0d86d23..a258aec 100644 --- a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs @@ -82,12 +82,28 @@ namespace ElectronNET.IntegrationTests.Tests [Fact(Timeout = 20000)] public async Task Show_hide_visibility_roundtrip() { - this.fx.MainWindow.Show(); - await Task.Delay(500); - (await this.fx.MainWindow.IsVisibleAsync()).Should().BeTrue(); - this.fx.MainWindow.Hide(); - await Task.Delay(500); - (await this.fx.MainWindow.IsVisibleAsync()).Should().BeFalse(); + BrowserWindow window = null; + + try + { + window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }, "about:blank"); + + await Task.Delay(100); + + window.Show(); + + await Task.Delay(500); + (await window.IsVisibleAsync()).Should().BeTrue(); + + window.Hide(); + await Task.Delay(500); + + (await window.IsVisibleAsync()).Should().BeFalse(); + } + finally + { + window?.Destroy(); + } } [Fact(Timeout = 20000)]