(t *testing.T)
| 132 | } |
| 133 | |
| 134 | func TestChrome(t *testing.T) { |
| 135 | if *useDocker { |
| 136 | t.Skip("Skipping Chrome tests because they will be run under a Docker container") |
| 137 | } |
| 138 | if _, err := os.Stat(*chromeBinary); err != nil { |
| 139 | path, err := exec.LookPath(*chromeBinary) |
| 140 | if err != nil { |
| 141 | t.Skipf("Skipping Chrome tests because binary %q not found", *chromeBinary) |
| 142 | } |
| 143 | *chromeBinary = path |
| 144 | } |
| 145 | if _, err := os.Stat(*chromeDriverPath); err != nil { |
| 146 | t.Skipf("Skipping Chrome tests because ChromeDriver not found at path %q", *chromeDriverPath) |
| 147 | } |
| 148 | |
| 149 | var opts []ServiceOption |
| 150 | if *startFrameBuffer { |
| 151 | opts = append(opts, StartFrameBuffer()) |
| 152 | } |
| 153 | if testing.Verbose() { |
| 154 | SetDebug(true) |
| 155 | opts = append(opts, Output(os.Stderr)) |
| 156 | } |
| 157 | |
| 158 | port, err := pickUnusedPort() |
| 159 | if err != nil { |
| 160 | t.Fatalf("pickUnusedPort() returned error: %v", err) |
| 161 | } |
| 162 | |
| 163 | s, err := NewChromeDriverService(*chromeDriverPath, port, opts...) |
| 164 | if err != nil { |
| 165 | t.Fatalf("Error starting the ChromeDriver server: %v", err) |
| 166 | } |
| 167 | c := config{ |
| 168 | addr: fmt.Sprintf("http://127.0.0.1:%d/wd/hub", port), |
| 169 | browser: "chrome", |
| 170 | path: *chromeBinary, |
| 171 | } |
| 172 | |
| 173 | runTests(t, c) |
| 174 | |
| 175 | // Chrome-specific tests. |
| 176 | t.Run("Extension", runTest(testChromeExtension, c)) |
| 177 | |
| 178 | if err := s.Stop(); err != nil { |
| 179 | t.Fatalf("Error stopping the ChromeDriver service: %v", err) |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | func testChromeExtension(t *testing.T, c config) { |
| 184 | caps := newTestCapabilities(t, c) |
nothing calls this directly
no test coverage detected
searching dependent graphs…