Write automated browser tests that simulate a user logging in, navigating pages, and verifying that the right content appears.
Test JavaScript-heavy pages by switching to the Selenium driver without rewriting any existing test code.
Use readable, plain-English assertions with RSpec or Cucumber so non-developers can review what the test suite covers.
JavaScript tests require Selenium and a browser such as Chrome or Firefox installed on the machine.
Capybara is a Ruby library for testing web applications by simulating what a real person does in a browser: visiting pages, clicking links, filling in forms, and checking that the right text appears. Instead of testing individual functions in isolation, it lets developers write tests that describe complete user flows, like "go to the login page, type in credentials, click the button, and verify success." The API is written to read like plain instructions. Commands like visit, click_button, fill_in, and expect(page).to have_content describe actions and assertions in straightforward terms. Tests written this way are readable even to people who are not writing the code themselves, which is useful when developers and non-technical collaborators need to agree on what a feature should do. Capybara works with different browser drivers depending on what you need to test. The default lightweight driver runs tests without opening a real browser, which makes tests fast. For pages that rely on JavaScript to work properly, you can switch to Selenium, which does open a real browser. The switch can be made per test without changing how the test is written. Capybara also handles the timing problem that trips up many testing tools: when a page loads content asynchronously after a click, it waits automatically rather than failing because it checked too quickly. It integrates with the common Ruby testing frameworks including RSpec, Cucumber, Minitest, and Test::Unit. Rails applications require almost no setup because Capybara is aware of the Rails application structure. Non-Rails Ruby web apps can be connected directly. This is a tool for Ruby developers building web applications who want to write automated tests that verify their apps work correctly from a user's perspective. The full README is longer than what was shown.
← teamcapybara on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.