Skip to content

Commit 10fc026

Browse files
Merge pull request #234 from Checkmarx/other/elchanan/fix_ui_test
Update CheckmarxTests.cs
2 parents 2fead48 + e7571ab commit 10fc026

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

UITests/CheckmarxTests.cs

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,34 @@ public async Task OpenCheckmarxWindow()
1818
{
1919
// Find the View menu
2020
var viewMenu = _mainWindow.FindFirstDescendant(cf => cf.ByName("View"));
21-
if (viewMenu != null)
22-
{
23-
// Open the "View" menu by clicking it
24-
viewMenu.WaitUntilEnabled().Click();
25-
await Task.Delay(500);
21+
Assert.IsNotNull(viewMenu, "View menu not found");
22+
23+
// Open the "View" menu by clicking it
24+
viewMenu.WaitUntilEnabled().Click();
25+
await Task.Delay(500);
2626

27-
var allMenuItems = _mainWindow.FindAllDescendants(cf =>
28-
cf.ByControlType(FlaUI.Core.Definitions.ControlType.MenuItem));
29-
bool foundOtherWindows = false;
27+
var allMenuItems = _mainWindow.FindAllDescendants(cf =>
28+
cf.ByControlType(FlaUI.Core.Definitions.ControlType.MenuItem));
29+
bool foundOtherWindows = false;
3030

3131

32-
foreach (var menuItem in allMenuItems)
32+
foreach (var menuItem in allMenuItems)
33+
{
34+
if (menuItem.Name == "Other Windows")
3335
{
34-
if (menuItem.Name == "Other Windows")
35-
{
36-
foundOtherWindows = true;
37-
menuItem.WaitUntilEnabled().Click();
38-
await Task.Delay(1000);
39-
40-
// Now select a specific window from the list "Checkmarx"
41-
var checkmarxOption = _mainWindow.FindFirstDescendant(cf => cf.ByName("Checkmarx"));
42-
Assert.IsNotNull(checkmarxOption, "Checkmarx option not found in Other Windows menu");
43-
checkmarxOption.WaitUntilEnabled().Click();
44-
break;
45-
}
46-
}
47-
Assert.IsTrue(foundOtherWindows, "Other Windows menu item not found");
36+
foundOtherWindows = true;
37+
menuItem.WaitUntilEnabled().Click();
38+
await Task.Delay(1000);
4839

40+
// Now select a specific window from the list "Checkmarx"
41+
var checkmarxOption = _mainWindow.FindFirstDescendant(cf => cf.ByName("Checkmarx"));
42+
Assert.IsNotNull(checkmarxOption, "Checkmarx option not found in Other Windows menu");
43+
checkmarxOption.WaitUntilEnabled().Click();
44+
break;
45+
}
4946
}
47+
Assert.IsTrue(foundOtherWindows, "Other Windows menu item not found");
48+
5049
}
5150
}
52-
}
51+
}

0 commit comments

Comments
 (0)