Improve tests to use Capybara's waiting mechanisms