(t *testing.T, c config)
| 1889 | } |
| 1890 | |
| 1891 | func testWait(t *testing.T, c config) { |
| 1892 | const newTitle = "Title changed." |
| 1893 | titleChangeCondition := func(wd WebDriver) (bool, error) { |
| 1894 | title, err := wd.Title() |
| 1895 | if err != nil { |
| 1896 | return false, err |
| 1897 | } |
| 1898 | |
| 1899 | return title == newTitle, nil |
| 1900 | } |
| 1901 | |
| 1902 | wd := newRemote(t, c) |
| 1903 | defer quitRemote(t, wd) |
| 1904 | |
| 1905 | titleURL := serverURL + "/title" |
| 1906 | |
| 1907 | if err := wd.Get(titleURL); err != nil { |
| 1908 | t.Fatalf("wd.Get(%q) returned error: %v", titleURL, err) |
| 1909 | } |
| 1910 | |
| 1911 | // Testing when the title should change. |
| 1912 | if err := wd.Wait(titleChangeCondition); err != nil { |
| 1913 | t.Fatalf("wd.Wait(titleChangeCondition) returned error: %v", err) |
| 1914 | } |
| 1915 | |
| 1916 | // Reloading the page. |
| 1917 | if err := wd.Get(titleURL); err != nil { |
| 1918 | t.Fatalf("wd.Get(%q) returned error: %v", titleURL, err) |
| 1919 | } |
| 1920 | |
| 1921 | // Testing when the Wait() should error the timeout.. |
| 1922 | if err := wd.WaitWithTimeout(titleChangeCondition, 500*time.Millisecond); err == nil { |
| 1923 | t.Fatalf("wd.Wait(titleChangeCondition) should returned error, but it didn't.") |
| 1924 | } |
| 1925 | } |
| 1926 | |
| 1927 | func testAcceptAlert(t *testing.T, c config) { |
| 1928 | wd := newRemote(t, c) |
nothing calls this directly
no test coverage detected
searching dependent graphs…