From 595231f64bc645ba2001f18896e4bbfc8f343c2a Mon Sep 17 00:00:00 2001 From: "Xiaofeng Wang (from Dev Box)" Date: Mon, 17 Mar 2025 14:42:07 +0800 Subject: [PATCH] Add waiting time before starting to run --- src/common/UITestAutomation/Session.cs | 4 +--- src/common/UITestAutomation/UITestBase.cs | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/UITestAutomation/Session.cs b/src/common/UITestAutomation/Session.cs index 79e75ec807..f51ba137c0 100644 --- a/src/common/UITestAutomation/Session.cs +++ b/src/common/UITestAutomation/Session.cs @@ -353,7 +353,7 @@ namespace Microsoft.PowerToys.UITest return; } - ApiHelper.SetWindowPos(this.MainWindowHandler, ApiHelper.HWNDTOPMOST, 0, 0, width, height, ApiHelper.SetWindowPosNoMove | ApiHelper.SetWindowPosShowWindow); + ApiHelper.SetWindowPos(this.MainWindowHandler, IntPtr.Zero, 0, 0, width, height, ApiHelper.SetWindowPosNoMove | ApiHelper.SetWindowPosNoZorder | ApiHelper.SetWindowPosShowWindow); // Wait for 3000ms after resize Task.Delay(3000).Wait(); @@ -440,11 +440,9 @@ namespace Microsoft.PowerToys.UITest [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd); - public const uint SetWindowPosNoSize = 0x0001; public const uint SetWindowPosNoMove = 0x0002; public const uint SetWindowPosNoZorder = 0x0004; public const uint SetWindowPosShowWindow = 0x0040; - public static readonly IntPtr HWNDTOPMOST = new IntPtr(-1); [DllImport("user32.dll", SetLastError = true)] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags); diff --git a/src/common/UITestAutomation/UITestBase.cs b/src/common/UITestAutomation/UITestBase.cs index 0259c5237f..207171cd9f 100644 --- a/src/common/UITestAutomation/UITestBase.cs +++ b/src/common/UITestAutomation/UITestBase.cs @@ -29,6 +29,9 @@ namespace Microsoft.PowerToys.UITest public UITestBase(PowerToysModule scope = PowerToysModule.PowerToysSettings, WindowSize size = WindowSize.UnSpecified) { + // Wait for 30s after env setup + Task.Delay(30000).Wait(); + this.scope = scope; this.size = size; }