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
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 12
|
node-version: 12
|
||||||
- name: Install Chrome Stable
|
|
||||||
run: sudo apt install google-chrome-stable
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: node lib/cli/cli install-deps chromium
|
- 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 chrome
|
||||||
- run: node lib/cli/cli install ffmpeg
|
|
||||||
# XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
|
# XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
|
||||||
# Wrap `npm run` in a subshell to redirect STDERR to file.
|
# 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"
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- bash -c "npm run ctest"
|
||||||
|
|
@ -236,8 +233,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
# This only created problems, should we move ffmpeg back into npm?
|
- run: node lib/cli/cli install chrome
|
||||||
- run: node lib/cli/cli install ffmpeg
|
|
||||||
- run: npm run ctest
|
- run: npm run ctest
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
|
@ -263,8 +259,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
# This only created problems, should we move ffmpeg back into npm?
|
- run: node lib/cli/cli install chrome
|
||||||
- run: node lib/cli/cli install ffmpeg
|
|
||||||
- run: npm run ctest
|
- run: npm run ctest
|
||||||
env:
|
env:
|
||||||
PWTEST_CHANNEL: chrome
|
PWTEST_CHANNEL: chrome
|
||||||
|
|
@ -289,7 +284,7 @@ jobs:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: node lib/cli/cli install-deps firefox
|
- 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
|
# XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
|
||||||
# Wrap `npm run` in a subshell to redirect STDERR to file.
|
# 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"
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- bash -c "npm run ftest"
|
||||||
|
|
@ -318,7 +313,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- 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
|
- run: npm run ftest
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
|
@ -344,7 +339,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- 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
|
- run: npm run ftest
|
||||||
env:
|
env:
|
||||||
PWTEST_CHANNEL: firefox-stable
|
PWTEST_CHANNEL: firefox-stable
|
||||||
|
|
@ -371,7 +366,6 @@ jobs:
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
- run: npm run build
|
- 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 ffmpeg
|
||||||
- run: npm run ctest
|
- run: npm run ctest
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# 1. make sure to remove old beta if any.
|
# 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
|
sudo apt-get remove -y google-chrome-beta
|
||||||
fi
|
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');
|
const SCRIPTS_DIRECTORY = path.join(__dirname, '..', '..', 'bin');
|
||||||
|
|
||||||
type BrowserChannel = 'chrome-beta';
|
type BrowserChannel = 'chrome-beta'|'chrome';
|
||||||
const allBrowserChannels: Set<BrowserChannel> = new Set(['chrome-beta']);
|
const allBrowserChannels: Set<BrowserChannel> = new Set(['chrome-beta', 'chrome']);
|
||||||
|
|
||||||
program
|
program
|
||||||
.version('Version ' + require('../../package.json').version)
|
.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(', ')}`);
|
console.log(`Invalid installation targets: ${faultyArguments.map(name => `'${name}'`).join(', ')}. Expecting one of: ${[...allBrowserNames, ...allBrowserChannels].map(name => `'${name}'`).join(', ')}`);
|
||||||
process.exit(1);
|
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');
|
browserNames.add('ffmpeg');
|
||||||
if (browserNames.size)
|
if (browserNames.size)
|
||||||
await installBrowsers([...browserNames]);
|
await installBrowsers([...browserNames]);
|
||||||
for (const browserChannel of browserChannels) {
|
for (const browserChannel of browserChannels) {
|
||||||
if (browserChannel === 'chrome-beta')
|
if (browserChannel === 'chrome-beta' || browserChannel === 'chrome')
|
||||||
await installChromeBeta();
|
await installChromeChannel(browserChannel);
|
||||||
else
|
else
|
||||||
throw new Error(`ERROR: no installation instructions for '${browserChannel}' channel.`);
|
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 platform: string = os.platform();
|
||||||
const shell: (string|undefined) = {
|
const shell: (string|undefined) = {
|
||||||
'linux': 'bash',
|
'linux': 'bash',
|
||||||
'darwin': 'bash',
|
'darwin': 'bash',
|
||||||
'win32': 'powershell.exe',
|
'win32': 'powershell.exe',
|
||||||
}[platform];
|
}[platform];
|
||||||
const scriptName: (string|undefined) = {
|
const scriptName: (string|undefined) = ({
|
||||||
'linux': 'reinstall_chrome_beta_linux.sh',
|
'chrome-beta': {
|
||||||
'darwin': 'reinstall_chrome_beta_mac.sh',
|
'linux': 'reinstall_chrome_beta_linux.sh',
|
||||||
'win32': 'reinstall_chrome_beta_win.ps1',
|
'darwin': 'reinstall_chrome_beta_mac.sh',
|
||||||
}[platform];
|
'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)
|
if (!shell || !scriptName)
|
||||||
throw new Error(`Cannot install chrome-beta on ${platform}`);
|
throw new Error(`Cannot install chrome-beta on ${platform}`);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue