Pulled out some code from feature tests to make it more DRY