我有以下使用 Geb 的 Spock 测试:
def "The session should expire when the browser is closed."() {
given:
to LoginPage
expect:
waitFor { at LoginPage }
when:
auth.login(Constants.USERNAME)
then:
waitFor { at DashboardPage }
when:
browser.close()
// ???
to SetupAccountPage //fails with SessionNotFoundException: Session ID is null
then:
waitFor { at LoginPage }
}
在测试中关闭和重新打开浏览器的正确方法是什么?
顺便说一句-我知道 this question ,但我不想手动明确注销或清除 cookie,因为这是此测试要验证的内容。
最佳答案
关于groovy - 在 Geb 测试中关闭和打开浏览器的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18384924/