Cherry-pick fixes to test timing from dev branch

Fixes from simplify-session-state branch for issues around browser
timing which cause travis tests to fail.