6
測試頁面重定向我有一個step_definition與水豚+ RSpec的
Then(/^I should be redirected to the (.+?) page/) do |target|
expect(current_url).to eq(Urls[target])
end
,一般它工作得很好。有時,當我使用poltergeist驅動程序時,它比正常情況下更快,current_url仍舊是舊頁面。那是當我得到這樣的錯誤:
Then I should be redirected to the login page # features/step_definitions/navigate-steps.rb:64
expected: "http://example.com/"
got: "http://example.com/reset-password"
(compared using ==)
(RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/navigation.rb:50:in `/^I should be redirected to the (.+?) page$/'
features/password.feature:100:in `Then I should be redirected to the login page'
有沒有辦法使匹配器等待一點點的url更新?
謝謝!我知道必須有一些使用等待行爲的東西。 –