Skip to content
CAI
Software that uses CAICheck a score

teamcapybara/capybara

56.9

Adequate · 14 November 2026

12.8k

lines of production code

Ruby

primary language

8

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is Capybara, a Ruby library for acceptance testing web applications by simulating user interactions with browser-based interfaces. It provides a unified API for driving multiple browser engines, including Selenium for real browsers and Rack::Test for headless execution, to perform actions like clicking, form filling, and navigation. The system supports complex DOM queries, spatial assertions, and frame/window management, integrating seamlessly with RSpec, Cucumber, and Minitest to validate application behavior.

How it got here

2009–2010 — Capybara 3.0 architecture and driver standardization

17 changes.

This period focused on the major architectural overhaul for Capybara 3.0, replacing the legacy Webcat infrastructure with a modern, standardized driver API and centralized configuration system. The work involved removing obsolete components like Culerity and Rack::Test while introducing robust session management, explicit support for modals and frames, and a comprehensive RSpec test suite to ensure stability.

2011–2015 — Cucumber and RSpec integration overhaul

12 changes.

This period focused on integrating Cucumber support for Capybara testing and significantly restructuring the RSpec integration with a new DSL and matcher library. The work also involved refactoring core components like the RackTest and Selenium drivers, modernizing query resolution logic, and updating dependencies to support newer versions of Rack, RSpec, and Selenium WebDriver.

2016–2018 — Selector and driver refactoring

12 changes.

This period focused on a comprehensive refactoring of the selector architecture and Selenium driver implementations to improve maintainability and parsing accuracy. Significant enhancements included browser-specific node specializations, advanced spatial and relationship assertions, and robust handling of complex CSS and XPath selectors. The work also expanded test coverage and introduced new features for frame interaction, animation disabling, and request tracking.

2019 — driver and selector refactoring

4 changes.

This period focused on restructuring the codebase by splitting driver, server, and selector definitions into dedicated files to improve organization and maintainability. It also involved updating Selenium atoms for more accurate element visibility checks and patching Puma's MiniSSL socket handling to prevent blocking behavior during SSL operations.

Features

Add Capybara integration step definitions

Introduces a new step definition file (features/step\_definitions/capybara\_steps.rb) that provides Cucumber steps for visiting the root/home page, asserting page content, verifying the current Capybara driver, and validating error messages when CSS selectors fail to match.

_features/step\definitions · high confidence

Cucumber integration for Capybara testing

Users can now run Capybara-based acceptance tests using Cucumber. This includes support for standard scenarios, JavaScript driver selection via tags (such as @javascript and @named\_test), Scenario Outlines with parameterized examples, and custom matchers for improved failure reporting.

features · high confidence

New Minitest expectations for ancestor, sibling, and combined selector assertions

The \lib/capybara/minitest/spec.rb\ file now defines Minitest expectations for \has\_ancestor?\, \has\_sibling?\, and the combined selector matchers (\all\_of\, \none\_of\, \any\_of\), bringing the Minitest integration in line with the existing RSpec matchers and the core Capybara API.

lib/capybara/minitest · high confidence

New server-side components for animation disabling, request tracking, and connection checking

This change introduces three new internal classes to the Capybara server module: AnimationDisabler, Checker, and Middleware. The AnimationDisabler middleware injects CSS and JavaScript to disable animations and transitions on test pages, supporting both global disabling and specific CSS selectors, while also handling Content Security Policy nonces. The Checker class manages HTTP/HTTPS connectivity checks, automatically retrying failed HTTP requests as HTTPS and handling specific connection errors like ECONNRESET. The Middleware class wraps the application to track pending requests using a thread-safe counter, exposing this state for debugging or synchronization purposes.

lib/capybara/server · high confidence

Removals

Removal of legacy script/console, generate, and destroy tools

The \script/console\, \script/generate\, and \script/destroy\ executable scripts have been removed from the project. These scripts previously provided direct access to the IRB console and RubiGen-based code generation and destruction utilities. Their removal indicates a shift away from these specific legacy tooling workflows, likely as part of a broader migration to modern Ruby/Rails conventions or alternative scaffolding mechanisms.

script · high confidence

Removal of webcat.rb example script

The example file examples/webcat.rb has been removed from the repository. This file previously demonstrated how to use the Webcat library for browser automation tasks, including visiting pages, interacting with elements (clicking, filling forms), and inspecting responses. Users relying on this specific script for reference or as a starting point will no longer have access to it.

examples · high confidence

Removed Culerity, Rack::Test, and internal server components

The Culerity driver, Rack::Test driver, and the internal Webcat::Server class have been removed from the library. This eliminates the ability to run browser-based tests via Culerity (Firefox), headless tests via Rack::Test, and the internal Mongrel-based server logic previously used to boot applications for testing.

lib/webcat · high confidence

Architecture

Node module split and whitespace normalization

The Capybara::Node implementation has been reorganized into distinct modules (Actions, Finders, Matchers, Document, Element) to improve code structure and maintainability. Additionally, a new WhitespaceNormalizer module has been introduced to handle Unicode-aware text normalization, ensuring that text matching and extraction correctly handle various whitespace characters, directional marks, and line separators across different drivers.

lib/capybara/node · high confidence

Project infrastructure and configuration overhaul

The repository has been restructured with significant changes to its build and configuration setup. The legacy 'webcat' gem infrastructure (Rakefile, Manifest.txt, History.txt) has been removed and replaced with a modern Rakefile supporting RSpec, Cucumber, and RuboCop tasks, including specific drivers for Chrome, Firefox, IE, Edge, and Safari. Configuration files have been added or updated: .codeclimate.yml is new, .rubocop.yml is new with RuboCop 0.72 and specific plugins, .gitignore is expanded, .rspec is new, and .yardopts is new. Documentation files have been reorganized: README.rdoc is renamed to License.txt, a new README.md is added, a new CONTRIBUTING.md is added, and a new UPGRADING.md is added. The History.md file is now a comprehensive changelog. CI configuration includes a new docker-compose.yml for Selenium services and an outdated appveyor.yml.outdated file.

(repo-wide) · high confidence

Selector definitions are extracted into individual files

The selector definitions previously located in lib/capybara/selector/definition have been moved into separate, dedicated files (e.g., button.rb, checkbox.rb, field.rb, link.rb, table.rb, etc.). This refactoring improves code organization and maintainability by isolating each selector's logic, without changing the external API or behavior of the selectors themselves.

lib/capybara/selector/definition · high confidence

Specialized driver modules for Chrome, Edge, Firefox, IE, and Safari

Driver specializations for Chrome, Edge, Firefox, Internet Explorer, and Safari have been moved into dedicated modules within the driver\_specializations directory. This refactoring organizes browser-specific logic—such as window management, session resets, frame switching workarounds, and element visibility handling—into separate files (chrome\_driver.rb, edge\_driver.rb, firefox\_driver.rb, internet\_explorer\_driver.rb, and safari\_driver.rb), improving maintainability and clarity of the Selenium driver implementation.

_lib/capybara/selenium/driver\specializations · high confidence

Behavioural changes

Capybara 3.40.0 release with new configuration and session management APIs

This release introduces a new \Capybara::Config\ class to centralize global settings (such as \app\, \reuse\_server\, \threadsafe\, and driver defaults) and delegates session-specific options to \Capybara::SessionConfig\. It adds a \Capybara::Server\ class to handle Rack application booting, port finding, and error reporting, exposing \base\_url\ and \wait\_for\_pending\_requests\. The \Capybara::Session\ now supports a configuration block when \threadsafe\ is enabled, provides \reset!\ (alias \reset\_session!\) and \quit\ methods for session lifecycle management, and exposes \response\_headers\ and \status\_code\. Integration helpers for RSpec, Minitest, and Cucumber are updated to use the new DSL and session management, while \Capybara::Result\ gains lazy evaluation optimizations and \Capybara::Window\ adds \maximize\ and \fullscreen\ capabilities.

lib/capybara · high confidence

Cucumber integration with RackTest driver

Added a Cucumber integration setup in features/support/env.rb that configures Capybara to use the RackTest driver for both standard and JavaScript tests, removing the previous requirement for a Selenium driver.

features/support · high confidence

Enhanced Selenium driver capabilities for file inputs, element finding, scrolling, and drag-and-drop

The Selenium driver now includes several new internal extensions to improve reliability and feature coverage. File input interactions are more robust, with a new emulation module that handles click failures during file attachment by dispatching native click events. Element finding is optimized using text, visibility, style, and position hints to reduce unnecessary DOM queries, with safeguards against stale elements and JavaScript errors. Scrolling is now supported via new \scroll\_to\ and \scroll\_by\ methods on both sessions and elements, allowing precise control over viewport positioning. Finally, HTML5 drag-and-drop emulation has been significantly refined to support modifier keys, directional dragging, proper event sequencing (including \dragenter\), and compatibility with libraries like SortableJS, while also falling back to legacy drag methods when appropriate.

