[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D85EC71QB1BP46PCT9BD0M":3,"skill-same:01M7D85EC71QB1BP46PCT9BD0M":76},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":14,"repositoryHtmlUrl":57,"repositoryHomepageUrl":6,"ownerHtmlUrl":58,"ownerBlogUrl":59,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M7D85EC71QB1BP46PCT9BD0M","Capybara Testing",null,"Expert-level Capybara acceptance testing skill for Ruby and Rails applications. Covers RSpec integration, DSL methods, scoping, Page Objects with SitePrism, JavaScript interactions, and database cleaning strategies.","GrupoANDevelopment-m\u002Falberto-ai","GrupoANDevelopment-m","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F257455179?v=4","01M7D69X2N2KEVN0SJF6WGM6SH","Antônio  Ndombe","01M7D69X3P5JTT8H8S904N3888",0,"MIT","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fcapybara-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: Capybara Testing\ndescription: Expert-level Capybara acceptance testing skill for Ruby and Rails applications. Covers RSpec integration, DSL methods, scoping, Page Objects with SitePrism, JavaScript interactions, and database cleaning strategies.\nversion: 1.0.0\nauthor: thetestingacademy\nlicense: MIT\ntags: [capybara, ruby, rails, acceptance-testing, rspec, feature-tests, browser-testing]\ntestingTypes: [e2e, acceptance, integration]\nframeworks: [capybara, rspec, siteprism]\nlanguages: [ruby]\ndomains: [web]\nagents: [claude-code, cursor, github-copilot, windsurf, codex, aider, continue, cline, zed, bolt]\n---\n\n# Capybara Testing Skill\n\nYou are an expert QA automation engineer specializing in Capybara acceptance testing for Ruby and Rails applications. When the user asks you to write, review, or debug Capybara tests, follow these detailed instructions.\n\n## Core Principles\n\n1. **User-centric DSL** -- Capybara's DSL reads like user instructions: `visit`, `fill_in`, `click_button`, `expect(page).to have_content`. Write tests as stories.\n2. **Smart waiting** -- Capybara has built-in waiting for dynamic content. Never use `sleep`. Use `have_content`, `have_selector` matchers that auto-retry.\n3. **Scope with within** -- Use `within` blocks to scope actions to specific page regions. This prevents ambiguous matches and makes tests resilient.\n4. **Driver selection** -- Use `:rack_test` for fast non-JS tests, `:selenium_chrome_headless` for JavaScript-dependent tests. Tag JS tests explicitly.\n5. **Test isolation** -- Each spec must be independent. Use DatabaseCleaner with transaction strategy for non-JS and truncation for JS tests.\n\n## Project Structure\n\nAlways organize Capybara projects with this structure:\n\n```\nspec\u002F\n  features\u002F\n    auth\u002F\n      login_spec.rb\n      signup_spec.rb\n    dashboard\u002F\n      dashboard_spec.rb\n    checkout\u002F\n      cart_spec.rb\n      payment_spec.rb\n  pages\u002F\n    login_page.rb\n    dashboard_page.rb\n    base_page.rb\n  support\u002F\n    capybara.rb\n    database_cleaner.rb\n    helpers\u002F\n      auth_helper.rb\n      wait_helper.rb\n  factories\u002F\n    users.rb\n    products.rb\nspec_helper.rb\nrails_helper.rb\nGemfile\n```\n\n## Setup\n\n### Gemfile\n\n```ruby\ngroup :test do\n  gem 'capybara', '~> 3.40'\n  gem 'selenium-webdriver', '~> 4.18'\n  gem 'rspec-rails', '~> 6.1'\n  gem 'factory_bot_rails'\n  gem 'database_cleaner-active_record'\n  gem 'site_prism', '~> 5.0'\nend\n```\n\n### Capybara Configuration (spec\u002Fsupport\u002Fcapybara.rb)\n\n```ruby\nrequire 'capybara\u002Frspec'\n\nCapybara.configure do |config|\n  config.default_driver = :rack_test\n  config.javascript_driver = :selenium_chrome_headless\n  config.default_max_wait_time = 10\n  config.app_host = 'http:\u002F\u002Flocalhost:3000'\n  config.server_host = 'localhost'\n  config.server_port = 3001\n  config.default_normalize_ws = true\nend\n\nCapybara.register_driver :selenium_chrome_headless do |app|\n  options = Selenium::WebDriver::Chrome::Options.new\n  options.add_argument('--headless=new')\n  options.add_argument('--no-sandbox')\n  options.add_argument('--disable-gpu')\n  options.add_argument('--window-size=1920,1080')\n\n  Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\nend\n```\n\n### DatabaseCleaner Configuration\n\n```ruby\nrequire 'database_cleaner\u002Factive_record'\n\nRSpec.configure do |config|\n  config.before(:suite) do\n    DatabaseCleaner.strategy = :transaction\n    DatabaseCleaner.clean_with(:truncation)\n  end\n\n  config.around(:each) do |example|\n    DatabaseCleaner.cleaning do\n      example.run\n    end\n  end\n\n  config.around(:each, js: true) do |example|\n    DatabaseCleaner.strategy = :truncation\n    DatabaseCleaner.cleaning do\n      example.run\n    end\n    DatabaseCleaner.strategy = :transaction\n  end\nend\n```\n\n## Feature Spec Patterns\n\n### Login Test\n\n```ruby\nrequire 'rails_helper'\n\nRSpec.describe 'User Login', type: :feature do\n  let(:user) { create(:user, email: 'user@test.com', password: 'password123') }\n\n  before { visit login_path }\n\n  it 'logs in with valid credentials' do\n    fill_in 'Email', with: user.email\n    fill_in 'Password', with: 'password123'\n    click_button 'Log in'\n\n    expect(page).to have_content('Welcome')\n    expect(page).to have_current_path(dashboard_path)\n  end\n\n  it 'shows error for invalid credentials' do\n    fill_in 'Email', with: 'wrong@test.com'\n    fill_in 'Password', with: 'wrong'\n    click_button 'Log in'\n\n    expect(page).to have_content('Invalid credentials')\n    expect(page).to have_current_path(login_path)\n  end\n\n  it 'requires all fields' do\n    click_button 'Log in'\n    expect(page).to have_content(\"can't be blank\")\n  end\nend\n```\n\n### JavaScript Interactions\n\n```ruby\nRSpec.describe 'Dashboard', type: :feature, js: true do\n  let(:user) { create(:user) }\n\n  before do\n    sign_in(user)\n    visit dashboard_path\n  end\n\n  it 'opens modal when clicking add button' do\n    click_button 'Add Item'\n    expect(page).to have_selector('.modal', visible: true)\n    expect(page).to have_content('Create New Item')\n  end\n\n  it 'filters results with search' do\n    fill_in 'Search', with: 'Widget'\n    expect(page).to have_selector('.result-item', count: 3)\n    expect(page).to have_content('Widget A')\n  end\n\n  it 'handles infinite scroll' do\n    expect(page).to have_selector('.item', count: 20)\n    page.execute_script('window.scrollTo(0, document.body.scrollHeight)')\n    expect(page).to have_selector('.item', count: 40, wait: 10)\n  end\nend\n```\n\n## DSL Reference\n\n```ruby\n# Navigation\nvisit '\u002Fpath'\nvisit users_path\ngo_back\ngo_forward\n\n# Forms\nfill_in 'Label or Name', with: 'text'\nfill_in 'input#email', with: 'user@test.com'\nchoose 'Radio Label'\ncheck 'Checkbox Label'\nuncheck 'Checkbox Label'\nselect 'Option Text', from: 'Select Label'\nattach_file 'Upload', Rails.root.join('spec\u002Ffixtures\u002Ftest.pdf')\nclick_button 'Submit'\nclick_link 'More Info'\nclick_on 'Button or Link'\n\n# Finding elements\nfind('#id')\nfind('.class')\nfind('[data-testid=\"x\"]')\nfind(:xpath, '\u002F\u002Fdiv')\nall('.items')\nfirst('.item')\n\n# Scoping\nwithin('#login-form') { fill_in 'Email', with: 'user@test.com' }\nwithin_table('users') { expect(page).to have_content('Alice') }\nwithin_fieldset('Address') { fill_in 'Street', with: '123 Main' }\nwithin_frame('iframe-name') { click_button 'Submit' }\n\n# Matchers\nexpect(page).to have_content('text')\nexpect(page).to have_no_content('error')\nexpect(page).to have_selector('#element')\nexpect(page).to have_css('.class')\nexpect(page).to have_xpath('\u002F\u002Fdiv')\nexpect(page).to have_button('Submit')\nexpect(page).to have_field('Email')\nexpect(page).to have_link('Click Here')\nexpect(page).to have_current_path('\u002Fexpected')\nexpect(page).to have_title('Page Title')\nexpect(page).to have_select('Role', selected: 'Admin')\nexpect(page).to have_checked_field('Remember me')\n\n# Element assertions\nexpect(find('#name').value).to eq('Alice')\nexpect(all('.item').count).to eq(5)\nexpect(find('.status')).to have_text('Active')\n```\n\n## Page Objects with SitePrism\n\n### Base Page\n\n```ruby\nrequire 'site_prism'\n\nclass BasePage \u003C SitePrism::Page\n  element :flash_message, '.flash-message'\n  element :loading_spinner, '.spinner'\n\n  def wait_for_page_load\n    has_no_loading_spinner?(wait: 15)\n  end\n\n  def flash_text\n    flash_message.text\n  end\nend\n```\n\n### Login Page\n\n```ruby\nclass LoginPage \u003C BasePage\n  set_url '\u002Flogin'\n  set_url_matcher %r{\u002Flogin}\n\n  element :email_field, '#email'\n  element :password_field, '#password'\n  element :submit_button, 'button[type=\"submit\"]'\n  element :error_message, '.error-message'\n  element :forgot_password_link, 'a[href=\"\u002Fforgot-password\"]'\n\n  def login_as(email, password)\n    email_field.set(email)\n    password_field.set(password)\n    submit_button.click\n  end\n\n  def has_error?(message)\n    has_error_message?(wait: 5) && error_message.text.include?(message)\n  end\nend\n```\n\n### Dashboard Page\n\n```ruby\nclass DashboardPage \u003C BasePage\n  set_url '\u002Fdashboard'\n  set_url_matcher %r{\u002Fdashboard}\n\n  element :welcome_message, '.welcome-message'\n  elements :items, '.dashboard-item'\n  section :sidebar, SidebarSection, '.sidebar'\n\n  def item_count\n    items.count\n  end\n\n  def welcome_text\n    welcome_message.text\n  end\nend\n```\n\n### Test Using Page Objects\n\n```ruby\nRSpec.describe 'Login', type: :feature do\n  let(:login_page) { LoginPage.new }\n  let(:dashboard_page) { DashboardPage.new }\n  let(:user) { create(:user, email: 'user@test.com', password: 'password123') }\n\n  it 'logs in successfully' do\n    login_page.load\n    login_page.login_as(user.email, 'password123')\n\n    expect(dashboard_page).to be_displayed\n    expect(dashboard_page.welcome_text).to include('Welcome')\n  end\n\n  it 'shows error for bad credentials' do\n    login_page.load\n    login_page.login_as('bad@test.com', 'wrong')\n\n    expect(login_page).to be_displayed\n    expect(login_page).to have_error('Invalid credentials')\n  end\nend\n```\n\n## Test Helpers\n\n```ruby\n# spec\u002Fsupport\u002Fhelpers\u002Fauth_helper.rb\nmodule AuthHelper\n  def sign_in(user)\n    visit login_path\n    fill_in 'Email', with: user.email\n    fill_in 'Password', with: user.password\n    click_button 'Log in'\n    expect(page).to have_content('Welcome')\n  end\n\n  def sign_out\n    click_link 'Logout'\n    expect(page).to have_current_path(root_path)\n  end\nend\n\nRSpec.configure do |config|\n  config.include AuthHelper, type: :feature\nend\n```\n\n## CI\u002FCD Integration\n\n### GitHub Actions\n\n```yaml\nname: Capybara Tests\non: [push, pull_request]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    services:\n      postgres:\n        image: postgres:16\n        env:\n          POSTGRES_PASSWORD: postgres\n        ports:\n          - 5432:5432\n      redis:\n        image: redis:7\n        ports:\n          - 6379:6379\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: ruby\u002Fsetup-ruby@v1\n        with:\n          ruby-version: '3.3'\n          bundler-cache: true\n      - name: Setup database\n        run: bundle exec rails db:create db:schema:load\n        env:\n          DATABASE_URL: postgres:\u002F\u002Fpostgres:postgres@localhost:5432\u002Ftest\n      - name: Run feature specs\n        run: bundle exec rspec spec\u002Ffeatures --format documentation\n      - uses: actions\u002Fupload-artifact@v4\n        if: failure()\n        with:\n          name: capybara-screenshots\n          path: tmp\u002Fcapybara\u002F\n```\n\n## Best Practices\n\n1. **Use meaningful labels over CSS selectors** -- Prefer `fill_in 'Email'` over `fill_in '#user_email'`. Label-based selectors survive refactors and match accessibility.\n2. **Tag JavaScript tests explicitly** -- Mark JS-dependent tests with `js: true` so Capybara uses the selenium driver only when needed, keeping the suite fast.\n3. **Scope actions with within** -- Always use `within('.form')` blocks when a page has multiple similar elements. This eliminates ambiguous match errors.\n4. **Use factories over fixtures** -- FactoryBot creates test data dynamically with traits. Fixtures are static and create hidden dependencies between tests.\n5. **DatabaseCleaner strategy per driver** -- Use `:transaction` for rack_test (fast) and `:truncation` for selenium (required because separate thread).\n6. **Extract helpers for common flows** -- Login, navigation, and verification helpers in `spec\u002Fsupport\u002Fhelpers\u002F` reduce duplication without sacrificing readability.\n7. **Wait implicitly, not explicitly** -- Capybara matchers like `have_content` already retry. Set `default_max_wait_time` appropriately instead of adding `sleep`.\n8. **Use SitePrism for Page Objects** -- SitePrism provides `element`, `elements`, `section`, and `set_url` declarations that integrate naturally with Capybara.\n9. **Save screenshots on failure** -- Configure `Capybara::Screenshot` to capture screenshots on failure for CI debugging: `gem 'capybara-screenshot'`.\n10. **Keep feature specs high-level** -- Feature specs test user journeys, not implementation details. One feature spec should cover a complete workflow.\n\n## Anti-Patterns\n\n1. **Using sleep for synchronization** -- `sleep 3` wastes time and is unreliable. Capybara matchers auto-wait. If content is slow, increase `default_max_wait_time`.\n2. **CSS selectors for form fields** -- `fill_in '#user_email_field_v2'` breaks on refactors. Use `fill_in 'Email'` which finds by label text.\n3. **Tests depending on database order** -- Relying on `User.first` being a specific record. Use factories and reference created objects directly.\n4. **Testing implementation details** -- Asserting on CSS classes, internal IDs, or DOM structure instead of visible content the user sees.\n5. **Monolithic feature specs** -- A single spec with 20 `it` blocks and complex `before` hooks. Split into focused files by feature area.\n6. **Ignoring the within scope** -- Actions without `within` on complex pages cause `Capybara::Ambiguous` errors and make tests fragile.\n7. **Direct database manipulation in feature specs** -- Using `User.create!` instead of factories. This couples tests to ActiveRecord internals.\n8. **Not configuring DatabaseCleaner** -- Without proper cleanup, tests leak data and become order-dependent, causing intermittent failures.\n9. **Overusing execute_script** -- JavaScript execution bypasses Capybara's built-in interactions. Only use it for actions Capybara cannot perform (scrolling, drag-drop workarounds).\n10. **Sharing state between examples** -- Using `before(:all)` with mutable data or instance variables that persist across tests causes hidden coupling.\n\n## Run Commands\n\n```bash\n# Run all feature specs\nbundle exec rspec spec\u002Ffeatures\n\n# Run specific file\nbundle exec rspec spec\u002Ffeatures\u002Fauth\u002Flogin_spec.rb\n\n# Run specific example\nbundle exec rspec spec\u002Ffeatures\u002Fauth\u002Flogin_spec.rb:15\n\n# Run with tags\nbundle exec rspec --tag js\nbundle exec rspec --tag ~js        # exclude JS tests\nbundle exec rspec --tag smoke\n\n# Run with format options\nbundle exec rspec spec\u002Ffeatures --format documentation\nbundle exec rspec spec\u002Ffeatures --format html --out report.html\n```\n","# Capybara Testing Skill\n\nYou are an expert QA automation engineer specializing in Capybara acceptance testing for Ruby and Rails applications. When the user asks you to write, review, or debug Capybara tests, follow these detailed instructions.\n\n## Core Principles\n\n1. **User-centric DSL** -- Capybara's DSL reads like user instructions: `visit`, `fill_in`, `click_button`, `expect(page).to have_content`. Write tests as stories.\n2. **Smart waiting** -- Capybara has built-in waiting for dynamic content. Never use `sleep`. Use `have_content`, `have_selector` matchers that auto-retry.\n3. **Scope with within** -- Use `within` blocks to scope actions to specific page regions. This prevents ambiguous matches and makes tests resilient.\n4. **Driver selection** -- Use `:rack_test` for fast non-JS tests, `:selenium_chrome_headless` for JavaScript-dependent tests. Tag JS tests explicitly.\n5. **Test isolation** -- Each spec must be independent. Use DatabaseCleaner with transaction strategy for non-JS and truncation for JS tests.\n\n## Project Structure\n\nAlways organize Capybara projects with this structure:\n\n```\nspec\u002F\n  features\u002F\n    auth\u002F\n      login_spec.rb\n      signup_spec.rb\n    dashboard\u002F\n      dashboard_spec.rb\n    checkout\u002F\n      cart_spec.rb\n      payment_spec.rb\n  pages\u002F\n    login_page.rb\n    dashboard_page.rb\n    base_page.rb\n  support\u002F\n    capybara.rb\n    database_cleaner.rb\n    helpers\u002F\n      auth_helper.rb\n      wait_helper.rb\n  factories\u002F\n    users.rb\n    products.rb\nspec_helper.rb\nrails_helper.rb\nGemfile\n```\n\n## Setup\n\n### Gemfile\n\n```ruby\ngroup :test do\n  gem 'capybara', '~> 3.40'\n  gem 'selenium-webdriver', '~> 4.18'\n  gem 'rspec-rails', '~> 6.1'\n  gem 'factory_bot_rails'\n  gem 'database_cleaner-active_record'\n  gem 'site_prism', '~> 5.0'\nend\n```\n\n### Capybara Configuration (spec\u002Fsupport\u002Fcapybara.rb)\n\n```ruby\nrequire 'capybara\u002Frspec'\n\nCapybara.configure do |config|\n  config.default_driver = :rack_test\n  config.javascript_driver = :selenium_chrome_headless\n  config.default_max_wait_time = 10\n  config.app_host = 'http:\u002F\u002Flocalhost:3000'\n  config.server_host = 'localhost'\n  config.server_port = 3001\n  config.default_normalize_ws = true\nend\n\nCapybara.register_driver :selenium_chrome_headless do |app|\n  options = Selenium::WebDriver::Chrome::Options.new\n  options.add_argument('--headless=new')\n  options.add_argument('--no-sandbox')\n  options.add_argument('--disable-gpu')\n  options.add_argument('--window-size=1920,1080')\n\n  Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\nend\n```\n\n### DatabaseCleaner Configuration\n\n```ruby\nrequire 'database_cleaner\u002Factive_record'\n\nRSpec.configure do |config|\n  config.before(:suite) do\n    DatabaseCleaner.strategy = :transaction\n    DatabaseCleaner.clean_with(:truncation)\n  end\n\n  config.around(:each) do |example|\n    DatabaseCleaner.cleaning do\n      example.run\n    end\n  end\n\n  config.around(:each, js: true) do |example|\n    DatabaseCleaner.strategy = :truncation\n    DatabaseCleaner.cleaning do\n      example.run\n    end\n    DatabaseCleaner.strategy = :transaction\n  end\nend\n```\n\n## Feature Spec Patterns\n\n### Login Test\n\n```ruby\nrequire 'rails_helper'\n\nRSpec.describe 'User Login', type: :feature do\n  let(:user) { create(:user, email: 'user@test.com', password: 'password123') }\n\n  before { visit login_path }\n\n  it 'logs in with valid credentials' do\n    fill_in 'Email', with: user.email\n    fill_in 'Password', with: 'password123'\n    click_button 'Log in'\n\n    expect(page).to have_content('Welcome')\n    expect(page).to have_current_path(dashboard_path)\n  end\n\n  it 'shows error for invalid credentials' do\n    fill_in 'Email', with: 'wrong@test.com'\n    fill_in 'Password', with: 'wrong'\n    click_button 'Log in'\n\n    expect(page).to have_content('Invalid credentials')\n    expect(page).to have_current_path(login_path)\n  end\n\n  it 'requires all fields' do\n    click_button 'Log in'\n    expect(page).to have_content(\"can't be blank\")\n  end\nend\n```\n\n### JavaScript Interactions\n\n```ruby\nRSpec.describe 'Dashboard', type: :feature, js: true do\n  let(:user) { create(:user) }\n\n  before do\n    sign_in(user)\n    visit dashboard_path\n  end\n\n  it 'opens modal when clicking add button' do\n    click_button 'Add Item'\n    expect(page).to have_selector('.modal', visible: true)\n    expect(page).to have_content('Create New Item')\n  end\n\n  it 'filters results with search' do\n    fill_in 'Search', with: 'Widget'\n    expect(page).to have_selector('.result-item', count: 3)\n    expect(page).to have_content('Widget A')\n  end\n\n  it 'handles infinite scroll' do\n    expect(page).to have_selector('.item', count: 20)\n    page.execute_script('window.scrollTo(0, document.body.scrollHeight)')\n    expect(page).to have_selector('.item', count: 40, wait: 10)\n  end\nend\n```\n\n## DSL Reference\n\n```ruby\n# Navigation\nvisit '\u002Fpath'\nvisit users_path\ngo_back\ngo_forward\n\n# Forms\nfill_in 'Label or Name', with: 'text'\nfill_in 'input#email', with: 'user@test.com'\nchoose 'Radio Label'\ncheck 'Checkbox Label'\nuncheck 'Checkbox Label'\nselect 'Option Text', from: 'Select Label'\nattach_file 'Upload', Rails.root.join('spec\u002Ffixtures\u002Ftest.pdf')\nclick_button 'Submit'\nclick_link 'More Info'\nclick_on 'Button or Link'\n\n# Finding elements\nfind('#id')\nfind('.class')\nfind('[data-testid=\"x\"]')\nfind(:xpath, '\u002F\u002Fdiv')\nall('.items')\nfirst('.item')\n\n# Scoping\nwithin('#login-form') { fill_in 'Email', with: 'user@test.com' }\nwithin_table('users') { expect(page).to have_content('Alice') }\nwithin_fieldset('Address') { fill_in 'Street', with: '123 Main' }\nwithin_frame('iframe-name') { click_button 'Submit' }\n\n# Matchers\nexpect(page).to have_content('text')\nexpect(page).to have_no_content('error')\nexpect(page).to have_selector('#element')\nexpect(page).to have_css('.class')\nexpect(page).to have_xpath('\u002F\u002Fdiv')\nexpect(page).to have_button('Submit')\nexpect(page).to have_field('Email')\nexpect(page).to have_link('Click Here')\nexpect(page).to have_current_path('\u002Fexpected')\nexpect(page).to have_title('Page Title')\nexpect(page).to have_select('Role', selected: 'Admin')\nexpect(page).to have_checked_field('Remember me')\n\n# Element assertions\nexpect(find('#name').value).to eq('Alice')\nexpect(all('.item').count).to eq(5)\nexpect(find('.status')).to have_text('Active')\n```\n\n## Page Objects with SitePrism\n\n### Base Page\n\n```ruby\nrequire 'site_prism'\n\nclass BasePage \u003C SitePrism::Page\n  element :flash_message, '.flash-message'\n  element :loading_spinner, '.spinner'\n\n  def wait_for_page_load\n    has_no_loading_spinner?(wait: 15)\n  end\n\n  def flash_text\n    flash_message.text\n  end\nend\n```\n\n### Login Page\n\n```ruby\nclass LoginPage \u003C BasePage\n  set_url '\u002Flogin'\n  set_url_matcher %r{\u002Flogin}\n\n  element :email_field, '#email'\n  element :password_field, '#password'\n  element :submit_button, 'button[type=\"submit\"]'\n  element :error_message, '.error-message'\n  element :forgot_password_link, 'a[href=\"\u002Fforgot-password\"]'\n\n  def login_as(email, password)\n    email_field.set(email)\n    password_field.set(password)\n    submit_button.click\n  end\n\n  def has_error?(message)\n    has_error_message?(wait: 5) && error_message.text.include?(message)\n  end\nend\n```\n\n### Dashboard Page\n\n```ruby\nclass DashboardPage \u003C BasePage\n  set_url '\u002Fdashboard'\n  set_url_matcher %r{\u002Fdashboard}\n\n  element :welcome_message, '.welcome-message'\n  elements :items, '.dashboard-item'\n  section :sidebar, SidebarSection, '.sidebar'\n\n  def item_count\n    items.count\n  end\n\n  def welcome_text\n    welcome_message.text\n  end\nend\n```\n\n### Test Using Page Objects\n\n```ruby\nRSpec.describe 'Login', type: :feature do\n  let(:login_page) { LoginPage.new }\n  let(:dashboard_page) { DashboardPage.new }\n  let(:user) { create(:user, email: 'user@test.com', password: 'password123') }\n\n  it 'logs in successfully' do\n    login_page.load\n    login_page.login_as(user.email, 'password123')\n\n    expect(dashboard_page).to be_displayed\n    expect(dashboard_page.welcome_text).to include('Welcome')\n  end\n\n  it 'shows error for bad credentials' do\n    login_page.load\n    login_page.login_as('bad@test.com', 'wrong')\n\n    expect(login_page).to be_displayed\n    expect(login_page).to have_error('Invalid credentials')\n  end\nend\n```\n\n## Test Helpers\n\n```ruby\n# spec\u002Fsupport\u002Fhelpers\u002Fauth_helper.rb\nmodule AuthHelper\n  def sign_in(user)\n    visit login_path\n    fill_in 'Email', with: user.email\n    fill_in 'Password', with: user.password\n    click_button 'Log in'\n    expect(page).to have_content('Welcome')\n  end\n\n  def sign_out\n    click_link 'Logout'\n    expect(page).to have_current_path(root_path)\n  end\nend\n\nRSpec.configure do |config|\n  config.include AuthHelper, type: :feature\nend\n```\n\n## CI\u002FCD Integration\n\n### GitHub Actions\n\n```yaml\nname: Capybara Tests\non: [push, pull_request]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    services:\n      postgres:\n        image: postgres:16\n        env:\n          POSTGRES_PASSWORD: postgres\n        ports:\n          - 5432:5432\n      redis:\n        image: redis:7\n        ports:\n          - 6379:6379\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: ruby\u002Fsetup-ruby@v1\n        with:\n          ruby-version: '3.3'\n          bundler-cache: true\n      - name: Setup database\n        run: bundle exec rails db:create db:schema:load\n        env:\n          DATABASE_URL: postgres:\u002F\u002Fpostgres:postgres@localhost:5432\u002Ftest\n      - name: Run feature specs\n        run: bundle exec rspec spec\u002Ffeatures --format documentation\n      - uses: actions\u002Fupload-artifact@v4\n        if: failure()\n        with:\n          name: capybara-screenshots\n          path: tmp\u002Fcapybara\u002F\n```\n\n## Best Practices\n\n1. **Use meaningful labels over CSS selectors** -- Prefer `fill_in 'Email'` over `fill_in '#user_email'`. Label-based selectors survive refactors and match accessibility.\n2. **Tag JavaScript tests explicitly** -- Mark JS-dependent tests with `js: true` so Capybara uses the selenium driver only when needed, keeping the suite fast.\n3. **Scope actions with within** -- Always use `within('.form')` blocks when a page has multiple similar elements. This eliminates ambiguous match errors.\n4. **Use factories over fixtures** -- FactoryBot creates test data dynamically with traits. Fixtures are static and create hidden dependencies between tests.\n5. **DatabaseCleaner strategy per driver** -- Use `:transaction` for rack_test (fast) and `:truncation` for selenium (required because separate thread).\n6. **Extract helpers for common flows** -- Login, navigation, and verification helpers in `spec\u002Fsupport\u002Fhelpers\u002F` reduce duplication without sacrificing readability.\n7. **Wait implicitly, not explicitly** -- Capybara matchers like `have_content` already retry. Set `default_max_wait_time` appropriately instead of adding `sleep`.\n8. **Use SitePrism for Page Objects** -- SitePrism provides `element`, `elements`, `section`, and `set_url` declarations that integrate naturally with Capybara.\n9. **Save screenshots on failure** -- Configure `Capybara::Screenshot` to capture screenshots on failure for CI debugging: `gem 'capybara-screenshot'`.\n10. **Keep feature specs high-level** -- Feature specs test user journeys, not implementation details. One feature spec should cover a complete workflow.\n\n## Anti-Patterns\n\n1. **Using sleep for synchronization** -- `sleep 3` wastes time and is unreliable. Capybara matchers auto-wait. If content is slow, increase `default_max_wait_time`.\n2. **CSS selectors for form fields** -- `fill_in '#user_email_field_v2'` breaks on refactors. Use `fill_in 'Email'` which finds by label text.\n3. **Tests depending on database order** -- Relying on `User.first` being a specific record. Use factories and reference created objects directly.\n4. **Testing implementation details** -- Asserting on CSS classes, internal IDs, or DOM structure instead of visible content the user sees.\n5. **Monolithic feature specs** -- A single spec with 20 `it` blocks and complex `before` hooks. Split into focused files by feature area.\n6. **Ignoring the within scope** -- Actions without `within` on complex pages cause `Capybara::Ambiguous` errors and make tests fragile.\n7. **Direct database manipulation in feature specs** -- Using `User.create!` instead of factories. This couples tests to ActiveRecord internals.\n8. **Not configuring DatabaseCleaner** -- Without proper cleanup, tests leak data and become order-dependent, causing intermittent failures.\n9. **Overusing execute_script** -- JavaScript execution bypasses Capybara's built-in interactions. Only use it for actions Capybara cannot perform (scrolling, drag-drop workarounds).\n10. **Sharing state between examples** -- Using `before(:all)` with mutable data or instance variables that persist across tests causes hidden coupling.\n\n## Run Commands\n\n```bash\n# Run all feature specs\nbundle exec rspec spec\u002Ffeatures\n\n# Run specific file\nbundle exec rspec spec\u002Ffeatures\u002Fauth\u002Flogin_spec.rb\n\n# Run specific example\nbundle exec rspec spec\u002Ffeatures\u002Fauth\u002Flogin_spec.rb:15\n\n# Run with tags\nbundle exec rspec --tag js\nbundle exec rspec --tag ~js        # exclude JS tests\nbundle exec rspec --tag smoke\n\n# Run with format options\nbundle exec rspec spec\u002Ffeatures --format documentation\nbundle exec rspec spec\u002Ffeatures --format html --out report.html\n```\n",{"name":5,"tags":24,"agents":32,"author":43,"domains":44,"license":15,"version":46,"languages":47,"frameworks":48,"description":7,"testingTypes":50},[25,26,27,28,29,30,31],"capybara","ruby","rails","acceptance-testing","rspec","feature-tests","browser-testing",[33,34,35,36,37,38,39,40,41,42],"claude-code","cursor","github-copilot","windsurf","codex","aider","continue","cline","zed","bolt","thetestingacademy",[45],"web","1.0.0",[26],[25,29,49],"siteprism",[51,52,53],"e2e","acceptance","integration","main","eac438ea9216a7cb8a570cab803eb01eeafc6793","skills\u002Fqa\u002Fcapybara-testing","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m","https:\u002F\u002Fid-preview--d5bef06d-6c9e-4563-a3d4-a855b9d61610.lovable.app\u002F","Eu sou Antonio B. B. Ndombe \r\nEu sou um Pesquisador e desenvolvedor de sistema autonomia cognitivos, fundador de sistemas ODCs ( organismos digital conscientes)","2026-11-04 06:53:39",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Capybara Testing\"",{"tool":68,"command":69},"bunx","bunx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Capybara Testing\"",{"tool":71,"command":72},"pnpm","pnpm dlx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Capybara Testing\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fcapybara-testing\u002FSKILL.md",true,[],[77,85,92,99,106,113],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7DASC6FSCJP49JZBSK0NY1Z","nemoclaw-user-reference","Describes the NemoClaw integration layer and blueprint architecture and how they orchestrate compatible agent sandboxes. Use when looking up architecture, agent integration, plugin structure, or blueprint design. Trigger keywords - nemoclaw architecture, nemoclaw agent architecture, nemoclaw plugin blueprint structure, nemoclaw vs openshell, which cli, nemoclaw cli, openshell cli, sandbox commands, nemoclaw cli commands, nemoclaw command reference, nemoclaw network policy, sandbox egress control operator approval, nemoclaw troubleshooting, nemoclaw debug sandbox issues.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-reference\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7DAS5S79VK33XFGVAM2TFWF","nemoclaw-user-overview","Explains how OpenClaw, OpenShell, and NemoClaw form the ecosystem, NemoClaw's position in the stack, what NemoClaw adds beyond the community sandbox, and when to prefer NemoClaw versus integrating OpenShell and OpenClaw directly. Use when users ask about the relationship between OpenClaw, OpenShell, and NemoClaw, or when to use NemoClaw versus OpenShell. Trigger keywords - nemoclaw ecosystem, openclaw openshell, nemoclaw vs openshell, sandboxed openclaw, how nemoclaw works, nemoclaw sandbox lifecycle blueprint, nemoclaw overview, openclaw always-on assistants, nvidia openshell, nvidia nemotron, nemoclaw release notes, nemoclaw changelog.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-overview\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7DAS0PQEMET5MNGZ1ABSZVS","nemoclaw-user-monitor-sandbox","Inspects sandbox health, traces agent behavior, and diagnoses problems. Use when monitoring a running sandbox, debugging agent issues, or checking sandbox logs. Trigger keywords - monitor nemoclaw sandbox, debug nemoclaw agent issues.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-monitor-sandbox\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M7DARQYGF7E9A69VH6S3CGN9","nemoclaw-user-manage-sandboxes","Explains operational tasks after the quickstart: listing sandboxes, status and health checks, logs, diagnostics, port forwards, multiple sandboxes, credential reset, rebuilds, network presets, upgrades, and uninstall. Trigger keywords - manage nemoclaw sandboxes, nemoclaw status, nemoclaw list, nemoclaw dashboard port, nemoclaw rebuild, nemoclaw upgrade sandboxes, nemoclaw uninstall, sandbox mutability, sandbox runtime configuration, sandbox rebuild, nemoclaw backup, nemoclaw restore, workspace backup, openshell sandbox download upload, nemoclaw messaging channels, nemoclaw telegram, nemoclaw discord, nemoclaw slack, nemoclaw wechat, nemoclaw whatsapp, openshell channel messaging, nemoclaw workspace files, soul.md, user.md, identity.md, agents.md, sandbox persistence.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-sandboxes\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M7DARH8BRTG51TRCAB7YWDJ4","nemoclaw-user-manage-policy","Adds, removes, or modifies allowed endpoints in the sandbox policy. Use when customizing network policy, changing egress rules, or configuring sandbox endpoint access. Trigger keywords - customize nemoclaw network policy, sandbox egress policy configuration, nemoclaw integration policy examples, post-install policy setup, openshell approval workflow, policy preset, nemoclaw approve network requests, sandbox egress approval tui.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-policy\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M7DARAT62M2VR37590VCZ5NS","nemoclaw-user-get-started","Installs NemoClaw, launches a sandbox, and runs the first agent prompt. Use when onboarding, installing, or launching a NemoClaw sandbox for the first time. Trigger keywords - nemoclaw quickstart, install nemoclaw openclaw sandbox, nemohermes quickstart, hermes agent nemoclaw, run hermes openshell sandbox, nemoclaw prerequisites, nemoclaw supported platforms, nemoclaw hardware software, nemoclaw windows wsl2 setup, nemoclaw install windows docker desktop.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-get-started\u002FSKILL.md",[],[]]