- ページに移動
visit '/pages/new'- フォームに値を入力
- fill_in 'id_or_label_text', with: 'yamada'
- ラジオボタンを選択
- choose 'ラジオボタン1'
- チェックボックスをチェック/非チェック
- check('チェックボックス1')
- uncheck('チェックボックス1')
- ファイルの添付
- attach_file 'file', "#{fixture_path}/xxx.csv"
- セレクトボックスで選択
- select('カテゴリ1', from: 'カテゴリ')
- ボタンまたはリンクをクリック
- click_on 'ボタンまたはリンク'
- 現在のページを確認
- current_path.should == '/pages/1'
- Http Statusを確認
- page.status_code.should be(200)
- ページ内に期待する文字列が(ある|ない)か確認
- have_content
- have_no_content
- チェックボックスがチェックされて(いる|いない)
- have_checked_field
- have_unchecked_field
- inputの値を検証する
- should have_field('id_or_label', with: 'value')
- テーブルの行数を検証する
- all('#table_id tr').should have(0).rows
- 表示・非表示の検証をする
- find('#css_selecter').should be_visible
- テーブルが存在するか
- page.should have_table('table')
- セレクターを使った検証
- page.should have_selector('button', value: '実行')
- page.should have_selector('h1#title', :content=>'Hello!')
- ボタンが存在するか
- find('#navigation').should have_button('Sign out')
- 現在のページをブラウザで表示
- save_and_open_page
- debuggerを起動
- binding.pry
- xpath引数を使ったfind
- find(:xpath, '//li[contains(.//a[@href = "#"]/text(), "foo")]').value
- findした要素の値をshouldではなく参照する
- find('#id').text