diff --git a/remote_test.go b/remote_test.go index 0d8ccfa..c4310d8 100644 --- a/remote_test.go +++ b/remote_test.go @@ -316,13 +316,20 @@ func testFirefoxPreferences(t *testing.T, c config) { t.Fatalf("error in new session - %s", err) } - u, err := wd.CurrentURL() - if err != nil { - t.Fatalf("wd.Current() returned error: %v", err) - } - if u != serverURL+"/" { - t.Fatalf("wd.Current() = %q, want %q", u, serverURL+"/") + // TODO(minusnine): use the upcoming Wait API for this. + var u string + for i := 0; i < 5; i++ { + var err error + u, err = wd.CurrentURL() + if err != nil { + t.Fatalf("wd.Current() returned error: %v", err) + } + if u == serverURL+"/" { + return + } + time.Sleep(time.Second) } + t.Fatalf("wd.Current() = %q, want %q", u, serverURL+"/") } func testFirefoxProfile(t *testing.T, c config) { @@ -494,7 +501,6 @@ func runTests(t *testing.T, c config) { t.Run("CSSProperty", runTest(testCSSProperty, c)) t.Run("Proxy", runTest(testProxy, c)) t.Run("SwitchFrame", runTest(testSwitchFrame, c)) - t.Run("Wait", runTest(testWait, c)) t.Run("ActiveElement", runTest(testActiveElement, c)) } @@ -1057,16 +1063,9 @@ func testAddCookie(t *testing.T, c config) { want.Path = "/" want.Domain = "127.0.0.1" - if c.browser == "firefox" && (c.seleniumVersion.Major == 3 || c.seleniumVersion.Major == 0) { - // Geckodriver does not return the valid expiration date for the cookie. - // https://github.com/mozilla/geckodriver/issues/463 - t.Log("Working around https://github.com/mozilla/geckodriver/issues/463") - want.Expiry = 0 - - // Firefox and Geckodriver now also returns an empty string for the path. - if c.seleniumVersion.Major == 0 { - want.Path = "" - } + // Firefox and Geckodriver returns an empty string for the path. + if c.browser == "firefox" && c.seleniumVersion.Major == 0 { + want.Path = "" } cookies, err := wd.GetCookies() @@ -1634,42 +1633,6 @@ func testSwitchFrame(t *testing.T, c config) { } } -func testWait(t *testing.T, c config) { - const newTitle = "Title changed." - titleChangeCondition := func(wd WebDriver) (bool, error) { - title, err := wd.Title() - if err != nil { - return false, err - } - - return title == newTitle, nil - } - - wd := newRemote(t, c) - defer quitRemote(t, wd) - - titleURL := serverURL + "/title" - - if err := wd.Get(titleURL); err != nil { - t.Fatalf("wd.Get(%q) returned error: %v", titleURL, err) - } - - // Testing when the title should change. - if err := wd.Wait(titleChangeCondition); err != nil { - t.Fatalf("wd.Wait(titleChangeCondition) returned error: %v", err) - } - - // Reloading the page. - if err := wd.Get(titleURL); err != nil { - t.Fatalf("wd.Get(%q) returned error: %v", titleURL, err) - } - - // Testing when the Wait() should error the timeout.. - if err := wd.WaitWithTimeout(titleChangeCondition, 500*time.Millisecond); err == nil { - t.Fatalf("wd.Wait(titleChangeCondition) should returned error, but it didn't.") - } -} - var homePage = ` @@ -1745,21 +1708,6 @@ var framePage = ` ` -var titleChangePage = ` - - - Go Selenium Test Suite - Title Change Page - - - This page will change a title after 1 second. - - - - -` - func handler(w http.ResponseWriter, r *http.Request) { path := r.URL.Path page, ok := map[string]string{ @@ -1768,7 +1716,6 @@ func handler(w http.ResponseWriter, r *http.Request) { "/search": searchPage, "/log": logPage, "/frame": framePage, - "/title": titleChangePage, }[path] if !ok { http.NotFound(w, r) diff --git a/service.go b/service.go index 213bd3c..d1b0b43 100644 --- a/service.go +++ b/service.go @@ -97,6 +97,7 @@ type Service struct { // NewSeleniumService starts a Selenium instance in the background. func NewSeleniumService(jarPath string, port int, opts ...ServiceOption) (*Service, error) { + // TODO(minusnine): allow specifying the path to the JRE. cmd := exec.Command("java", "-jar", jarPath, "-port", strconv.Itoa(port)) s, err := newService(cmd, port, opts...) if err != nil { diff --git a/vendor/init.go b/vendor/init.go index 52c19b4..205a4ff 100644 --- a/vendor/init.go +++ b/vendor/init.go @@ -65,9 +65,9 @@ var files = []file{ }, { // This is a recent nightly. Update this path periodically. - url: "https://archive.mozilla.org/pub/firefox/nightly/2017/05/2017-05-08-10-02-18-mozilla-central/firefox-55.0a1.en-US.linux-x86_64.tar.bz2", - name: "firefox-55.0a1.en-US.linux-x86_64.tar.bz2", - hash: "88b08469e055014fc2e9b6c43aeacb2b52a028e16acd96854f03523fbd9a9148", + url: "https://archive.mozilla.org/pub/firefox/nightly/2017/08/2017-08-21-10-03-50-mozilla-central/firefox-57.0a1.en-US.linux-x86_64.tar.bz2", + name: "firefox-57.0a1.en-US.linux-x86_64.tar.bz2", + hash: "77c57356935f66a5a59b1b2cffeaa53b70204195e6a7b15ee828fd3308561e46", browser: true, rename: []string{"firefox", "firefox-nightly"}, },