Smarter MockUI

This fixes test failures I'm seeing on master by avoiding arbitrary setTimeouts.