Improve E2E text page test: wait for alerts

I've found a way to wait for a browser alert, so we can get rid of the
browser.sleep(100) call. That was bugging me, because there's no way to
be certain that 100 ms would be long enough to wait.

Also, it turns out we need a waitForAlert() call before the first alert
is tested, too -- occasionally the test would fail on that first alert.
So this commit kills two birds^Wbugs with one stone^Wwait().