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