Closed smptmhr closed 2 years ago
selenium-webdriver
のみでwebドライバーに必要な機能は十分なので
capybara-webkit
を使用する必要がなかった。
~system spec
を使用するのにcapybara-webkit
なるgemが必要らしい。~
~そしてcapybara-webkit
をインストールするにはqt
が必要らしい。~
~バージョンは5.5(qt@5.5)に指定するらしい。~
~以下でqt
のインストールを試した。~
cd $( brew --prefix )/Homebrew/Library/Taps/homebrew/homebrew-core
git checkout 9ba3d6ef8891e5c15dbdc9333f857b13711d4e97 Formula/qt@5.5.rb
brew install qt@5.5
ここでエラー
Warning: No available formula with the name "qt@5.5". Did you mean qt@5?
==> Searching for similarly named formulae...
This similarly named formula was found:
qt@5 ✔
To install it, run:
brew install qt@5 ✔
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
qt@5.5
は無いらしいのでqt@5
をインストール
$ brew install qt@5
Warning: qt@5 5.15.3 is already installed and up-to-date.
To reinstall 5.15.3, run:
brew reinstall qt@5
今はqt4がqmakeにリンクされているのでqt5にリンクし直す
brew unlink qt@4
brew link --force qt@5
これでbundle installの準備が整ったと思い作業ディレクトリに戻って
Gemfileのgroup :development, :test do
内に'capybara-webkit'
を追加
# Capybara本体
gem 'capybara'
# Capybaraが利用するドライバ
gem 'selenium-webdriver'
gem 'capybara-webkit'
bundle install
ここでまたエラー
An error occurred while installing capybara-webkit (1.15.1), and Bundler cannot continue.
In Gemfile:
capybara-webkit
参考 https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#homebrew https://obel.hatenablog.jp/entry/20200420/1587324600 https://qiita.com/morrr/items/0e24251c049180218db4
visit tasks_url
と書くと以下の様なエラーでspecがページに到達できない。
Failure/Error: visit tasks_url
Net::ReadTimeout:
Net::ReadTimeout with #<Socket:(closed)>
visit tasks_path
と書くことによって解決。
(根本原因は不明)
rspecのインストール
RspecとFactorybotをGemfileに追加 Rspecを設定 【Rspec】RspecのインストールやRailsで使うための準備や実行方法
デフォルトのtestを削除
今後のテストはRSPCを使って行うため、使用しないデフォルトのtestディレクトリを削除する。
テストの実行
実行方法
実際に動作してることが確認できる。