playwright: [BUG] Channel chrome on M1 chip performance degradation
Context:
- Playwright Version: 1.25.0
- Operating System: Mac M1 pro
- Node.js version: 14.6
- Browser: Chrome
- Extra: channel chrome
Code Snippet
import { test, expect } from '@playwright/test';
test('login to homepage with Email', async ({ page, baseURL }) => {
await page.goto('https://google.com/')
});
Playwright project config for chrome channel
{
name: 'chromium',
use: {
channel: 'chrome',
...devices['Desktop Chrome'],
},
},
Describe the bug
When tests are run with channel chrome rendering speed is severely affected. Chrome under tests tries to eat all the cpu and RAM available. The easiest way to experience it is to make a debug breakpoint and open chrome in headed mode and try to use it. (pop inspect, navigate to another page)
There are no issues with the default chromium channel.
Chrome channel is used in my case to have FFmpeg codecs included.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 17 (4 by maintainers)
I faced the same issue. Google Chrome was getting launched in the
x86_64 translatedversion instead of the arm version which was slowing down the entire browser and using up a lot of system resources. I was running the Playwright commands on a non-rosetta-enabled terminal. (To check if you have rosetta enabled you can typearchin your terminal. If it returnsarm64then you’re not using rosetta. If it returnsi386then it is using rosetta.)The reason why Chrome is launching in the x86 translated build is probably because the node version you’re using must be an x86 version. To confirm this you can use the
oslibrary provided by NodeJS. Add this code in yourplaywright.config.(ts/js)file:Now when you run your Playwright tests in a non-rosetta-enabled terminal, if you see
Architecture: x64then that means you have the x86 version of node installed on your system. This might have been caused because you installed node in a rosetta-enabled terminal. To solve this issue is as simple as to uninstall and reinstall your current version of node from a non-rosetta enabled terminal. If you’re using nvm then you can follow the steps below.It’s important to note that executing the commands above might affect your package managers like yarn if you have them installed. In that is the case you just have to reinstall them.
Now you can go to your playwright test folder and execute this command to reinstall all the packages.
Once this is done you should be able to open Chrome in the arm64 version in the Playwright tests and the tests should execute much more smoothly.
Just hit this problem, you need to un-check
Open using Rosettaon yourTerminal(or whatever shell), and restart your machine:I’m assuming Chrome when launched via Playwright (which is launched via Terminal) is inheriting the arch somehow. You can check this by hitting
About Google Chromeand checking the arch in the parenthesis:If you pause your Playwright session and it shows
x86_64 translated, then it is running in the wrong arch.