Fix intermittent QUnit failure
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 14 Nov 2012 22:51:06 +0000 (14:51 -0800)
committerTimo Tijhof <ttijhof@wikimedia.org>
Wed, 14 Nov 2012 23:09:59 +0000 (00:09 +0100)
commitf9462fc7026dc691aa8f074d5604e31f8c760908
tree56338aba2e7c3cb2775edbdf64e5a17295070d9f
parent8eeff3b73c9310a6df24a56b5d3103bc1e94c5b4
Fix intermittent QUnit failure

Occasionally the test 'mediawiki: mw.loader.implement( styles={ "url": {
<media>: [url, ..] } } )' will fail because it only ran 5 of 7 expected
assertions, while at the same time a later test will fail because it had
two extra assertions.

The problem is that the test is performing two external CSS loads, but
calls QUnit.start() after the ''first'' one is loaded. If the second
doesn't manage to get loaded at close to the same time, QUnit moves on
to the next test, and then when the second external CSS file finally
does load it will get counted towards whichever test is running at that
time. This can be reliably reproduced by arranging for
tests/qunit/data/styleTest.css.php to take longer for one than the other
of these two external CSS loads.

The solution is to wait until *both* of those external CSS loads to
complete (or time out) before calling QUnit.start().

Change-Id: Id695e95733b4c3f58234d9688c6b6e1b9ba591cc
tests/qunit/suites/resources/mediawiki/mediawiki.test.js