Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(webkit): properly detect arm64 on apple silicon (#4783)

Joel Einbinderff2a1f1bd0a6
diff --git a/src/utils/browserPaths.ts b/src/utils/browserPaths.ts
index ac8891f58b..e52b68fd0a 100644
--- a/src/utils/browserPaths.ts
+++ b/src/utils/browserPaths.ts
@@ -35,7 +35,13 @@ export const hostPlatform = ((): BrowserPlatform => {
const macVersion = execSync('sw_vers -productVersion', {
stdio: ['ignore', 'pipe', 'ignore']
}).toString('utf8').trim().split('.').slice(0, 2).join('.');
- const archSuffix = os.arch() === 'arm64' ? '-arm64' : '';
+ let arm64 = false;
+ if (!macVersion.startsWith('10.')) {
+ arm64 = execSync('sysctl -in hw.optional.arm64', {
+ stdio: ['ignore', 'pipe', 'ignore']
+ }).toString().trim() === '1';
+ }
+ const archSuffix = arm64 ? '-arm64' : '';
return `mac${macVersion}${archSuffix}` as BrowserPlatform;
}
if (platform === 'linux') {