Skip to content

Commit c72249f

Browse files
[Testing] Fix for flaky test(VerifyEditorFocusedEvent) in CI (dotnet#31895)
This pull request updates the `VerifyEditorFocusedEvent` test method to be asynchronous, improving reliability by adding a short delay after tapping the editor. This ensures the focus event is properly triggered before the assertion is made. **Test reliability improvement:** * Changed `VerifyEditorFocusedEvent` in `EditorFeatureTests.cs` to be an `async Task`, and added a `Task.Delay(100)` after tapping the editor to ensure the focus event has time to trigger before the test assertion.
1 parent 165bc49 commit c72249f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/EditorFeatureTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ public async Task VerifyEditorFocusedEvent()
7272
App.WaitForElement("TestEditor");
7373
App.Tap("TestEditor");
7474
await Task.Delay(100);
75-
App.DismissKeyboard();
75+
#if ANDROID || IOS
76+
if (App.IsKeyboardShown())
77+
{
78+
App.DismissKeyboard();
79+
}
80+
#endif
7681
Assert.That(App.WaitForElement("FocusedLabel").GetText(), Is.EqualTo("Focused: Event Triggered"));
7782
}
7883

0 commit comments

Comments
 (0)