LoginSignup
1
2

More than 5 years have passed since last update.

ブラウザを表示しなくて、capybaraテストできる

Last updated at Posted at 2016-05-19

背景

目的

  • ブラウザを表示しないくても、自動テスト実行できる

経過

vxfbのインストール

  • sudo apt-get install xvfb

コード実装

require 'headless'

describe "google" do
  before do
    headless = Headless.new
    headless.start

    visit '/'
  end

  context "トップページ" do
    it { expect(page).to have_content('Google') }
  end
end

確認

  • ブラウザが表示しなくて、テストが成功になること

参照

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2