私は新しいRuby on Railsアプリケーションを起動する比較的初心者です。私は、https://github.com/intridea/omniauth、http://www.communityguides.eu/articles/16、http://intridea.com/2011/1/31/easy-rails-admin-login-with-google-apps-and-omniauth?blog=companyという命令の組み合わせに従って始めました。すべてが正しく機能するようになった時点で、私はキュウリの最初の機能と手順を書き始めました。私はいくつかのステップを実行することができましたが、私は考えていたステップでうんざりしていました。私は2つのフォームを持っていますが、私は成功するためのシナリオを得ることができませんbasic And I press "button"
step。キュウリ `プレスボタン`失敗(Capybara :: ElementNotFound)
関連する可能性の宝石:問題のフォームの
rails (3.1.0.rc4) capybara (1.0.0) cucumber (1.0.1) cucumber-rails (1.0.2) nokogiri (1.4.7) gherkin (2.4.5) rack-test (0.6.0) selenium-webdriver (0.2.2)
セクション:問題の
<%= form_tag :controller => "services", :action => "newaccount" do %>
<%= submit_tag "confirm", :id => "confirm", :title => "confirm", :value => "confirm", :text => "confirm", :name => "confirm" %>
<%= submit_tag "cancel", :id => "cancel", :title => "cancel", :value => "cancel", :text => "cancel", :name => "cancel" %>
<% end %>
シナリオ:
Scenario: I register with a valid and currently active google account
Given I am not registered
When I sign in with a valid and currently active google account
And I press "confirm" # <-- THE PROBLEMATIC STEP
Then I should see "Your account has been created and you have been signed in!"
私はこれが(ストレートから関連web_stepだと思います私が編集していないデフォルトweb_steps.rb):
When /^(?:|I)press "([^"]*)"$/ do |button|
click_button(button)
end
関連キュウリ出力:
Scenario: I register with a valid and currently active google account # features/auth_and_auth/initial_tests.feature:6
Given I am not registered # features/step_definitions/authentication_steps.rb:1
When I sign in with a valid and currently active google account # features/step_definitions/authentication_steps.rb:5
And I press "confirm" # features/step_definitions/web_steps.rb:52
no button with value or id or text 'confirm' found (Capybara::ElementNotFound)
(eval):2:in `click_button'
./features/step_definitions/web_steps.rb:53:in `/^(?:|I)press "([^"]*)"$/'
features/auth_and_auth/initial_tests.feature:9:in `And I press "confirm"'
Then I should see "Your account has been created and you have been signed in!" # features/step_definitions/web_steps.rb:105
関連するHTML出力:
<input id="confirm" name="confirm" text="confirm" title="confirm" type="submit" value="confirm">
<input id="cancel" name="cancel" text="cancel" title="cancel" type="submit" value="cancel">
明らかなように、私はvalue
、id
、text
だけでなく、name
とtitle
を占めてきました。私はまた入力タイプがsubmit
と指定されなければならなかったという記事を見ました。そして私はconfirm
ボタンとcancel
ボタンの両方で試しました。
私が知っているすべての場所を検索し、リモートで関連性があると思われるすべての提案を試した後、私は難局です。私は何が欠けていますか?
ステップが呼び出されているときに実際にキュウリが正しいページにありますか? Capybaraには非常に便利な「save_and_open_page」メソッドがあります。web_steps.rbのclick_button呼び出しの上に配置し、実際に正しいページにあるかどうかを確認してください。 – idlefingers