Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: browsers: recognize chromium as a valid browser #9760

Merged
merged 4 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/browsers/src/browsers/browsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ import {Browser, BrowserPlatform, BrowserTag} from './types.js';

export const downloadUrls = {
[Browser.CHROME]: chrome.resolveDownloadUrl,
[Browser.CHROMIUM]: chrome.resolveDownloadUrl,
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
};

export const executablePathByBrowser = {
[Browser.CHROME]: chrome.relativeExecutablePath,
[Browser.CHROMIUM]: chrome.relativeExecutablePath,
[Browser.FIREFOX]: firefox.relativeExecutablePath,
};

Expand All @@ -42,6 +44,7 @@ export async function resolveBuildId(
return await firefox.resolveBuildId('FIREFOX_NIGHTLY');
}
case Browser.CHROME:
case Browser.CHROMIUM:
switch (tag as BrowserTag) {
case BrowserTag.LATEST:
return await chrome.resolveBuildId(platform, 'latest');
Expand Down
2 changes: 2 additions & 0 deletions packages/browsers/src/browsers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import * as firefox from './firefox.js';
*/
export enum Browser {
CHROME = 'chrome',
CHROMIUM = 'chromium',
FIREFOX = 'firefox',
}

Expand All @@ -39,6 +40,7 @@ export enum BrowserPlatform {

export const downloadUrls = {
[Browser.CHROME]: chrome.resolveDownloadUrl,
[Browser.CHROMIUM]: chrome.resolveDownloadUrl,
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
};

Expand Down
12 changes: 12 additions & 0 deletions packages/browsers/test/src/launcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ describe('launcher', () => {
);
});

it('should compute executable path for Chromium', () => {
assert.strictEqual(
computeExecutablePath({
browser: Browser.CHROMIUM,
platform: BrowserPlatform.LINUX,
buildId: '123',
cacheDir: 'cache',
}),
path.join('cache', 'chromium', 'linux-123', 'chrome-linux', 'chrome')
);
});

it('should compute executable path for Firefox', () => {
assert.strictEqual(
computeExecutablePath({
Expand Down