* @return {!Array<!TargetBrowser>} the browsers available for testing on this * system.
()
| 134 | * system. |
| 135 | */ |
| 136 | function getAvailableBrowsers() { |
| 137 | info(`Searching for WebDriver executables installed on the current system...`) |
| 138 | |
| 139 | let targets = [ |
| 140 | [getBinaryPaths(new chrome.Options()), Browser.CHROME], |
| 141 | [getBinaryPaths(new edge.Options()), Browser.EDGE], |
| 142 | [getBinaryPaths(new firefox.Options()), Browser.FIREFOX], |
| 143 | ] |
| 144 | if (process.platform === 'win32') { |
| 145 | targets.push([getBinaryPaths(new ie.Options()), Browser.INTERNET_EXPLORER]) |
| 146 | } |
| 147 | if (process.platform === 'darwin') { |
| 148 | targets.push([getBinaryPaths(new safari.Options()), Browser.SAFARI]) |
| 149 | } |
| 150 | |
| 151 | let availableBrowsers = [] |
| 152 | for (let pair of targets) { |
| 153 | const driverPath = pair[0].driverPath |
| 154 | const browserPath = pair[0].browserPath |
| 155 | const name = pair[1] |
| 156 | const capabilities = pair[2] |
| 157 | if (driverPath.length > 0 && browserPath && browserPath.length > 0) { |
| 158 | info(`... located ${name}`) |
| 159 | availableBrowsers.push({ name, capabilities }) |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | if (availableBrowsers.length === 0) { |
| 164 | warn(`Unable to locate any WebDriver executables for testing`) |
| 165 | } |
| 166 | |
| 167 | return availableBrowsers |
| 168 | } |
| 169 | |
| 170 | let wasInit |
| 171 | let targetBrowsers |
no test coverage detected