https://github.com/mugi-uno/nezumi
fill_in 'staff_password', with: 'password'
click_on 'LOGIN'
find_button('発注する').click # findでみつかるまでwaitが入る模様 -> see https://www.rubydoc.info/github/jnicklas/capybara/Capybara%2FNode%2FFinders:find_button
page.all('div', text: /\Aテキスト\z/)
assert_selector('div', text: /\Aテキスト\z/, count: 1)
page.all('tr.order-record').count
assert_selector('.order-record', count: 2)
within でスコープを区切る
element = page.all('tr.order-record')[0]
within(element) do
page.all('td').each_with_index do |e, i|
pp [i, e.text]
end
end
ネストもできる (https://github.com/gongo/maizebox/blob/master/examples/runner.rb)
within(:css, 'aside') do
within(:css, 'li.first-child') do
page.attention_here
end
within(:css, 'li.third-child') do
page.attention_to(find(:css, 'img'))
end
end