mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
feat: support npx playwright install chrome
(#6835)
This will install latest-and-greatest chrome stable.
This commit is contained in:
parent
1020d3d329
commit
919d258356
18
.github/workflows/tests_secondary.yml
vendored
18
.github/workflows/tests_secondary.yml
vendored
@ -199,15 +199,12 @@ jobs:
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 12
|
||||
- name: Install Chrome Stable
|
||||
run: sudo apt install google-chrome-stable
|
||||
- run: npm ci
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
- run: node lib/cli/cli install-deps chromium
|
||||
# This only created problems, should we move ffmpeg back into npm?
|
||||
- run: node lib/cli/cli install ffmpeg
|
||||
- run: node lib/cli/cli install chrome
|
||||
# XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
|
||||
# Wrap `npm run` in a subshell to redirect STDERR to file.
|
||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- bash -c "npm run ctest"
|
||||
@ -236,8 +233,7 @@ jobs:
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
# This only created problems, should we move ffmpeg back into npm?
|
||||
- run: node lib/cli/cli install ffmpeg
|
||||
- run: node lib/cli/cli install chrome
|
||||
- run: npm run ctest
|
||||
shell: bash
|
||||
env:
|
||||
@ -263,8 +259,7 @@ jobs:
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
# This only created problems, should we move ffmpeg back into npm?
|
||||
- run: node lib/cli/cli install ffmpeg
|
||||
- run: node lib/cli/cli install chrome
|
||||
- run: npm run ctest
|
||||
env:
|
||||
PWTEST_CHANNEL: chrome
|
||||
@ -289,7 +284,7 @@ jobs:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
- run: node lib/cli/cli install-deps firefox
|
||||
- run: node lib/cli/cli install ffmpeg firefox-stable chromium
|
||||
- run: node lib/cli/cli install firefox-stable chromium
|
||||
# XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
|
||||
# Wrap `npm run` in a subshell to redirect STDERR to file.
|
||||
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- bash -c "npm run ftest"
|
||||
@ -318,7 +313,7 @@ jobs:
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
- run: node lib/cli/cli install ffmpeg firefox-stable chromium
|
||||
- run: node lib/cli/cli install firefox-stable chromium
|
||||
- run: npm run ftest
|
||||
shell: bash
|
||||
env:
|
||||
@ -344,7 +339,7 @@ jobs:
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
- run: node lib/cli/cli install ffmpeg firefox-stable chromium
|
||||
- run: node lib/cli/cli install firefox-stable chromium
|
||||
- run: npm run ftest
|
||||
env:
|
||||
PWTEST_CHANNEL: firefox-stable
|
||||
@ -371,7 +366,6 @@ jobs:
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
- run: npm run build
|
||||
# This only created problems, should we move ffmpeg back into npm?
|
||||
- run: node lib/cli/cli install ffmpeg
|
||||
- run: npm run ctest
|
||||
shell: bash
|
||||
|
@ -3,7 +3,7 @@ set -e
|
||||
set -x
|
||||
|
||||
# 1. make sure to remove old beta if any.
|
||||
if sudo dpkg -S google-chrome-beta &>/dev/null; then
|
||||
if dpkg --get-selections | grep -q "^google-chrome-beta[[:space:]]*install$" >/dev/null; then
|
||||
sudo apt-get remove -y google-chrome-beta
|
||||
fi
|
||||
|
||||
|
16
bin/reinstall_chrome_stable_linux.sh
Executable file
16
bin/reinstall_chrome_stable_linux.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# 1. make sure to remove old stable if any.
|
||||
if dpkg --get-selections | grep -q "^google-chrome[[:space:]]*install$" >/dev/null; then
|
||||
sudo apt-get remove -y google-chrome
|
||||
fi
|
||||
|
||||
|
||||
# 2. download chrome stable from dl.google.com and install it.
|
||||
cd /tmp
|
||||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
sudo apt-get install -y ./google-chrome-stable_current_amd64.deb
|
||||
rm -rf ./google-chrome-stable_current_amd64.deb
|
||||
cd -
|
10
bin/reinstall_chrome_stable_mac.sh
Executable file
10
bin/reinstall_chrome_stable_mac.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
rm -rf "/Applications/Google Chrome.app"
|
||||
cd /tmp
|
||||
curl -o ./googlechrome.dmg -k https://dl.google.com/chrome/mac/beta/googlechrome.dmg
|
||||
hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechrome.dmg ./googlechrome.dmg
|
||||
cp -rf "/Volumes/googlechrome.dmg/Google Chrome.app" /Applications
|
||||
hdiutil detach /Volumes/googlechrome.dmg
|
20
bin/reinstall_chrome_stable_win.ps1
Normal file
20
bin/reinstall_chrome_stable_win.ps1
Normal file
@ -0,0 +1,20 @@
|
||||
$url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromestandaloneenterprise.msi';
|
||||
|
||||
if ([Environment]::Is64BitProcess) {
|
||||
$url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromestandaloneenterprise64.msi'
|
||||
}
|
||||
|
||||
$app = Get-WmiObject -Class Win32_Product | Where-Object {
|
||||
$_.Name -eq "Google Chrome"
|
||||
}
|
||||
if ($app) {
|
||||
$app.Uninstall()
|
||||
}
|
||||
|
||||
$wc = New-Object net.webclient
|
||||
$msiInstaller = "$env:temp\google-chrome.msi"
|
||||
Remove-Item $msiInstaller
|
||||
$wc.Downloadfile($url, $msiInstaller)
|
||||
|
||||
$arguments = "/i `"$msiInstaller`" /quiet"
|
||||
Start-Process msiexec.exe -ArgumentList $arguments -Wait
|
@ -39,8 +39,8 @@ import * as utils from '../utils/utils';
|
||||
|
||||
const SCRIPTS_DIRECTORY = path.join(__dirname, '..', '..', 'bin');
|
||||
|
||||
type BrowserChannel = 'chrome-beta';
|
||||
const allBrowserChannels: Set<BrowserChannel> = new Set(['chrome-beta']);
|
||||
type BrowserChannel = 'chrome-beta'|'chrome';
|
||||
const allBrowserChannels: Set<BrowserChannel> = new Set(['chrome-beta', 'chrome']);
|
||||
|
||||
program
|
||||
.version('Version ' + require('../../package.json').version)
|
||||
@ -106,13 +106,13 @@ program
|
||||
console.log(`Invalid installation targets: ${faultyArguments.map(name => `'${name}'`).join(', ')}. Expecting one of: ${[...allBrowserNames, ...allBrowserChannels].map(name => `'${name}'`).join(', ')}`);
|
||||
process.exit(1);
|
||||
}
|
||||
if (browserNames.has('chromium') || browserChannels.has('chrome-beta'))
|
||||
if (browserNames.has('chromium') || browserChannels.has('chrome-beta') || browserChannels.has('chrome'))
|
||||
browserNames.add('ffmpeg');
|
||||
if (browserNames.size)
|
||||
await installBrowsers([...browserNames]);
|
||||
for (const browserChannel of browserChannels) {
|
||||
if (browserChannel === 'chrome-beta')
|
||||
await installChromeBeta();
|
||||
if (browserChannel === 'chrome-beta' || browserChannel === 'chrome')
|
||||
await installChromeChannel(browserChannel);
|
||||
else
|
||||
throw new Error(`ERROR: no installation instructions for '${browserChannel}' channel.`);
|
||||
}
|
||||
@ -122,18 +122,25 @@ program
|
||||
}
|
||||
});
|
||||
|
||||
async function installChromeBeta() {
|
||||
async function installChromeChannel(channel: string) {
|
||||
const platform: string = os.platform();
|
||||
const shell: (string|undefined) = {
|
||||
'linux': 'bash',
|
||||
'darwin': 'bash',
|
||||
'win32': 'powershell.exe',
|
||||
}[platform];
|
||||
const scriptName: (string|undefined) = {
|
||||
'linux': 'reinstall_chrome_beta_linux.sh',
|
||||
'darwin': 'reinstall_chrome_beta_mac.sh',
|
||||
'win32': 'reinstall_chrome_beta_win.ps1',
|
||||
}[platform];
|
||||
const scriptName: (string|undefined) = ({
|
||||
'chrome-beta': {
|
||||
'linux': 'reinstall_chrome_beta_linux.sh',
|
||||
'darwin': 'reinstall_chrome_beta_mac.sh',
|
||||
'win32': 'reinstall_chrome_beta_win.ps1',
|
||||
},
|
||||
'chrome': {
|
||||
'linux': 'reinstall_chrome_stable_linux.sh',
|
||||
'darwin': 'reinstall_chrome_stable_mac.sh',
|
||||
'win32': 'reinstall_chrome_stable_win.ps1',
|
||||
},
|
||||
}[channel] as any)[platform];
|
||||
if (!shell || !scriptName)
|
||||
throw new Error(`Cannot install chrome-beta on ${platform}`);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user