-
Notifications
You must be signed in to change notification settings - Fork 975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flaky System.Windows.Forms.UITests.ComboBoxTests.ComboBox_Select_Item_By_UpArrowKeyAsync #7320
Comments
I was able to replicate the failures locally, and the most likely reason for the failures is the loss of focus by the test form. E.g., here's a script to automate the issue (make sure to have built the repo, i.e., run pushd <path>\dotnet-winforms
$testProject = '.\src\System.Windows.Forms\tests\IntegrationTests\UIIntegrationTests\System.Windows.Forms.UI.IntegrationTests.csproj';
$testFilter = 'ComboBox_Select_Item_By_UpArrowKeyAsync';
try {
for ($num = 0 ; $num -le 1 ; $num++) {
dotnet test $testProject --nologo --no-build --no-restore --filter $testFilter
if ($LastExitCode -ne 0) {
exit -1;
}
}
}
finally {
popd
} While the test is running, bring other windows to the foreground (i.e., click on those). As a result, the test will fail:
|
@RussKie so test will be compromised if user moves the mouse and clicks it's buttons? There are two integration tests with InputSimulator: There are also two unitTests: ComboBox_SelectedIndex_DoesNotChange_SelectedItem_AndDoesNotFire_OnSelectedIndexChanged and ComboBox_SelectedIndexChangesSelectedItemAndFiresOnSelectedIndexChanged These 4 tests are very similar (they count change selection events). I propose we recreate these two integration tests so it is not affected by user's actions (without InputSimulator). Turn them into unit tests. One possible way it seems is the unit test ListView_LeftRightArrow_DoesNotThrowException |
I've been staring (and not only) at winforms/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/ComboBoxTests.cs Lines 40 to 68 in 03f373f
winforms/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/ComboBoxTests.cs Lines 70 to 91 in 03f373f
Spot the difference 😉 I can't recall |
@RussKie in fact I've already created a new unit test which tests ComboBox keyboard focus without input simulation and Async methods before I've seen your comment here. I'll make the PR with both ways to solve this Issue, but I believe the test I've created is come convenient than previous ones. Upd. #7323 |
Runfo Tracking Issue: Flaky System.Windows.Forms.UITests.ComboBoxTests.ComboBox_Select_Item_By_UpArrowKeyAsync
Build Result Summary
The text was updated successfully, but these errors were encountered: