2017.10.06 週刊Railsウォッチ(20171006)PostgreSQL 10ついにリリース、Capybaraコードを実画面から生成するnezumiほか こんにちは、hachi8833です。暑がりさんなので今日も扇風機にあたっています。 それでは10月最初のウォッチ、いってみましょう。なお「Rails: 今週の改修」は本家で更新がありませんでした。 号外: PostgreSQL 10が正式リリース プレスリリース: PostgreSQL 10 Released 9月後半にPostgreSQL 10 RC1がリリースされていたので記事にしようと思っていましたが、昨晩正式版がリリースされたので急遽差し替えました。 記念写真を取るためにとりあえずインストールして動かしてみました。MacのHomebrewでインストールしていたPostgreSQL 9をbrew services sto
Running feature specs with Capybara and Chrome headless July 05, 2017 – Tim Petricola – 2-minute read This article was written before Drivy was acquired by Getaround, and became Getaround EU. Some references to Drivy may therefore remain in the post At Drivy, we’ve been using Capybara and PhantomJS to run our feature specs for years. Even with its issues, PhantomJS is a great way to interact with
I’ve been a happy user of Capybara-WebKit for many years now, but its dependence on Qt can make it frustrating to install on macOS, particularly following macOS or Xcode updates. One such recent issue lead me to experiment with running my tests in Chrome via ChromeDriver and Selenium. I found the installation of ChromeDriver and Capybara-Selenium to be significantly faster than the installation of
Introduction In this tutorial, we’ll cover how to do integration tests in Rails using Minitest and Capybara. We’ll also cover how integration tests can sometimes serve as a replacement for controller tests. Prerequisites To follow this tutorial, you’ll need to have Ruby installed along with Rails. This tutorial was tested using Ruby version 2.3.3, Rails version 5.0.0.1, Minitest version 5.10.1, an
Pagination のテストのために、最初は以下のようなコードを書いていたのですが、一つのページ内に複数のPagination を表示するページなので、一番上のブロックのみを確認することにしました。 find("//*[@class='pagination']//a[text()='2']").click expect(page.status_code).to eq(200) これに、以下のように *[@class='pagination'] の末尾に [1] を追加したのですが Capybara::ElementNotFound になってしまいます。 find("//*[@class='pagination'][1]//a[text()='2']").click expect(page.status_code).to eq(200) Test 環境ではなく Development 環境
Adding subdomains to a Rails application is an easy task today, but things can get a little trickier when testing is involved. For starters, you may only need to handle subdomains at the routing level, which is quite easy. But after the easy step some troubles may be awaiting for you. In our example we want to add an “admin” subdomain to a brand new app. We edit the file routes.rb as follows and w
If you’re a Ruby or Rails developer looking for some advice on how to get better at integration testing: congratulations! You’ve reached the highest level of difficulty in all of the areas of the stack you must conquer to become a great Ruby developer. Integration testing is hard, but it doesn’t have to be. This the subtle of this truth lies in the fact that you must be skilled in both the backend
Navigation > > visit visit visit navigates to a particular path. Pass a string or use one of Rails’ path helpers. visit '/blog' visit blogs_path > > click_on click_on click_on will click an anchor tag, button, or input with type submit. Pass a string containing the anchor text. click_on 'Sign in' click_on 'Submit' Page Interaction and Scoping > > has_css? has_css? has_css? returns a boolean value
If you use Docker to deploy your Rails application you may want to use the same infrastructure to run your tests. However the setup of your Selenium browser tests is far from obvious with Rails and Docker and may generate some confusion 1 2 3 4 5. The short answer is available in this repository on Github. For the long answer keep reading this blog post for a step by step tutorial! Dockerize Rails
Ever tested a page with a lot of AJAX-Actions and encountered some strange bugs? If you are using Poltergeist there are good news. Poltergeist is a driver for Capybara that runs your tests in PhantomJS. Let’s say you have a page with a button which sends an AJAX-Request, but something didn’t work. If you are in the browser the first thing you’ll do is to open the DevTools and look for errors in th
— 環境 — rails-4.0.1 rspec-rails-2.14.0 capybara-2.2.0 User モデルでの form_for の中で Rails ヘルパーでフォーム要素を作成し、出力される HTML を併記しています。また、それに対する RSpec + Capybara でのテストの書き方。 radio button(ラジオボタン) <%= f.radio_button :gender, 'male' %> 男性 <%= f.radio_button :gender, 'female' %> 女性 ↓ <input id="user_gender_male" name="user[gender]" type="radio" value="male" /> 男性 <input id="user_gender_female" name="user[gender]" type
CapybaraとPhantomJS、Nokogiriを利用してのクローラー・スクレイピングの紹介です。 PhantomJSとは? PhantomJSは、ヘッドレスブラウザと呼ばれるWebKitのエミュレータです。ヘッドレスブラウザとは、GUIではなくCUIから利用できるブラウザでプログラムから呼ばれます。UIのテストツールとしてSeleniumのようなサービスがあります。Seleniumはブラウザを直接操作するので、環境依存や動作が重いといった幾つかの問題点があります。そこでよく利用されるのがPhantomJSです。Seleniumに比べて、軽量というメリットがあります。RubyからPhantomJSを扱うライブラリとして、Poltergeistがあります。 Capybaraとは? Capybaraは、WebシステムのUI層のテストをサポートするためのライブラリです。主にDSL機能とDr
はじめに みなさんこんにちは! この記事は「必要最小限の努力で最大限実戦で使える知識を提供するRSpec入門記事」、略して「使えるRSpec入門」の第4回です。 今回はCapybaraを使ったフィーチャスペックについて説明します。 ただし、今までの記事とは異なり、フィーチャスペックのイロハよりも「Capybaraの使い方」に重点を置きます。 なぜなら、僕個人の経験からいって、フィーチャスペックで困るのは「このブラウザの操作って、どうやってコードで表現するの??」というケースが大半だからです。 それ以外は第1回~第3回の内容をそのまま応用できるので、特に「フィーチャスペックだから困る」ということはないと思います。 今回は説明する主な項目は以下の通りです。 フィーチャスペックの基本 ページの移動や画面のクリック、フォームの操作など 画面やフォームの検証 画面の操作や検証の応用テクニック その他
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く