Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Teamcapybara Capybara Spec Shared Selenium Session

From Leeroopedia
Knowledge Sources
Domains Testing, Test_Specification, Selenium
Last Updated 2026-02-12 06:00 GMT

Overview

Shared RSpec test suite that validates Selenium-specific session behavior across Chrome, Firefox, Edge, and Safari drivers.

Description

This file defines shared RSpec examples that are included in each browser-specific Selenium test runner (e.g., `spec/selenium_spec_chrome.rb`, `spec/selenium_spec_firefox.rb`). It covers Selenium-only features not testable with the RackTest driver, including JavaScript alerts, advanced input handling, HTML5 drag-and-drop, and browser-specific quirks.

Usage

Include these shared examples in browser-specific Selenium test files to verify Selenium driver compliance with Capybara's expected behavior contract for JavaScript-enabled testing.

Code Reference

Source Location

Signature

RSpec.shared_examples 'Capybara::Session' do |session, mode|
  # Selenium-specific shared test examples
end

Import

require 'spec_helper'
require 'shared_selenium_session'

Key Test Scenarios

  • Alert and Modal Handling: Tests `accept_alert`, `accept_confirm`, `dismiss_confirm`, `accept_prompt`
  • Fill Options: Tests `fill_in` with `clear: :backspace`, `clear: :none`, and array clearing
  • Date Fields: Tests filling date/time/datetime-local inputs
  • Emoji Support: Tests entering emoji characters
  • Key Events: Tests `send_keys` for generating keyboard events
  • Stale Element Detection: Tests behavior when DOM elements become stale
  • Fixed Headers/Footers: Tests clicking elements obscured by fixed-position elements
  • File Attachment: Tests directory uploads and relative paths
  • Animation Control: Tests per-session `animation_disabler` behavior

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment