215 Browser automation with Capybara and Selenium WebDriver [2d]

Updated . Posted . Visible to the public.

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

Try and use it

Your forked MovieDB should already include a feature that uses a real browser. Add the @javascript tag to your other features to test it yourself.

When you run your cucumber feature now with NO_HEADLESS=1 geordi cucumber, you should see a browser opening. 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:

Exercise: A walk through the forest

Work through the code of all Spreewald steps Show archive.org snapshot . Do you understand the implementation of each step?

Exercise: Recognize common culprits

Have a look at this code:

class User < ApplicationRecord
  def self.find_by_email(email)
    @cached_users ||= {}
    @cached_users[email] ||= User.find_by_email!(email)
  end
end

Could it cause your tests to become flaky?

Henning Koch
Last edit
Michael Leimstädtner
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra Curriculum (2015-09-04 13:59)