fill_in 'id_or_label_text', with: 'yamada'
check('チェックボックス1')
uncheck('チェックボックス1')
attach_file 'file', "#{fixture_path}/xxx.csv"
select('カテゴリ1', from: 'カテゴリ')
current_path.should == '/pages/1'
page.status_code.should be(200)
page.should have_title('たいとる')
should have_content '登録されました'
should have_no_content 'エラーがしました'
- チェックボックス(radio)がチェックされて(いる|いない)
have_checked_field
have_unchecked_field
page.should have_select('name', selected: 'selected_value')
should have_field('id_or_label', with: 'value')
all('#table_id tr').should have(0).rows
page.should have_css("table#table_id tbody tr", count: 0)
find('#css_selecter').should be_visible
should have_table('table')
should have_selector('button', value: '実行')
should have_selector('h1#title', :content=>'Hello!')
find('#navigation').should have_button('Sign out')
should have_selector('#hoge_area', visible: true)
find(:xpath, '//li[contains(.//a[@href = "#"]/text(), "foo")]').value
- xpath引数を使ったfind
- containsを使う事でclassに複数指定があってもヒットする
all(:xpath, "//a[contains(@class, 'target-class-name') and contains(text(), 'リンク名')]")
- findした要素の値をshouldではなく参照する
find('#id').click
click_button 'id_or_label'