Hi all.

For a long time now, many of our legacy robocop tests have loaded a page
via BaseTest's  inputAndLoadUrl(), which sends key events to the url bar.
inputAndLoadUrl() is cool in that it effectively simulates a user typing a
url, but it has been implicated in many intermittent test failures, despite
various attempts at improvement.

BaseTest also provides loadUrl(), which takes the much more direct approach
of simply calling org.mozilla.gecko.Tabs.loadUrl(). loadUrl() does not
simulate key presses, but this is incidental to most tests -- most tests
just want to load some content so that some other feature can be tested.
Experiments on try suggest that switching from inputAndLoadUrl() to
loadUrl() improves reliability. In bug 923109, I have changed most
instances of inputAndLoadUrl() to loadUrl() (or loadUrlAndWait(), which
waits for DOMContentLoaded before returning). I left a few instances of
inputAndLoadUrl() which "resisted" my efforts; perhaps these can be
revisited another day.

I strongly suggest that any future tests derived from BaseTest use
loadUrl() -- not inputAndLoadUrl().

Newer tests, based on UITest, usually use enterAndLoadUrl(), which works
much like inputAndLoadUrl(). As far as I know, enterAndLoadUrl() is
reliable and remains the preferred way to load a page in UITest-based
tests.

Happy testing!

 - Geoff
_______________________________________________
mobile-firefox-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/mobile-firefox-dev

Reply via email to