Browser automation with Capybara and Selenium WebDriver [2d]
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
tag your features with
set up DatabaseCleaner for cucumber, by adding this to your
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:
- Difference between Capybara drivers
- Fixing flaky integration tests
- What does the
- Freezing your Firefox version for Selenium tests
- For newer apps we prefer running Selenium tests with Chrome instead, which doesn't have the same incompatibility issues as Firefox
- Running headless Selenium tests in a VNC buffer
- For newer apps we prefer running Chrome in headless mode
- Waiting for page loads and AJAX requests to finish with Capybara
- Threads and processes in a Capybara/Selenium session
- Why do we need the
database_cleanergem for Selenium tests?
- Why your Cucumber feature loses cookies when run under Selenium or capybara-webkit
- Why you see a GET "/identify" request in Capybara tests
- Understanding the Selenium error "Modal Dialog Present"
- Taking screenshots in Capybara
- Capybara/Selenium: evaluate_script might freeze your browser, use execute_script
- How to: Start Selenium browser maximized or with custom window size
- Disable text-transforms in Selenium tests
- Mock the browser time or time zone in Selenium features
Work through the code of all Spreewald steps.
Do you understand the implementation of each step?