Make tests handle events better