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更新?
谢谢!我知道必须有一些使用等待行为的东西。 –