Capybara Skill

Generates Capybara E2E tests in Ruby with RSpec integration. Acceptance testing DSL for web apps. Use when user mentions "Capybara", "visit", "fill_in", "click_button", "Ruby E2E". Triggers on: "Capybara", "Ruby acceptance test", "fill_in", "click_button", "have_content".

Published by @LambdaTest·from LambdaTest/agent-skills·0 agent reads / 30d·0 saves·

Capybara Automation Skill

Core Patterns

Basic Test (RSpec)

require 'capybara/rspec'

RSpec.describe 'Login', type: :feature do
  it 'logs in with valid credentials' do
    visit '/login'
    fill_in 'Email', with: '[email protected]'
    fill_in 'Password', with: 'password123'
    click_button 'Login'
    expect(page).to have_content('Dashboard')
    expect(page).to have_current_path('/dashboard')
  end

  it 'shows error for invalid credentials' do
    visit '/login'
    fill_in 'Email', with: '[email protected]'
    fill_in 'Password', with: 'wrong'
    click_button 'Login'
    expect(page).to have_content('Invalid credentials')
  end
end

DSL

# Navigation
visit '/path'
go_back
go_forward

# Interacting
fill_in 'Label or Name', with: 'text'
choose 'Radio Label'
check 'Checkbox Label'
uncheck 'Checkbox Label'
select 'Option', from: 'Select Label'
attach_file 'Upload', '/path/to/file'
click_button 'Submit'
click_link 'More Info'
click_on 'Button or Link'

# Finding
find('#id')
find('.class')
find('[data-testid="x"]')
find(:xpath, '//div')
all('.items').count

# Matchers
expect(page).to have_content('text')
expect(page).to have_selector('#element')
expect(page).to have_css('.class')
expect(page).to have_button('Submit')
expect(page).to have_field('Email')
expect(page).to have_link('Click Here')
expect(page).to have_current_path('/expected')
expect(page).to have_no_content('error')

Within Scope

within('#login-form') do
  fill_in 'Email', with: '[email protected]'
  click_button 'Login'
end

within_table('users') do
  expect(page).to have_content('Alice')
end

TestMu AI Cloud

Capybara.register_driver :lambdatest do |app|
  caps = Selenium::WebDriver::Remote::Capabilities.new(
    browserName: 'chrome',
    'LT:Options' => {
      user: ENV['LT_USERNAME'], accessKey: ENV['LT_ACCESS_KEY'],
      build: 'Capybara Build', name: 'Login Test',
      platform: 'Windows 11', video: true
    }
  )
  Capybara::Selenium::Driver.new(app,
    browser: :remote,
    url: 'https://hub.lambdatest.com/wd/hub',
    capabilities: caps)
end
Capybara.default_driver = :lambdatest

Setup: gem 'capybara' + gem 'selenium-webdriver' in Gemfile

Run: bundle exec rspec spec/features/

Cloud (TestMu AI)

For remote browser execution, see reference/cloud-integration.md and shared/testmu-cloud-reference.md.

Deep Patterns

See reference/playbook.md for production-grade patterns:

SectionWhat You Get
§1 Project SetupGemfile, Capybara config, driver registration, LambdaTest
§2 Feature SpecsLogin flows, JavaScript interactions, modals, async content
§3 Page ObjectsSitePrism pages with elements/sections, usage in specs
§4 API TestingRequest specs with auth headers, JSON assertions
§5 Database CleaningDatabaseCleaner transaction/truncation strategies
§6 Matchers & HelpersCustom helpers, sign_in, expect_flash
§7 CI/CD IntegrationGitHub Actions with Postgres, Redis, Chrome
§8 Debugging Table12 common problems with causes and fixes
§9 Best Practices14-item Capybara testing checklist

Bundled with this artifact

4 files

Reference files that ship alongside this artifact. Agents pull these in only when the task needs them.

More on the bench

SKILL0

Micro SaaS Launcher

Expert in launching small, focused SaaS products fast - the indie hacker approach to building profitable software. Covers idea validation, MVP development, pricing, launch strategies, and growing to sustainable revenue. Ship in weeks, not months.

ai-prompt-engineering+3
40
SKILL0

Security Compliance Compliance Check

You are a compliance expert specializing in regulatory requirements for software systems including GDPR, HIPAA, SOC2, PCI-DSS, and other industry standards. Perform comprehensive compliance audits and provide implementation guidance for achieving and maintaining compliance.

ai-prompt-engineering+3
37
SKILL0

Skill Creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

ai-prompt-engineering+1
36