lib/capybara/selenium/extensions · high confidence

Improved element visibility and attribute retrieval accuracy

The Selenium atoms for checking if an element is displayed and retrieving its attributes have been updated to handle modern HTML elements and edge cases more accurately. The \isDisplayed\ atom now correctly identifies the visibility of elements within popover containers and handles specific cases like SVG paths and image maps. The \getAttribute\ atom has been refined to properly resolve boolean properties, handle style attributes, and correctly return values for specific elements like links and images, ensuring that tests relying on these attributes behave as expected.

lib/capybara/selenium/atoms · high confidence

Introduction of Capybara configuration API and removal of legacy Webcat module

The library now exposes a centralized \Capybara.configure\ API that allows users to set global defaults for server behavior (such as \server\_host\, \server\_port\, and \reuse\_server\), driver selection (\default\_driver\, \javascript\_driver\), and matching strategies (including \default\_selector\, \match\, and \ignore\_hidden\_elements\). This new configuration system is supported by a comprehensive set of error classes and delegation methods in the main module. Concurrently, the legacy \Webcat\ module and its associated drivers have been removed from the codebase.

lib · high confidence

Per-session configuration and new current\_path matchers

Users can now configure Capybara settings on a per-session basis via the new \Capybara::SessionConfig\ class, allowing isolated test environments without affecting global defaults. Additionally, the \current\_path\ matcher has been enhanced with support for filter blocks and options like \ignore\_query\, enabling more precise assertions about the browser's current URL path and query parameters.

lib/capybara/session · high confidence

RSpec matchers restructured with new spatial and ancestor/sibling assertions

The RSpec matcher library has been reorganized into a modular class hierarchy (base.rb, compound.rb, sugar modules) to support new capabilities and cleaner code. Users can now use new \have\_ancestor\ and \have\_sibling\ matchers to assert DOM relationships, and \above\, \below\, \left\_of\, \right\_of\, and \near\ spatial filters to refine selector matches. The \have\_selector\ and \have\_text\ matchers now support filter blocks for more complex assertions. Additionally, the \have\_style\ matcher is deprecated in favor of \match\_style\, and the \have\_current\_path\ matcher now correctly forwards filter blocks.

lib/capybara/rspec/matchers · high confidence

RackTest driver refactored into modular components with enhanced form and redirect handling

The RackTest driver implementation has been restructured into distinct classes (Browser, Driver, Form, Node, CSSHandlers) to improve maintainability and feature support. Users benefit from more accurate form submission behavior, including support for the \formaction\ and \formmethod\ attributes on buttons, proper handling of \fieldset\ disabled states, and correct processing of file uploads via \mini\_mime\. The driver now supports configurable redirect limits and preserves fragments during redirects, while node text extraction normalizes whitespace to match browser behavior. Additionally, the driver now respects the \data-method\ attribute by default and supports CSS-based querying with custom handlers for disabled/enabled states.

_lib/capybara/rack\test · high confidence

Refactor browser-specific node implementations into dedicated classes

The monolithic Selenium node implementation has been split into specific classes for Chrome, Edge, Firefox, IE, and Safari. This change introduces browser-specific behaviors, including HTML5 drag-and-drop emulation for Chrome, Edge, and Firefox; optimized visibility checks using native WebDriver endpoints where available; and targeted workarounds for known driver issues such as file input handling in Chrome 75+, emoji input support in Chrome/Firefox, and table row clicking quirks in Firefox and Safari.

lib/capybara/selenium/nodes · high confidence

Refactor driver and server registrations into separate files with updated Chrome and Puma configurations

The driver and server registration logic has been split into dedicated files (\drivers.rb\ and \servers.rb\) for better organization. The \selenium\_chrome\_headless\ driver now uses the new headless Chrome mode (\--headless=new\) and includes arguments to disable background timer throttling and renderer backgrounding to improve stability. The Puma server registration has been updated to support Puma 6 and Rack 3, including a fix for \Puma::MiniSSL::Socket\#read\_nonblock\ to ensure non-blocking behavior and the application of \conf.clamp\ to handle environment procs correctly.

lib/capybara/registrations · high confidence

Refactored CSS and XPath selector builders to support advanced class and regexp filtering

The CSS and XPath selector builders have been refactored to handle class and attribute conditions more robustly. Users can now use regular expressions for individual class names in class filters, and alternated IDs and class regexps are supported when using CSS selectors. Additionally, the builders now provide a way to specify class names starting with '!' to exclude elements with those classes, enhancing the precision of element selection in both CSS and XPath strategies.

