There is a family of functions in js-test-pre that check a condition every 5 milliseconds, and fail if it doesn't become true in 0.5 sec. They also take an argument for custom timeout, but there are no tests that pass it.
This is not how you write regression tests - anything can take longer than 0.5 seconds. We should just use global test timeout, not roll out ad hoc flaky solutions.
There is a lot of flakiness on tests such as editing/spelling/grammar-paste.html, and it seems entirely expected with a short timeout like this.
Created attachment 213032 [details]