Skip to content

Commit

Permalink
Fix tests now that Firefox latest returns the correct expiry date
Browse files Browse the repository at this point in the history
  • Loading branch information
minusnine committed Aug 21, 2017
1 parent 35c20ff commit 1989d75
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,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) {
Expand Down Expand Up @@ -1084,18 +1091,9 @@ func testAddCookie(t *testing.T, c config) {
want.Path = "/"
want.Domain = "127.0.0.1"

if c.browser == "firefox" {
if c.seleniumVersion.Major == 3 || c.seleniumVersion.Major == 0 && (c.sauce != nil && c.sauce.Platform != "Linux") {
// 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 && c.sauce == nil {
want.Path = ""
}
// Firefox and Geckodriver now returns an empty string for the path.
if c.browser == "firefox" && c.seleniumVersion.Major == 0 && c.sauce == nil {
want.Path = ""
}

cookies, err := wd.GetCookies()
Expand Down

0 comments on commit 1989d75

Please sign in to comment.