lib/capybara/selector/builders · high confidence

Refactored node class hierarchy and expanded driver capabilities

The node implementation has been restructured into a new \Capybara::Driver::Node\ base class and a \Capybara::Node::Base\ wrapper, introducing explicit support for spatial filters (\obscured?\), shadow DOM (\shadow\_root\), and precise click offsets. The Selenium driver now handles HTML5 input types (date, time, datetime-local, color, range) via JavaScript, supports multiple file uploads, and implements \right\_click\, \double\_click\, and \hover\ actions. Additionally, \Capybara::Node::Simple\ has been enhanced to support \disabled?\ checks and title retrieval, allowing it to function more like a full browser node for static HTML strings.

capybara · high confidence

Refactored query resolution into dedicated query classes

The query resolution logic has been restructured into a set of dedicated classes within the \Capybara::Queries\ module, replacing the previous monolithic approach. New classes such as \ActiveElementQuery\, \AncestorQuery\, \SiblingQuery\, \CurrentPathQuery\, \StyleQuery\, \TextQuery\, and \TitleQuery\ now handle specific lookup operations, while \BaseQuery\ and \SelectorQuery\ provide shared infrastructure for options, validation, and failure messaging. This change improves the clarity of error messages and failure reports by generating descriptions directly from the query objects, and introduces new capabilities like ancestor and sibling node traversal, style attribute matching, and more precise path matching using the Addressable gem.

lib/capybara/queries · high confidence

Refactored selector architecture with new CSS splitter and filter sets

The selector system has been restructured to improve maintainability and parsing accuracy. A new \Capybara::Selector::CSS\ class now handles CSS selector splitting, correctly parsing complex structures like square brackets, parentheses, and quoted strings to avoid incorrect splits on commas within attributes. Selector definitions are now managed via \Capybara::Selector::Definition\ and \Capybara::Selector::FilterSet\, allowing for explicit registration of node and expression filters with better error descriptions. Additionally, a \RegexpDisassembler\ using the \regexp\_parser\ gem replaces previous regex string extraction, enabling more robust handling of regular expressions in locators.

lib/capybara/selector · high confidence

Refactored selector filter architecture with new base classes

The internal implementation of selector filters has been restructured to improve modularity and error handling. New base classes (\Base\, \ExpressionFilter\, \NodeFilter\, and \LocatorFilter\) have been introduced in \lib/capybara/selector/filters\ to standardize how filters are initialized, validated, and applied. This refactoring ensures that \ElementNotFound\ errors raised during filter evaluation are correctly interpreted as non-matches rather than failures, and allows filters to operate within the context of the selector they are used in, enabling more detailed error reporting for users when selections fail.

lib/capybara/selector/filters · high confidence

Reworked RSpec integration with new DSL aliases and matcher structure

The RSpec integration has been restructured to provide a more robust and consistent testing experience. A new shared context 'Capybara Features' is now available, which aliases \given\/\given!\ to \let\/\let!\ and allows marking example groups as \:feature\ type via \feature\, \ffeature\, or \xfeature\ blocks. The matcher library has been refactored into distinct classes (e.g., \HaveSelector\, \HaveText\, \NegatedMatcher\) to improve error handling and support advanced features like optional filter blocks and compound selectors (\have\_all\_of\_selectors\, \have\_any\_of\_selectors\). Additionally, \have\_style\ is deprecated in favor of \match\_style\, and proxy methods for \all\ and \within\ are now installed via module prepending to ensure compatibility with RSpec's matcher system.

lib/capybara/rspec · high confidence

Selenium driver performance and compatibility improvements

The Selenium driver now uses a persistent HTTP client to reduce connection overhead, caches JavaScript atoms for faster execution, and optimizes the \is\_element\_displayed\ check by using the native endpoint when available. It also patches a workaround for geckodriver pause duration issues, restores Chrome log access for W3C-compliant drivers (75+), and removes support for Ruby 2.4.

lib/capybara/selenium/patches · high confidence

Selenium driver requires selenium-webdriver 4.8+ and introduces persistent HTTP client

The Selenium driver now mandates selenium-webdriver version 4.8 or higher, issuing a warning if an older version is detected. To improve performance and stability, the driver now uses a persistent HTTP client by default, which can be configured with a custom timeout via the :timeout option. Additionally, the driver supports clearing local and session storage on session reset through the clear\_local\_storage and clear\_session\_storage options.

lib/capybara/selenium · high confidence

Standardized driver API with explicit support for modals, frames, and window management

