Skip to content
CAI
Software that uses CAICheck a score

teamcapybara/capybara

69.6

Adequate · 26 September 2026

12.8k

lines of production code

Ruby

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This release delivers a comprehensive architectural overhaul of Capybara, significantly modernizing the codebase by introducing modular classes for drivers, nodes, selectors, and RSpec integration. Key features include enhanced Selenium support for shadow DOM, HTML5 drag-and-drop, and headless browser improvements, alongside new Cucumber and Minitest integrations. The update also enforces stricter Ruby and Selenium version requirements, removes legacy Webcat and Culerity code, and expands test coverage for session, window, and frame handling.

Features

Add Cucumber step definitions for basic Capybara interactions

A new Cucumber step definition file is introduced, providing ready-to-use steps for visiting the root page, asserting page content, verifying the current driver, and validating error messages for failing CSS matchers.

_features/step\definitions · high confidence

Added Cucumber integration support for Capybara

A new support file (env.rb) was added to enable Cucumber integration with Capybara. This includes requiring the necessary Capybara and test app modules, configuring the application, and registering custom drivers (javascript\_test and named\_test) that use RackTest, which allows Cucumber tests to run without needing a full JavaScript-capable browser driver.

features, features/support · medium confidence

Adds Minitest expectations for Capybara matchers

The file lib/capybara/minitest/spec.rb was added, introducing a comprehensive set of Minitest expectations (e.g., \must\_have\_button\, \must\_have\_content\, \must\_have\selector\) that mirror Capybara's node matchers. This change brings parity between RSpec and Minitest support by providing \must\\ and \wont\_\ prefixed methods for common assertions like checking for elements, content, links, and CSS selectors.

lib/capybara/minitest · high confidence

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

The Selenium driver now includes new extension modules to improve interaction with file inputs, scrolling, and HTML5 drag-and-drop. File input clicks are now emulated via JavaScript to ensure reliable file attachment. Scrolling is supported via new \scroll\_to\ and \scroll\_by\ methods on both the session and element nodes, allowing precise control over viewport positioning. Additionally, HTML5 drag-and-drop emulation has been significantly improved with better handling of modifier keys, event dispatching on the correct target elements, and support for descendant draggables, making automated drag-and-drop tests more robust and compatible with modern web applications.

lib/capybara/selenium/extensions · medium confidence

Introduce new query classes for element selection and assertions

The Capybara query system is refactored into a set of dedicated query classes (ActiveElementQuery, AncestorQuery, BaseQuery, CurrentPathQuery, MatchQuery, SelectorQuery, SiblingQuery, StyleQuery, TextQuery, and TitleQuery) located in lib/capybara/queries. These classes encapsulate the logic for resolving and matching elements, paths, titles, and styles, providing improved error messages, support for regular expressions in filters, and better handling of whitespace and visibility states. This change enables more precise and flexible assertions and matchers for testing web applications.

lib/capybara/queries · high confidence

Introduce server-side components for request tracking and animation disabling

Added three new classes to the Capybara server: AnimationDisabler, which injects CSS and JavaScript to disable animations and scroll behavior on pages; Checker, which handles HTTP/HTTPS connectivity testing with automatic fallback; and Middleware, which tracks pending requests and manages server errors. These components enable Capybara to disable animations during tests and provide better visibility into request states.

lib/capybara/server · high confidence

New RSpec DSL and matchers for Capybara integration

The \lib/capybara/rspec\ directory now contains the core RSpec integration files: \features.rb\ defines the \Capybara Features\ shared context and aliases (e.g., \scenario\, \ffeature\), while \matcher\_proxies.rb\ installs the Capybara DSL into RSpec. Additionally, \matchers.rb\ introduces a comprehensive set of RSpec matchers for testing web elements, including \have\_selector\, \have\_text\, \have\_title\, \have\_current\_path\, \match\_style\, and negated variants like \have\_no\_text\. This provides a structured, object-oriented API for writing acceptance tests in RSpec.

lib/capybara/rspec · high confidence

Removals

Removed Culerity and Rack::Test drivers

The Culerity and Rack::Test driver implementations have been removed from the webcat library. This eliminates the dependency on the Culerity gem and the associated server bootstrapping logic, simplifying the driver interface.

lib/webcat · high confidence

Architecture

Refactor Capybara::Node into modular components

The Capybara::Node class hierarchy has been restructured into separate modules for Finders, Actions, and Matchers, each included into a new Capybara::Node::Base class. This refactoring extracts specific functionality—such as click, fill\_in, find, and assertion methods—into dedicated modules (Capybara::Node::Actions, Capybara::Node::Finders, Capybara::Node::Matchers) to improve code organization and maintainability.

lib/capybara/node · high confidence

Refactor RackTest driver into modular classes

