yui/yui3 — pull request #809 by sdesai (2013-05-30 21:11:29+00:00)
Title: Try and make the event-valuechange tests more robust in CI/under load

We've had intermittently failing event-valuechange tests for multiple releases now.

This attempts to solidify the tests, under CI environment loads/sluggish browsers.

The IME test could use a set of eyes. I just followed the general async structure of the original test, but could be made simpler maybe (for example, not sure if the nested wait is required).

Involves the following:

1. Replaces `wait(fn, arbitraryTimeout)` calls with wait/resume where applicable.
2. Removes custom timeouts from `wait(timeout)` calls. The 200ms delay was causing tests to fail in IE8, under load, probably the result of a poll interval not being able to kick within the timeout period.
3. Tries to force `window.focus()` before executing each test, in order to fix blur related errors in IE8 (similar to the issue we have with FF focus/blur tests failing when not focused).
4. Groups the rest of the tests which do need some kind of `wait(fn, arbitraryTimeout)` because they're waiting for a non-event (e.g. "valuechange should not fire") into a separate test case, and based the arbitraryTimeout on the POLL_INTERVAL + BUFFER, where BUFFER is higher for known flaky browsers (i.e. IE).
5. Added code to force `_stopPolling` on `tearDown`, to avoid having the last interval bleed over into the next test.

Testing:

* Did 10 test runs on Yeti, with the following browsers. No failures (assuming FF is the focused window):

✓ Agent completed: Safari (6.0.1) / Mac OS
✓ Agent completed: Safari (6.0) / iOS 6.0
✓ Agent completed: Chrome (27.0.1453.93) / Mac OS
✓ Agent completed: Firefox (21.0) / Mac OS
✓ Agent completed: Internet Explorer (8.0) / Windows 7
✓ Agent completed: Internet Explorer (9.0) / Windows 7
✓ Agent completed: Safari (4.0) / Linux
✓ Agent completed: Safari (4.0) / Linux
✓ Agent completed: Internet Explorer (8.0) / Windows XP
✓ 135 tests passed! (15 seconds)

* Prior to these changes, if I bumped up the POLL_INTERVAL, to something like 1000ms, I'd see all the arbitraryTimeout tests consistently fail, validating the need for the above changes. When I do that with the above changes, everything passes.

NOTE: The Firefox window focus flakiness issue still applies in general (that is, tests will fail if FF doesn't have focus). The tests weren't ignored in gecko previously, so left them that way, and they seem to have been passing in CI.