-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: assert browser is installed before running its driver
- Loading branch information
1 parent
a7835c2
commit 4c3fd27
Showing
18 changed files
with
198 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { installBrowser, installBrowsersWithDrivers, BrowserInstallStatus } from "./install"; | ||
export { runBrowserDriver } from "./run"; | ||
export { getDriverNameForBrowserName } from "./utils"; | ||
export { getNormalizedBrowserName } from "./utils"; | ||
export type { SupportedBrowser, SupportedDriver } from "./utils"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
import type { ChildProcess } from "child_process"; | ||
import { Driver, type SupportedDriver } from "./utils"; | ||
import { installBrowser } from "./install"; | ||
import { Browser, type SupportedBrowser } from "./utils"; | ||
|
||
export const runBrowserDriver = async ( | ||
driverName: SupportedDriver, | ||
browserName: SupportedBrowser, | ||
browserVersion: string, | ||
{ debug = false } = {}, | ||
): Promise<{ gridUrl: string; process: ChildProcess; port: number }> => { | ||
switch (driverName) { | ||
case Driver.CHROMEDRIVER: | ||
const installBrowserOpts = { shouldInstallWebDriver: true, shouldInstallUbuntuPackages: true }; | ||
|
||
await installBrowser(browserName, browserVersion, installBrowserOpts); | ||
|
||
switch (browserName) { | ||
case Browser.CHROME: | ||
case Browser.CHROMIUM: | ||
return import("./chrome").then(module => module.runChromeDriver(browserVersion, { debug })); | ||
case Driver.EDGEDRIVER: | ||
return import("./edge").then(module => module.runEdgeDriver(browserVersion, { debug })); | ||
case Driver.GECKODRIVER: | ||
case Browser.FIREFOX: | ||
return import("./firefox").then(module => module.runGeckoDriver(browserVersion, { debug })); | ||
case Driver.SAFARIDRIVER: | ||
case Browser.EDGE: | ||
return import("./edge").then(module => module.runEdgeDriver(browserVersion, { debug })); | ||
case Browser.SAFARI: | ||
return import("./safari").then(module => module.runSafariDriver({ debug })); | ||
default: | ||
throw new Error(`Invalid driver name: ${driverName}. Expected one of: ${Object.values(Driver).join(", ")}`); | ||
throw new Error(`Invalid browser: ${browserName}. Expected one of: ${Object.values(Browser).join(", ")}`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/browser-installer/ubuntu-packages/collect-dependencies/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.