Explicitly wait for DOM mutation observer in test

Our test harness now allows us to wait for DOM mutations to be reported.

Previously, the append-target test was waiting for an extra RAF as a way
of providing time for mutations to be observed. Now we are explicit, and
more robust in the event that the machine is heavily loaded.

The test harness scheduler event handling code has been refactored to
improve consistency and reduce code duplication.