diff --git a/input_test.go b/input_test.go index 189897c..9e1706c 100644 --- a/input_test.go +++ b/input_test.go @@ -28,7 +28,7 @@ func TestMouseClickXY(t *testing.T) { c := testAllocate(t, "input.html") defer c.Release() - err = c.Run(defaultContext, Sleep(time.Millisecond*100)) + err = c.Run(defaultContext, Sleep(100*time.Millisecond)) if err != nil { t.Fatal(err) } @@ -48,7 +48,7 @@ func TestMouseClickXY(t *testing.T) { t.Fatalf("test %d got error: %v", i, err) } - time.Sleep(time.Millisecond * 100) + time.Sleep(50 * time.Millisecond) var xstr, ystr string err = c.Run(defaultContext, Value("#input1", &xstr, ByID)) @@ -113,7 +113,7 @@ func TestMouseClickNode(t *testing.T) { t.Fatalf("got error: %v", err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var value string err = c.Run(defaultContext, Value("#input3", &value, ByID)) @@ -171,7 +171,7 @@ func TestMouseClickOffscreenNode(t *testing.T) { } } - time.Sleep(time.Millisecond * 100) + time.Sleep(100 * time.Millisecond) var value int err = c.Run(defaultContext, Evaluate("window.document.test_i", &value)) diff --git a/nav_test.go b/nav_test.go index ed8479b..16230a5 100644 --- a/nav_test.go +++ b/nav_test.go @@ -82,7 +82,7 @@ func TestNavigationEntries(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) err = c.Run(defaultContext, NavigationEntries(&index, &entries)) if err != nil { @@ -116,7 +116,7 @@ func TestNavigateToHistoryEntry(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) err = c.Run(defaultContext, NavigationEntries(&index, &entries)) if err != nil { @@ -128,14 +128,14 @@ func TestNavigateToHistoryEntry(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) err = c.Run(defaultContext, NavigateToHistoryEntry(entries[index].ID)) if err != nil { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var title string err = c.Run(defaultContext, Title(&title)) @@ -160,7 +160,7 @@ func TestNavigateBack(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var exptitle string err = c.Run(defaultContext, Title(&exptitle)) @@ -173,14 +173,14 @@ func TestNavigateBack(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) err = c.Run(defaultContext, NavigateBack()) if err != nil { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var title string err = c.Run(defaultContext, Title(&title)) @@ -205,14 +205,14 @@ func TestNavigateForward(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) err = c.Run(defaultContext, Navigate(testdataDir+"/"+"image.html")) if err != nil { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var exptitle string err = c.Run(defaultContext, Title(&exptitle)) @@ -225,14 +225,14 @@ func TestNavigateForward(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) err = c.Run(defaultContext, NavigateForward()) if err != nil { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var title string err = c.Run(defaultContext, Title(&title)) @@ -276,7 +276,7 @@ func TestReload(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var exptitle string err = c.Run(defaultContext, Title(&exptitle)) @@ -289,7 +289,7 @@ func TestReload(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var title string err = c.Run(defaultContext, Title(&title)) @@ -314,7 +314,7 @@ func TestCaptureScreenshot(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var buf []byte err = c.Run(defaultContext, CaptureScreenshot(&buf)) @@ -347,7 +347,7 @@ func TestAddOnLoadScript(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) if scriptID == "" { t.Fatal("got empty script ID") @@ -383,7 +383,7 @@ func TestRemoveOnLoadScript(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) } func TestLocation(t *testing.T) { @@ -400,7 +400,7 @@ func TestLocation(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var urlstr string err = c.Run(defaultContext, Location(&urlstr)) @@ -427,7 +427,7 @@ func TestTitle(t *testing.T) { t.Fatal(err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var title string err = c.Run(defaultContext, Title(&title)) diff --git a/query_test.go b/query_test.go index 8bdb2da..6a718f1 100644 --- a/query_test.go +++ b/query_test.go @@ -642,6 +642,8 @@ func TestDoubleClick(t *testing.T) { t.Fatalf("got error: %v", err) } + time.Sleep(50 * time.Millisecond) + var value string err = c.Run(defaultContext, Value("#input1", &value, ByID)) if err != nil { @@ -782,7 +784,7 @@ func TestComputedStyle(t *testing.T) { c := testAllocate(t, "js.html") defer c.Release() - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var styles []*css.ComputedProperty err := c.Run(defaultContext, ComputedStyle(test.sel, &styles, test.by)) @@ -803,7 +805,7 @@ func TestComputedStyle(t *testing.T) { t.Fatalf("got error: %v", err) } - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) err = c.Run(defaultContext, ComputedStyle(test.sel, &styles, test.by)) if err != nil { @@ -839,7 +841,7 @@ func TestMatchedStyle(t *testing.T) { c := testAllocate(t, "js.html") defer c.Release() - time.Sleep(time.Millisecond * 50) + time.Sleep(50 * time.Millisecond) var styles *css.GetMatchedStylesForNodeReturns err := c.Run(defaultContext, MatchedStyle(test.sel, &styles, test.by))