Fix test race condition with DOMContentLoaded

Test tap could somtimes fire before the event handlers were added