Posted about 3 years ago. Visible to the public.

Browser automation with Capybara and Selenium WebDriver

We use Selenium WebDriver integrated with Cucumber/Capybara for full-stack integration testing.

Try and use it

If you haven't yet, try to make your MovieDB cucumber features run in a real browser. To do this

  • add the selenium-webdriver and the database_cleaner gems
  • tag your features with @javascript
  • set up DatabaseCleaner for cucumber, by adding this to your features/support/env.rb:

    Copy
    DatabaseCleaner.strategy = :transaction Cucumber::Rails::Database.javascript_strategy = :truncation

When you run your cucumber feature now, you should see a browser opening. If you use geordi, you might have to try geordi vnc. Get someone to help you if this does not work.

Some of your features might now fail. You might find solutions below:

Making peace with Selenium

Selenium is a powerful tool that you can use to test almost all user interfaces. However it has a lot of quirks you have to deal with. Luckily for you, someone else has already solved all major issues that the Capybara/Selenium combo brings with it.

Understand the following issues and solutions in depth:

Spreewald

Work through the code of all Spreewald steps.

Do you understand the implementation of each step?

Owner of this card:

Avatar
Henning Koch
Last edit:
about 1 year ago
by Henning Koch
Posted by Henning Koch to makandra Curriculum
This website uses cookies to improve usability and analyze traffic.
Accept or learn more