New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain resetBrowser() + clearCacheAndQuitDriver() trick in Book of Geb #473

Closed
kriegaex opened this Issue Feb 20, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@kriegaex

kriegaex commented Feb 20, 2017

After I had answered a StackOverflow question about how to restart a browser within a test here in a rather complicated way and @erdi offered a much simpler solution here I am creating this tracking ticket:

OMG, this works and I had to use such a complicated workaround, searching my eyes out in the Book of Geb (BoG) and elsewhere. Would you mind adding this to chapters 3.1 or 3.2 where you talk about life cycle management? resetBrowser() is not mentioned a single time in the whole BoG, not to speak of the combination with clearCacheAndQuitDriver(). To document this in the BoG would be really helpful. resetBrowser() is also undocumented in the JavaDoc.

For reference, this is a simple use case:

package de.scrum_master.tdd

import geb.driver.CachingDriverFactory
import geb.spock.GebReportingSpec

class RestartBrowserIT extends GebReportingSpec {
  def "Search web site Scrum-Master.de"() {
    when:
    go "https://scrum-master.de"
    report "welcome page"

    then:
    $("h2").text().startsWith("Herzlich Willkommen bei Scrum-Master.de")

    when: "browser is reset"
    resetBrowser()
    CachingDriverFactory.clearCacheAndQuitDriver()

    and: "download page is opened in new browser"
    go "https://scrum-master.de/Downloads"
    report "download page"

    then: "expected text if found on page"
    $("h2").text().startsWith("Scrum on a Page")
  }
}

@erdi erdi self-assigned this Jul 20, 2018

@erdi erdi added this to the 2.2 milestone Jul 20, 2018

@kriegaex

This comment has been minimized.

kriegaex commented Aug 3, 2018

I took a quick look over your commit. The test case looks more condensed and elegant than mine, the text is also comprehensive. Thanks!

@erdi

This comment has been minimized.

Member

erdi commented Aug 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment