Ruby 如何搜索字段并确认它';是空的吗?

Ruby 如何搜索字段并确认它';是空的吗?,ruby,cucumber,Ruby,Cucumber,我是Ruby的新手,在cucumber中使用Ruby编写测试套件时,我已经陷入了深深的困境,几乎没有时间学习它 我试图写一行代码来检查网页上是否存在字段,并且所述字段是否为空 到目前为止,我已经: Then /^I can verify that the fleet field is blank$/ do find_by_id('fleet', :text == nil) end 我写的两个特性是: Scenario: US1020-1 Confirm that the Date of

我是Ruby的新手,在cucumber中使用Ruby编写测试套件时,我已经陷入了深深的困境,几乎没有时间学习它

我试图写一行代码来检查网页上是否存在字段,并且所述字段是否为空

到目前为止,我已经:

Then /^I can verify that the fleet field is blank$/ do
  find_by_id('fleet', :text == nil)
end
我写的两个特性是:

Scenario: US1020-1  Confirm that the Date of Liability field is blank on screen
    When I navigate to the fleet vehicle search screen
    Then I can search for a valid record using Fleet number: "123456"
    And Registration number: "N253CSL"
    Then I can verify that the fleet field is blank


Scenario: US1020-2  Confirm that the Date of Liability field is blank on screen
    When I navigate to the fleet vehicle search screen
    And Registration number: "N253CSL"
    Then I can verify that the fleet field is blank
场景
US1020-1
应该会失败,因为我已经用
123456
填充到了舰队,但它通过了

注意:测试的其他元素、连接到网页、填写字段的ruby代码已经编写好了,可以使用了

任何对noob的帮助都会很好

谢谢

试试:

Then /^I can verify that the fleet field is blank$/ do
  expect(find_by_id('fleet').value).to be_blank
end