Skip to content

Commit 31f186c

Browse files
fix(browserFetcher): support macos 10.13 for firefox and chromium (#1549)
I don't have a macos 10.13 build to test on, and we aren't set up to compile it for WebKit. However there is a good chance this will work for Chromium and Firefox. I also improved the error message received when on an unsupported platform. #1535
1 parent d9c064b commit 31f186c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/server/browserFetcher.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,23 @@ const DEFAULT_DOWNLOAD_HOSTS = {
4040
const DOWNLOAD_URLS = {
4141
chromium: {
4242
'linux': '%s/chromium-browser-snapshots/Linux_x64/%d/chrome-linux.zip',
43+
'mac10.13': '%s/chromium-browser-snapshots/Mac/%d/chrome-mac.zip',
4344
'mac10.14': '%s/chromium-browser-snapshots/Mac/%d/chrome-mac.zip',
4445
'mac10.15': '%s/chromium-browser-snapshots/Mac/%d/chrome-mac.zip',
4546
'win32': '%s/chromium-browser-snapshots/Win/%d/chrome-win.zip',
4647
'win64': '%s/chromium-browser-snapshots/Win_x64/%d/chrome-win.zip',
4748
},
4849
firefox: {
4950
'linux': '%s/builds/firefox/%s/firefox-linux.zip',
51+
'mac10.13': '%s/builds/firefox/%s/firefox-mac.zip',
5052
'mac10.14': '%s/builds/firefox/%s/firefox-mac.zip',
5153
'mac10.15': '%s/builds/firefox/%s/firefox-mac.zip',
5254
'win32': '%s/builds/firefox/%s/firefox-win32.zip',
5355
'win64': '%s/builds/firefox/%s/firefox-win64.zip',
5456
},
5557
webkit: {
5658
'linux': '%s/builds/webkit/%s/minibrowser-gtk-wpe.zip',
59+
'mac10.13': undefined,
5760
'mac10.14': '%s/builds/webkit/%s/minibrowser-mac-10.14.zip',
5861
'mac10.15': '%s/builds/webkit/%s/minibrowser-mac-10.15.zip',
5962
'win32': '%s/builds/webkit/%s/minibrowser-win64.zip',
@@ -64,20 +67,23 @@ const DOWNLOAD_URLS = {
6467
const RELATIVE_EXECUTABLE_PATHS = {
6568
chromium: {
6669
'linux': ['chrome-linux', 'chrome'],
70+
'mac10.13': ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium'],
6771
'mac10.14': ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium'],
6872
'mac10.15': ['chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium'],
6973
'win32': ['chrome-win', 'chrome.exe'],
7074
'win64': ['chrome-win', 'chrome.exe'],
7175
},
7276
firefox: {
7377
'linux': ['firefox', 'firefox'],
78+
'mac10.13': ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox'],
7479
'mac10.14': ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox'],
7580
'mac10.15': ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox'],
7681
'win32': ['firefox', 'firefox.exe'],
7782
'win64': ['firefox', 'firefox.exe'],
7883
},
7984
webkit: {
8085
'linux': ['pw_run.sh'],
86+
'mac10.13': undefined,
8187
'mac10.14': ['pw_run.sh'],
8288
'mac10.15': ['pw_run.sh'],
8389
'win32': ['MiniBrowser.exe'],
@@ -87,7 +93,7 @@ const RELATIVE_EXECUTABLE_PATHS = {
8793

8894
export type OnProgressCallback = (downloadedBytes: number, totalBytes: number) => void;
8995
export type BrowserName = ('chromium'|'webkit'|'firefox');
90-
export type BrowserPlatform = ('win32'|'win64'|'mac10.14'|'mac10.15'|'linux');
96+
export type BrowserPlatform = ('win32'|'win64'|'mac10.13'|'mac10.14'|'mac10.15'|'linux');
9197

9298
export type DownloadOptions = {
9399
browser: BrowserName,
@@ -120,7 +126,7 @@ function revisionURL(options: DownloadOptions): string {
120126
} = options;
121127
assert(revision, `'revision' must be specified`);
122128
assert(DOWNLOAD_URLS[browser], 'Unsupported browser: ' + browser);
123-
const urlTemplate = (DOWNLOAD_URLS[browser] as any)[platform];
129+
const urlTemplate = DOWNLOAD_URLS[browser][platform as BrowserPlatform];
124130
assert(urlTemplate, `ERROR: Playwright does not support ${browser} on ${platform}`);
125131
return util.format(urlTemplate, host, revision);
126132
}
@@ -155,7 +161,9 @@ export function executablePath(options: DownloadOptions): string {
155161
downloadPath,
156162
platform = CURRENT_HOST_PLATFORM,
157163
} = options;
158-
return path.join(downloadPath, ...RELATIVE_EXECUTABLE_PATHS[browser][platform as BrowserPlatform]);
164+
const relativePath = RELATIVE_EXECUTABLE_PATHS[browser][platform as BrowserPlatform];
165+
assert(relativePath, `Unsupported platform for ${browser}: ${platform}`);
166+
return path.join(downloadPath, ...relativePath);
159167
}
160168

161169
export async function canDownload(options: DownloadOptions): Promise<boolean> {

0 commit comments

Comments
 (0)