The RackTest driver implementation has been refactored from a single monolithic file into separate classes for Browser, CSSHandlers, Driver, Errors, Form, and Node. This structural change improves code organization and maintainability without altering the external API or user-facing behavior.

_lib/capybara/rack\test · high confidence

Refactor browser-specific node implementations into dedicated classes

The browser-specific node implementations for Chrome, Edge, Firefox, IE, and Safari have been extracted from the generic Capybara::Selenium::Node class into their own dedicated classes (e.g., Capybara::Selenium::ChromeNode). This change isolates browser-specific workarounds and optimizations—such as handling file input clicks, emulating HTML5 drag-and-drop, and managing browser version checks—within their respective node classes, improving code maintainability and clarity.

lib/capybara/selenium/nodes · high confidence

Refactor selector definitions into individual files

The internal implementation of Capybara's built-in selectors (such as :button, :checkbox, :field, :link, and others) has been reorganized. Each selector type is now defined in its own separate file within the lib/capybara/selector/definition directory. This change improves code organization and maintainability without altering the public API or expected user behavior.

lib/capybara/selector/definition · high confidence

Separate driver and server registration logic into dedicated files

The codebase has been reorganized by moving driver registrations (such as :selenium, :selenium\_chrome, and :rack\_test) into a new file \lib/capybara/registrations/drivers.rb\, and server registrations (including :default, :webrick, and :puma) into \lib/capybara/registrations/servers.rb\. This change improves code maintainability and clarity by grouping related registration logic, while preserving the existing functionality for all supported browsers and servers.

lib/capybara/registrations · high confidence

Behavioural changes

Capybara 3.0 introduces a new configuration and DSL architecture

Capybara 3.0 restructures the library's internal architecture, introducing a new \Capybara::Config\ class to manage global settings such as the default driver, server, and thread safety. The \Capybara::DSL\ module is now explicitly included into the \Capybara\ module, allowing all session methods to be called directly on the \Capybara\ object. Additionally, the \Capybara::Result\ class is introduced to handle collections of found elements, providing an array-like interface for iteration and selection. The \cucumber.rb\ and \rails.rb\ integration files are also updated to align with these new internal structures.

lib/capybara · high confidence

Capybara 3.40.0 release: Ruby 3.0+ and Selenium 4.8+ required

Capybara 3.40.0 is now available, requiring Ruby 3.0 or later and Selenium 4.8 or later. This release adds support for multiple assignment on \Capybara::Result\#to\_ary\, introduces \has\_element?\ and related matchers, and provides initial support for Rack 3. Additionally, the default headless option for ChromeDriver is now enabled via the registered Selenium driver.

(repo-wide) · high confidence

Consolidate Capybara configuration and remove legacy Webcat module

The Capybara configuration API is now centralized in \lib/capybara.rb\, which defines the \Capybara\ module with a \configure\ method and delegates global settings (such as \default\_max\_wait\_time\, \reuse\_server\, and \server\_host\) to a shared \Config\ object. Additionally, the legacy \Webcat\ module and its associated \lib/webcat.rb\ file have been removed, indicating a cleanup of deprecated or unused code.

lib · high confidence

Fix Puma SSL socket read\_nonblock blocking behavior

The Puma SSL socket registration now implements a non-blocking read loop that handles EAGAIN conditions and engine state transitions, preventing the server from blocking during SSL data reads. This resolves the issue where the Capybara Puma server registration could hang or block unexpectedly.

lib/capybara/registrations/patches · medium confidence

Improved Selenium driver performance and compatibility

The Selenium driver now uses a persistent HTTP client to reduce connection overhead, and includes specific patches to handle Chrome 75+ W3C mode logging, fix pause duration issues with geckodriver 0.22, and optimize atom loading for faster element visibility checks.

lib/capybara/selenium/patches · medium confidence

Improved visibility and attribute detection for HTML5 elements

The \isDisplayed\ atom now correctly handles \popover\ elements, ensuring they are recognized as visible when open. Additionally, the \getAttribute\ atom has been updated to properly retrieve the \selected\ and \checked\ attributes for \OPTION\, \INPUT\ (checkbox/radio) elements, and other boolean attributes, fixing issues where these values were previously returned incorrectly or not at all.

lib/capybara/selenium/atoms · high confidence

Introduce base driver and node interfaces for Capybara

The Capybara driver architecture has been refactored to introduce explicit base classes for drivers and nodes. A new \Capybara::Driver::Base\ class defines the standard driver API (e.g., \visit\, \find\_xpath\, \save\_screenshot\, window management, and modal handling) with default implementations that raise \NotSupportedByDriverError\, allowing drivers to selectively implement features. Similarly, \Capybara::Driver::Node\ provides a structured interface for node interactions (e.g., \click\, \set\, \scroll\_to\, \shadow\_root\) with default \NotImplementedError\ or error-raising stubs. This change establishes a clear contract for driver implementations to follow, enabling better support for new browser capabilities and more consistent behavior across different browser drivers.