The base driver class now defines a comprehensive, standardized interface for driver implementations, replacing previous ad-hoc or missing methods. This change introduces explicit support for handling browser modals (accept/dismiss), navigating iframes (switch\_to\_frame, frame\_title, frame\_url), and managing browser windows (resize, maximize, fullscreen, close, switch). It also standardizes script execution (execute\_script, evaluate\_async\_script), screenshot capture, and HTTP status code retrieval, ensuring that drivers explicitly declare support for these features via Capybara::NotSupportedByDriverError when they are not implemented.

lib/capybara/driver · high confidence

Fixes

Fixes blocking behavior in Puma MiniSSL socket reads

The Capybara Puma server registration now includes a patch for \Puma::MiniSSL::Socket\#read\_nonblock\ to ensure SSL socket reads remain non-blocking. This change addresses a regression where the server could hang during SSL operations, specifically resolving the issue where the read loop failed to handle \EAGAIN\ wait states correctly by properly checking for \wait\_readable\ and \wait\_writable\ conditions before raising exceptions or returning.

lib/capybara/registrations/patches · high confidence

Test coverage

Added RSpec integration tests for feature DSL and shared matchers; Added comprehensive test coverage for session interaction methods; Added spec view templates for testing Capybara features; Added test coverage for frame interaction APIs; Added test coverage for the new window management API; Added test fixtures for SSL and Selenium exit codes; Added test fixtures for file upload scenarios; Added test suite for core Capybara components; Added tests for element selector matching methods; New centralized spec helper and test application for Capybara's test suite; Removal of legacy test suite files.

Dependencies

Initial gemspec and Gemfile for Capybara 3.2.0

The project now includes a formal gemspec and Gemfile, establishing the dependency structure for the upcoming 3.2.0 release. Runtime dependencies are pinned to specific versions, including \xpath \~\>3.2\, \nokogiri \~\>1.11\, \rack \>=1.6.0\, and \selenium-webdriver \~\>4.8\ (as a development dependency). The gem requires Ruby 3.2.0 or higher and includes development tools such as RSpec, Cucumber, and Rubocop to support testing and code quality.

(dependencies) · high confidence

Updated and expanded test gemfiles for modern dependencies

The test suite's gemfiles have been updated to support newer versions of key dependencies. Base versions now pin to Rack 2.0, Nokogiri 1.11, RSpec 3.13, and Selenium WebDriver 4.40. Beta and edge testing configurations have been added or updated to include Rack 3 and Sinatra 4 support, as well as direct references to GitHub repositories for RSpec, Cucumber, and Puma to test against development branches. Additionally, the IE-specific gemfile has been simplified, and the Chrome/Edge configurations now explicitly reference the teamcapybara fork of the xpath gem.

gemfiles · high confidence

Updated test dependencies to jQuery UI 1.11.4

The test suite now uses jQuery UI version 1.11.4 for its public specification tests, replacing the previous version. This update ensures that tests relying on jQuery UI components (such as datepickers, accordions, and menus) run against a more modern library version.

lib/capybara/spec/public · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 57 → 57 (-0.2)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 62 → 59 (-3.2)
  • Architecture 84 → 94 (+9.7)
  • Maturity 55 → 55 (+0.0)
  • Readiness 52 → 52 (+0.0)
  • Security 72 → 69 (-2.7)

Resolved (3)

  • Duplicated block (9 lines × 2) (lib/capybara/selector/definition/file_field.rb)
  • Off-boarding risk: anonymized user #1
  • Projects may be oversized for their cohesion

New (8)

  • Edited copy of a member (17 corresponding lines) (lib/capybara/selenium/driver_specializations/chrome_driver.rb)
  • Edited copy of a member (17 corresponding lines) (lib/capybara/selenium/nodes/firefox_node.rb)
  • Edited copy of a member (3 corresponding lines) (lib/capybara/selenium/driver_specializations/chrome_driver.rb)
  • Edited copy of a member (8 corresponding lines) (lib/capybara/queries/selector_query.rb)
  • Edited copy of a member (8 corresponding lines) (lib/capybara/selenium/driver_specializations/chrome_driver.rb)
  • Edited copy of a member (8 corresponding lines) (lib/capybara/selenium/nodes/chrome_node.rb)
  • Edited copy of a member (9 corresponding lines) (lib/capybara/queries/ancestor_query.rb)
  • Off-boarding risk: anonymized user #1

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

teamcapybara/capybara was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 265d2d175f4be3ddf785d7597bdfd19b231f844a — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-36d4cd83012f.