Skip to content

Commit

Permalink
fix: apply edits
Browse files Browse the repository at this point in the history
  • Loading branch information
KuznetsovRoman committed Nov 20, 2024
1 parent 2da7787 commit 7e5fe69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/browser-installer/registry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ export const getMatchedBrowserVersion = (
a = a.slice(a.indexOf("_") + 1);
b = b.slice(b.indexOf("_") + 1);

// Firefox has versions like "stable_131.0a1" and "stable_129.0b9"
// Parsing raw numbers as hex values is needed in order to distinguish "129.0b9" and "129.0b7" for example
return parseInt(a.replace(".", ""), 16) - parseInt(b.replace(".", ""), 16);
};

Expand Down
2 changes: 2 additions & 0 deletions src/browser-installer/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ export const runBrowserDriver = async (
return import("./firefox").then(module => module.runGeckoDriver(browserVersion, { debug }));
case Driver.SAFARIDRIVER:
return import("./safari").then(module => module.runSafariDriver({ debug }));
default:
throw new Error(`Invalid driver name: ${driverName}. Expected one of: ${Object.values(Driver).join(", ")}`);
}
};
4 changes: 4 additions & 0 deletions src/browser-pool/webdriver-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export class WebdriverPool {
);
}

if (!browserVersion) {
throw new Error(`Couldn't run browser driver for "${browserName}" because its version is undefined`);
}

const wdProcesses = this.driverProcess.get(driverName)?.get(browserVersion) ?? {};

for (const port in wdProcesses) {
Expand Down

0 comments on commit 7e5fe69

Please sign in to comment.