lib/capybara/driver · high confidence

New session configuration and current path matchers

Capybara introduces a new \SessionConfig\ class to manage session-specific settings, including new options for \default\_set\_options\, \disable\_animation\, \test\_id\, \predicates\_wait\, \default\_normalize\_ws\, and \w3c\_click\_offset\. The library also adds \current\_path\ matchers (\has\_current\_path?\, \has\_no\_current\_path?\, \assert\_current\_path\, \assert\_no\_current\_path\) that support filter blocks and query parameter handling, while deprecating \Capybara.exact\_options\ and \ignore\_query\ in favor of auto-detection.

lib/capybara/session · medium confidence

Refactor RSpec matchers into a modular, extensible base class with filter block support

The RSpec matchers have been restructured into a modular architecture. A new \Base\ class now handles common initialization, including the storage and forwarding of a \filter\_block\ to underlying Capybara query methods, enabling more flexible element filtering in assertions. Specific matchers like \HaveSelector\, \HaveText\, and \HaveAncestor\ now inherit from this base, which also integrates \CountSugar\ and \SpatialSugar\ modules to provide fluent APIs for counting (e.g., \exactly\, \at\_most\) and spatial relationships (e.g., \above\, \near\). This change also introduces support for passing filter blocks to matchers, allowing users to apply additional conditions to element selections within assertions.

lib/capybara/rspec/matchers · high confidence

Refactor and modernize the Selenium driver and node implementations

The Selenium driver and node classes have been refactored to improve reliability, performance, and compatibility with modern browser automation. Key changes include: raising an error when attempting to set a value to a readonly field; supporting multiple file uploads; implementing \Session\#send\_keys\ and \Node\#send\_keys\; adding support for \drag\_to\ with held modifier keys; implementing \Node\#obscured?\ and the \:obscured\ system filter; adding \Node\#path\ for shadow DOM support; and ensuring the browser is properly cleared and reset during session resets. Additionally, the driver now uses a persistent HTTP client by default, handles various Selenium-specific workarounds (e.g., for headless Chrome modals and geckodriver issues), and enforces a minimum \selenium-webdriver\ version of 4.8.

lib/capybara/selenium · medium confidence

Refactor selector filters into a modular class hierarchy

The selector filter system has been restructured into a new class hierarchy: a base \Base\ class that encapsulates common filter logic (initialization, validation, and application), an \ExpressionFilter\ for evaluating expressions, a \NodeFilter\ for matching nodes, and a \LocatorFilter\ for locating elements. This refactoring introduces a more modular and extensible approach to defining and applying filters, improving code organization and maintainability while preserving existing functionality.

lib/capybara/selector/filters · high confidence

Refactored CSS and XPath selector builders

The CSS and XPath selector condition generation logic has been moved into dedicated builder classes (CSSBuilder and XPathBuilder). This refactoring introduces support for using regular expressions in individual class names for CSS selectors, allows alternating id and class regexps in CSS, and provides a way to specify class starting with '!' for exclusion. The changes improve code organization by separating expression building from the main selector logic.

lib/capybara/selector/builders · medium confidence

Refactored selector definition and filter handling

The selector system has been refactored to separate selector definitions from their configuration. A new \Capybara::Selector::Definition\ class manages selector metadata, expressions, and filters, while \Capybara::Selector::FilterSet\ centralizes the storage and description of node and expression filters. This change introduces a \Capybara::Selector::CSS\ class for CSS parsing and a \Capybara::Selector::RegexpDisassembler\ for processing regular expressions, moving logic previously embedded in the main \Selector\ class into dedicated files and classes.

lib/capybara/selector · medium confidence

Removal of webcat.rb example

The webcat.rb example file has been removed from the examples directory. This file previously demonstrated usage of the Webcat library, including session management, navigation, element interaction, and form filling. Users relying on this example for reference or integration will no longer have access to this specific demonstration of the library's capabilities.

examples · high confidence

Removed legacy script generators and console helper

The project has removed the \script/console\, \script/generate\, and \script/destroy\ shell scripts. These scripts previously provided a Ruby IRB console environment for the 'webcat' gem and handled code generation via RubiGen. Their removal indicates a shift away from these specific development-time tooling and code-generation workflows.

script · high confidence

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

The Selenium driver logic has been refactored into dedicated specialization modules for each browser (Chrome, Edge, Firefox, IE, and Safari). This change introduces browser-specific handling for window management, storage clearing, and frame switching, while also enabling native element visibility detection where supported by the respective browser drivers.

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

Test coverage

