-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Testing] Fix for flaky test(VerifyEditorFocusedEvent) in CI #31895
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
base: main
Are you sure you want to change the base?
[Testing] Fix for flaky test(VerifyEditorFocusedEvent) in CI #31895
Conversation
Hey there @@HarishKumarSF4517! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Stabilizes a flaky UI test by converting it to async and inserting a delay to allow the focus event to propagate before assertion.
- Change test signature to async Task to support awaiting operations
- Insert 100 ms Task.Delay after tapping the editor to mitigate timing race
- Preserve existing assertion logic for the Focused event label
{ | ||
App.WaitForElement("TestEditor"); | ||
App.Tap("TestEditor"); | ||
await Task.Delay(100); |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a fixed delay introduces a magic number and can remain flaky on slower CI agents while adding unnecessary wait on fast machines. Prefer a condition-based wait/poll that exits as soon as the label reflects the focused state, e.g., loop with small delays until App.WaitForElement("FocusedLabel").GetText() == "Focused: Event Triggered" or timeout. This removes the arbitrary 100 ms constant and makes the test both faster and more reliable.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I m not sure just adding the delay is going to work, do we have another way to know the keyboard is dismissed ? is there a event that fires when the keyboard is hidden ?
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
b68c8f6
to
b042bf7
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
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:
VerifyEditorFocusedEvent
inEditorFeatureTests.cs
to be anasync Task
, and added aTask.Delay(100)
after tapping the editor to ensure the focus event has time to trigger before the test assertion.