我有後續測試之間的cookie:水豚失去請求
def login_user(email, password)
visit new_user_session_path
fill_in 'E-mail', with: email
fill_in 'Password', with: password
click_button 'go'
end
scenario 'some test' do
order = Fabricate(:order_one, company: user.company)
visit "http://127.0.0.1:49645/orders/#{order.id}" # change to visit "/orders/#{order.id}"
login_user(user.email, user.password)
#assert
end
請告訴我發生的是,在第一個步驟(visit...
)的用戶沒有登錄,所以我使用的cookie設置一些信息。但是,當執行login_user
時,此cookie爲空。
Usigin selenium-webdriver
這裏有什麼想法嗎?提前
設置Cookie是驅動程序特定的。您使用的是什麼水豚驅動程序,您可以發佈'login_user'的代碼嗎? – BoraMa
也許還可以使用[show-me-the-cookies gem](https://github.com/nruth/show_me_the_cookies)來確保您確實在「login_user」方法中正確設置了Cookie。 – BoraMa
@BoraMa用更多的資訊更新這個問題。 – elf