How can I check that a form field is prefilled correctly using capybara?

后端 未结 5 1546
不知归路
不知归路 2021-01-30 01:48

I have a field with a proper label that I can fill in with capybara without a problem:

fill_in \'Your name\', with: \'John\'

I\'d like to check

5条回答
  •  情书的邮戳
    2021-01-30 02:32

    If the field is a hidden one with an id of 'some_field', then you can use

    expect(find("input#somefield", :visible => false).value).to eq 'John'
    

提交回复
热议问题