Skip to content

Commit 870680d

Browse files
committed
add delay time
1 parent ef948ad commit 870680d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/modules/fancyzones/UITests-FancyZones/DragWindowTests.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public void TestInitialize()
5454
ClearOpenWindows();
5555

5656
// clean app zone history file
57-
FancyZonesEditorHelper.Files.CustomLayoutsIOHelper.DeleteFile();
5857
AppZoneHistory.DeleteFile();
5958
this.RestartScopeExe();
6059
FancyZonesEditorHelper.Files.Restore();
@@ -366,27 +365,26 @@ private void LaunchFancyZones()
366365
this.Scroll(6, "Down"); // Pull the settings page up to make sure the settings are visible
367366
ZoneBehaviourSettings(TestContext.TestName);
368367

369-
this.Find<Microsoft.PowerToys.UITest.Button>("Launch layout editor").Click(false, 500, 5000);
368+
this.Find<Microsoft.PowerToys.UITest.Button>("Launch layout editor").Click(false, 500, 10000);
370369
string customLayoutData = FancyZonesEditorHelper.Files.CustomLayoutsIOHelper.GetData();
370+
this.Session.Attach(PowerToysModule.FancyZone);
371371

372372
// pipeline machine may have an unstable delays, causing the custom layout to be unavailable as we set. then A retry is required.
373373
// Console.WriteLine($"after launch, Custom layout data: {customLayoutData}");
374-
if (customLayoutData == setCustomLayoutData)
374+
try
375375
{
376-
this.Session.Attach(PowerToysModule.FancyZone);
377376
this.Find<Microsoft.PowerToys.UITest.Button>("Maximize").Click();
378-
Task.Delay(1000).Wait(); // Optional: Wait for a moment to ensure the window is in position
379377

380378
// Set the FancyZones layout to a custom layout
381379
this.Find<Element>(By.Name("Custom Column")).Click();
382380
}
383-
else
381+
catch (Exception ex)
384382
{
385-
// Console.WriteLine($"[Exception] Failed to attach to FancyZones window. Retrying...");
383+
Console.WriteLine($"[Exception] Failed to attach to FancyZones window. Retrying...{ex.ToString()}");
386384
this.Find<Microsoft.PowerToys.UITest.Button>("Close").Click();
387385
this.Session.Attach(PowerToysModule.PowerToysSettings);
388386
SetupCustomLayouts();
389-
this.Find<Microsoft.PowerToys.UITest.Button>("Launch layout editor").Click(false, 500, 5000);
387+
this.Find<Microsoft.PowerToys.UITest.Button>("Launch layout editor").Click(false, 5000, 5000);
390388
this.Session.Attach(PowerToysModule.FancyZone);
391389
this.Find<Microsoft.PowerToys.UITest.Button>("Maximize").Click();
392390

0 commit comments

Comments
 (0)