feat: support msedge-beta channel (#7442)

Fixes #7232
This commit is contained in:
Andrey Lushnikov 2021-07-02 11:55:46 -08:00 committed by GitHub
parent 040d81052a
commit ec8d0629f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 167 additions and 45 deletions

View File

@ -381,6 +381,77 @@ jobs:
name: edge-stable-win-test-results
path: test-results
edge_beta_mac:
name: "Edge Beta (Mac)"
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: node lib/cli/cli install msedge-beta
- run: npm run ctest
env:
PWTEST_CHANNEL: msedge-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: msedge-beta-mac-test-results
path: test-results
edge_beta_win:
name: "Edge Beta (Win)"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: node lib/cli/cli install msedge-beta
- run: npm run ctest
shell: bash
env:
PWTEST_CHANNEL: msedge-beta
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: edge-beta-win-test-results
path: test-results
edge_beta_linux:
name: "Edge Beta (Linux)"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build
- run: node lib/cli/cli install msedge-beta
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
env:
PWTEST_CHANNEL: msedge-beta
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: edge-beta-linux-test-results
path: test-results
chrome_beta_linux:
name: "Chrome Beta (Linux)"
runs-on: ubuntu-20.04

View File

@ -2,15 +2,22 @@
set -e
set -x
is_user_root () { [ "${EUID:-$(id -u)}" -eq 0 ]; }
if is_user_root; then
maybesudo=""
else
maybesudo="sudo"
fi
# 1. make sure to remove old beta if any.
if dpkg --get-selections | grep -q "^google-chrome-beta[[:space:]]*install$" >/dev/null; then
sudo apt-get remove -y google-chrome-beta
$maybesudo apt-get remove -y google-chrome-beta
fi
# 2. download chrome beta from dl.google.com and install it.
cd /tmp
wget https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb
sudo apt-get install -y ./google-chrome-beta_current_amd64.deb
$maybesudo apt-get install -y ./google-chrome-beta_current_amd64.deb
rm -rf ./google-chrome-beta_current_amd64.deb
cd -
google-chrome-beta --version

View File

@ -2,16 +2,24 @@
set -e
set -x
is_user_root () { [ "${EUID:-$(id -u)}" -eq 0 ]; }
if is_user_root; then
maybesudo=""
else
maybesudo="sudo"
fi
# 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
$maybesudo 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
$maybesudo apt-get install -y ./google-chrome-stable_current_amd64.deb
rm -rf ./google-chrome-stable_current_amd64.deb
cd -
google-chrome --version

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
set -x
is_user_root () { [ "${EUID:-$(id -u)}" -eq 0 ]; }
if is_user_root; then
maybesudo=""
else
maybesudo="sudo"
fi
if dpkg --get-selections | grep -q "^microsoft-edge-beta[[:space:]]*install$" >/dev/null; then
$maybesudo apt-get remove -y microsoft-edge-beta
fi
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg
$maybesudo install -o root -g root -m 644 /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/
$maybesudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
rm /tmp/microsoft.gpg
$maybesudo apt-get update && $maybesudo apt-get install -y microsoft-edge-beta
microsoft-edge-beta --version

View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
set -x
cd /tmp
curl -o ./msedge_beta.pkg -k "$1"
# Note: there's no way to uninstall previously installed MSEdge.
# However, running PKG again seems to update installation.
sudo installer -pkg /tmp/msedge_beta.pkg -target /
rm -rf /tmp/msedge_beta.pkg
/Applications/Microsoft\ Edge\ Beta.app/Contents/MacOS/Microsoft\ Edge\ Beta --version

View File

@ -0,0 +1,21 @@
$url = $args[0]
Write-Host "Downloading Microsoft Edge Beta"
$wc = New-Object net.webclient
$msiInstaller = "$env:temp\microsoft-edge-beta.msi"
$wc.Downloadfile($url, $msiInstaller)
Write-Host "Installing Microsoft Edge Beta"
$arguments = "/i `"$msiInstaller`" /quiet"
Start-Process msiexec.exe -ArgumentList $arguments -Wait
Remove-Item $msiInstaller
$suffix = "\\Microsoft\\Edge\\Application\\msedge.exe"
if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
(Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
(Get-Item "${env:ProgramFiles}$suffix").VersionInfo
} else {
write-host "ERROR: failed to install Microsoft Edge"
exit 1
}

View File

@ -37,15 +37,17 @@ import * as utils from '../utils/utils';
const SCRIPTS_DIRECTORY = path.join(__dirname, '..', '..', 'bin');
type BrowserChannel = 'chrome-beta'|'chrome'|'msedge';
const allBrowserChannels: Set<BrowserChannel> = new Set(['chrome-beta', 'chrome', 'msedge']);
type BrowserChannel = 'chrome-beta'|'chrome'|'msedge'|'msedge-beta';
const allBrowserChannels: Set<BrowserChannel> = new Set(['chrome-beta', 'chrome', 'msedge', 'msedge-beta']);
const suggestedBrowsersToInstall = ['chromium', 'webkit', 'firefox', ...allBrowserChannels].map(name => `'${name}'`).join(', ');
const packageJSON = require('../../package.json');
const ChannelName = {
'chrome-beta': 'Google Chrome Beta',
'chrome': 'Google Chrome',
'msedge': 'Microsoft Edge',
'msedge-beta': 'Microsoft Edge Beta',
};
const InstallationScriptName = {
@ -63,6 +65,11 @@ const InstallationScriptName = {
'darwin': 'reinstall_msedge_stable_mac.sh',
'win32': 'reinstall_msedge_stable_win.ps1',
},
'msedge-beta': {
'darwin': 'reinstall_msedge_beta_mac.sh',
'linux': 'reinstall_msedge_beta_linux.sh',
'win32': 'reinstall_msedge_beta_win.ps1',
},
};
program
@ -129,7 +136,7 @@ program
console.log(`Invalid installation targets: ${faultyArguments.map(name => `'${name}'`).join(', ')}. Expecting one of: ${suggestedBrowsersToInstall}`);
process.exit(1);
}
if (browserNames.has('chromium') || browserChannels.has('chrome-beta') || browserChannels.has('chrome') || browserChannels.has('msedge'))
if (browserNames.has('chromium') || browserChannels.has('chrome-beta') || browserChannels.has('chrome') || browserChannels.has('msedge') || browserChannels.has('msedge-beta'))
browserNames.add('ffmpeg');
if (browserNames.size)
await installBrowsers([...browserNames]);
@ -156,21 +163,20 @@ async function installBrowserChannel(channel: BrowserChannel) {
throw new Error(`Cannot install ${ChannelName[channel]} on ${platform}`);
const scriptArgs = [];
if (channel === 'msedge') {
if ((channel === 'msedge' || channel === 'msedge-beta') && platform !== 'linux') {
const products = JSON.parse(await utils.fetchData('https://edgeupdates.microsoft.com/api/products'));
const stable = products.find((product: any) => product.Product === 'Stable');
if (platform === 'win32') {
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
const release = stable.Releases.find((release: any) => release.Platform === 'Windows' && release.Architecture === arch);
const artifact = release.Artifacts.find((artifact: any) => artifact.ArtifactName === 'msi');
const productName = channel === 'msedge' ? 'Stable' : 'Beta';
const product = products.find((product: any) => product.Product === productName);
const searchConfig = ({
darwin: {platform: 'MacOS', arch: 'universal', artifact: 'pkg'},
win32: {platform: 'Windows', arch: os.arch() === 'x64' ? 'x64' : 'x86', artifact: 'msi'},
} as any)[platform];
const release = searchConfig ? product.Releases.find((release: any) => release.Platform === searchConfig.platform && release.Architecture === searchConfig.arch) : null;
const artifact = release ? release.Artifacts.find((artifact: any) => artifact.ArtifactName === searchConfig.artifact) : null;
if (artifact)
scriptArgs.push(artifact.Location /* url */);
} else if (platform === 'darwin') {
const release = stable.Releases.find((release: any) => release.Platform === 'MacOS' && release.Architecture === 'universal');
const artifact = release.Artifacts.find((artifact: any) => artifact.ArtifactName === 'pkg');
scriptArgs.push(artifact.Location /* url */);
} else {
else
throw new Error(`Cannot install ${ChannelName[channel]} on ${platform}`);
}
}
const shell = scriptName.endsWith('.ps1') ? 'powershell.exe' : 'bash';

View File

@ -36,6 +36,7 @@ function linux(channel: string): string[] | undefined {
case 'chrome-beta': return ['/opt/google/chrome-beta/chrome'];
case 'chrome-dev': return ['/opt/google/chrome-unstable/chrome'];
case 'msedge-dev': return ['/opt/microsoft/msedge-dev/msedge'];
case 'msedge-beta': return ['/opt/microsoft/msedge-beta/msedge'];
}
}

View File

@ -147,29 +147,3 @@ it('Page.bringToFront should work', async ({browserType, browserOptions}) => {
await browser.close();
});
it('focused input should produce the same screenshot', async ({browserType, browserOptions, browserName, platform, channel}, testInfo) => {
it.fail(channel === 'msedge' && platform === 'darwin', 'focus ring is black on MSEdge');
it.fail(browserName === 'firefox' && platform === 'darwin', 'headless has thinner outline');
it.fail(browserName === 'firefox' && platform === 'linux', 'headless has no outline');
it.skip(browserName === 'webkit' && platform === 'linux', 'gtk vs wpe');
it.skip(!!process.env.CRPATH);
testInfo.snapshotSuffix = platform;
const headful = await browserType.launch({...browserOptions, headless: false });
const headfulPage = await headful.newPage();
await headfulPage.setContent('<input>');
await headfulPage.focus('input');
const headfulScreenshot = await headfulPage.screenshot();
await headful.close();
const headless = await browserType.launch({...browserOptions, headless: true });
const headlessPage = await headless.newPage();
await headlessPage.setContent('<input>');
await headlessPage.focus('input');
const headlessScreenshot = await headlessPage.screenshot();
await headless.close();
expect(headfulScreenshot).toMatchSnapshot('focused-input.png');
expect(headlessScreenshot).toMatchSnapshot('focused-input.png');
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB