diff --git a/src/modules/MeasureTool/Tests/ScreenRuler.UITests/ActivationTest.cs b/src/modules/MeasureTool/Tests/ScreenRuler.UITests/ActivationTest.cs index 433cd1d084..bbdb606f2f 100644 --- a/src/modules/MeasureTool/Tests/ScreenRuler.UITests/ActivationTest.cs +++ b/src/modules/MeasureTool/Tests/ScreenRuler.UITests/ActivationTest.cs @@ -39,30 +39,28 @@ namespace ScreenRuler.UITests // Launch PowerToys Settings LaunchFromSetting(); - // Enable MeasureTool - var foundCustom = this.Find("Screen Ruler"); - Assert.IsNotNull(foundCustom, "Screen Ruler group not found."); + var toggleSwitch = Find("Enable Screen Ruler"); + if (!toggleSwitch.IsOn) + { + toggleSwitch.Click(msPostAction: 500); + } - // Toggle on MeasureTool - foundCustom.Find("Enable Measure Tool").Toggle(true); - Task.Delay(1000).Wait(); + Assert.IsTrue(toggleSwitch.IsOn, "Screen Ruler toggle switch should be ON"); } private void LaunchFromSetting() { - this.Session.SetMainWindowSize(WindowSize.Medium); + Session.SetMainWindowSize(WindowSize.Medium); + var screenRulers = FindAll("Screen Ruler"); // Navigate to Measure Tool settings - if (this.FindAll("Screen Ruler", 2000).Count == 0) + if (screenRulers.Count == 0) { - // Expand Utilities list-group if needed - this.Find("Utilities").Click(); - Task.Delay(1000).Wait(); + // Expand System Tools list-group if needed + Find("System Tools", 500).Click(msPostAction: 500); } - Task.Delay(1000).Wait(); - this.Find("Screen Ruler").Click(); - Task.Delay(2000).Wait(); + Find("Screen Ruler", 500).Click(msPostAction: 500); } } }