Add spec tests for element matching methods; Added RSpec integration tests for feature, scenario, and view specs; Added modal handling and element querying tests; Added test fixture files for file upload scenarios; Added test fixtures for Selenium driver exit codes; Added test suite for basic node functionality and Capybara configuration; Added test view templates for headless browser scenarios; Added tests for frame title, URL, and switching behavior; Added tests for the new window management API; Refactor Capybara's test suite infrastructure; Removed obsolete test files; Updated test fixtures with jQuery UI 1.11.4.

Dependencies

Capybara 3.2.0 release and dependency updates

This release updates the gemspec to require Ruby 3.2.0 or higher and introduces several dependency changes. Runtime dependencies now include 'matrix' and 'regexp\_parser' (\>=1.5, \<3.0), while 'nokogiri' is pinned to \~\> 1.11. Development dependencies have been updated to include 'rubocop' (\~\>1.1) and its related linters, 'rspec' (\>= 3.5.0), and 'selenium-webdriver' (\~\>4.8). The 'xpath' gem is now sourced from the 'teamcapybara/xpath' GitHub repository.

(dependencies) · high confidence

Updated base and beta dependency versions for Selenium, RSpec, and Rack

The Gemfile.base-versions has been updated to require Selenium 4.40.0, RSpec 3.13.0, and Nokogiri 1.11.0. The Gemfile.beta-versions now pulls RSpec, Cucumber, and Puma from their respective main branches, and specifies Selenium 4.8.6+. Additionally, new Gemfiles for Rack 2 and Rack 3 environments were added to support testing against those specific versions.

gemfiles · high confidence

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

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 35 → 70 (+34.7)
  • Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 46 → 90 (+43.9)
  • Architecture 94 → 98 (+3.6)
  • Maturity 61 → 60 (-0.9)
  • Readiness 14 → 69 (+54.9)
  • Security 54 → 85 (+30.9)

Resolved (30)

  • Change coupling: jquery-ui.js ↔ jquery.js (lib/capybara/spec/public/jquery-ui.js)
  • Coverage not measured — test suite did not build
  • Dimension evaluation failed
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • No exposed public API
  • No tests found
  • …and 10 more

New (77)

  • (anonymous)::get (cognitive 33) (lib/capybara/selenium/atoms/src/getAttribute.js)
  • (anonymous)::get (cyclomatic 26) (lib/capybara/selenium/atoms/src/getAttribute.js)
  • (anonymous)::getOverflowState (cognitive 45) (lib/capybara/selenium/atoms/src/isDisplayed.js)
  • (anonymous)::getOverflowState (cyclomatic 31) (lib/capybara/selenium/atoms/src/isDisplayed.js)
  • (anonymous)::isShown::displayed (cognitive 18) (lib/capybara/selenium/atoms/src/isDisplayed.js)
  • (anonymous)::isShown::displayed (cyclomatic 17) (lib/capybara/selenium/atoms/src/isDisplayed.js)
  • (anonymous)::isShown_ (cyclomatic 18) (lib/capybara/selenium/atoms/src/isDisplayed.js)
  • Ambiguity between has_ancestor? and matches_selector? when checking ancestor relationships. While has_ancestor? is specific, matches_selector? can also be used to check if a node matches a selector that might be an ancestor. The API surface allows multiple ways to express similar structural checks without clear guidance on precedence.
  • Base.synchronize (cognitive 20) (lib/capybara/node/base.rb)
  • Change coupling: chrome_node.rb ↔ edge_node.rb (lib/capybara/selenium/nodes/chrome_node.rb)
  • Change coupling: spec.rb ↔ matchers.rb (lib/capybara/minitest/spec.rb)
  • Duplicate intent between has_css? and matches_css?. Both methods check for the presence of a CSS selector result. The matches_ prefix is redundant and inconsistent with the primary has_ prefix.
  • Duplicate intent between has_xpath? and matches_xpath?. Both methods check for the presence of an XPath query result. The matches_ prefix is redundant and inconsistent with the primary has_ prefix used for CSS and general selectors.
  • Duplicated block (11 lines × 2) (lib/capybara/selenium/nodes/firefox_node.rb)
  • Duplicated block (14 lines × 2) (lib/capybara/selenium/nodes/chrome_node.rb)
  • Duplicated block (7 lines × 2) (lib/capybara/selenium/driver_specializations/chrome_driver.rb)
  • Duplicated block (7 lines × 3) (lib/capybara/selenium/driver_specializations/firefox_driver.rb)
  • Duplicated block (9 lines × 2) (lib/capybara/selenium/nodes/chrome_node.rb)
  • FileTooLong: queries/selector_query.rb (lib/capybara/queries/selector_query.rb)
  • Floating git dependency: xpath
  • …and 57 more

Written by watchdog.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 26 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 15b5fdb76e972e9623d5af2123ed3755594f9732 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-d0929f7ac71f.