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 = ` - - -