1

私はキュウリを学んでいますが、入力タグを一致させるためのステップを踏むことはできません。

私が見ているのは

<input type="submit" value="Press!" />

そしてキュウリで試したのは

Then the "input" field should contain "Press!"
Then the "type" field should contain "submit"

特定の値を持つ入力タグの存在を確認したいだけです。相互作用はありません。

4

3 に答える 3

2

これを試して:

Then I should see "Press!" within "input[type=\"submit\"]"

于 2010-10-28T03:40:53.993 に答える
1

また、webrat でも明示的にサポートされています。キュウリに組み込みのサポートが見つからない場合でも、いつでも独自のステップ定義にドロップできます。

ソース: http://cheat.errtheblog.com/s/webrat/

== Assertions

   # check for text in the body of html tags
   # can be a string or regexp
  assert_contain("BURNINATOR")
  assert_contain(/trogdor/i)
  assert_not_contain("peasants")

  # check for a css3 selector
  assert_have_selector 'div.pagination'
  assert_have_no_selector 'form input#name'


== Matchers

  # check for text in the body of html tags
  # can be a string or regexp
  # Matchers are verbs used with auxillary verbs should, should_not, etc.
  response.should contain("BURNINATOR")
  response.should contain(/trogdor/i)
  response.should_not contain("peasants")

  # check for a css3 selector
  response.should have_selector('div.pagination')
  response.should_not have_selector('form input#name')
于 2011-01-21T23:44:17.847 に答える
1

次のようなものを使用できます。

response.should have_xpath("//input[@value='Press!']")

また

response.should have_selector("input", :type => "submit", :value => "Press!")
于 2011-08-05T03:37:25.960 に答える