I think you want to return the promise here so we don't call test.done until the window is closed