Skip to content

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

feat: support msedge-dev installation (#7679)

Andrey Lushnikov865aff8c9d7b
diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml
index e193105d42..458b61967f 100644
--- a/.github/workflows/tests_primary.yml
+++ b/.github/workflows/tests_primary.yml
@@ -66,3 +66,75 @@ jobs:
- run: node lib/cli/cli install-deps
- run: node lib/cli/cli install
- run: npm run ttest
+
+ edge_dev_mac:
+ name: "Edge Dev (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-dev
+ - run: npm run ctest
+ env:
+ PWTEST_CHANNEL: msedge-dev
+ - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
+ if: always()
+ - uses: actions/upload-artifact@v1
+ if: ${{ always() }}
+ with:
+ name: msedge-dev-mac-test-results
+ path: test-results
+
+ edge_dev_win:
+ name: "Edge Dev (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-dev
+ - run: npm run ctest
+ shell: bash
+ env:
+ PWTEST_CHANNEL: msedge-dev
+ - uses: actions/upload-artifact@v1
+ if: ${{ always() }}
+ with:
+ name: edge-dev-win-test-results
+ path: test-results
+
+ edge_dev_linux:
+ name: "Edge Dev (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-dev
+ - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run ctest
+ env:
+ PWTEST_CHANNEL: msedge-dev
+ - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
+ if: always()
+ - uses: actions/upload-artifact@v1
+ if: ${{ always() }}
+ with:
+ name: edge-dev-linux-test-results
+ path: test-results
+
diff --git a/bin/reinstall_msedge_beta_win.ps1 b/bin/reinstall_msedge_beta_win.ps1
index b7498688b3..253e4eee92 100644
--- a/bin/reinstall_msedge_beta_win.ps1
+++ b/bin/reinstall_msedge_beta_win.ps1
@@ -10,7 +10,7 @@ $arguments = "/i `"$msiInstaller`" /quiet"
Start-Process msiexec.exe -ArgumentList $arguments -Wait
Remove-Item $msiInstaller
-$suffix = "\\Microsoft\\Edge\\Application\\msedge.exe"
+$suffix = "\\Microsoft\\Edge Beta\\Application\\msedge.exe"
if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
(Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
diff --git a/bin/reinstall_msedge_dev_linux.sh b/bin/reinstall_msedge_dev_linux.sh
new file mode 100755
index 0000000000..d5d292e805
--- /dev/null
+++ b/bin/reinstall_msedge_dev_linux.sh
@@ -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-dev[[:space:]]*install$" >/dev/null; then
+ $maybesudo apt-get remove -y microsoft-edge-dev
+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-dev
+
+microsoft-edge-dev --version
diff --git a/bin/reinstall_msedge_dev_mac.sh b/bin/reinstall_msedge_dev_mac.sh
new file mode 100755
index 0000000000..e97ff97331
--- /dev/null
+++ b/bin/reinstall_msedge_dev_mac.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e
+set -x
+
+cd /tmp
+curl -o ./msedge_dev.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_dev.pkg -target /
+rm -rf /tmp/msedge_dev.pkg
+/Applications/Microsoft\ Edge\ Dev.app/Contents/MacOS/Microsoft\ Edge\ Dev --version
diff --git a/bin/reinstall_msedge_dev_win.ps1 b/bin/reinstall_msedge_dev_win.ps1
new file mode 100644
index 0000000000..9601d4d6a1
--- /dev/null
+++ b/bin/reinstall_msedge_dev_win.ps1
@@ -0,0 +1,21 @@
+$url = $args[0]
+
+Write-Host "Downloading Microsoft Edge Dev"
+$wc = New-Object net.webclient
+$msiInstaller = "$env:temp\microsoft-edge-dev.msi"
+$wc.Downloadfile($url, $msiInstaller)
+
+Write-Host "Installing Microsoft Edge Dev"
+$arguments = "/i `"$msiInstaller`" /quiet"
+Start-Process msiexec.exe -ArgumentList $arguments -Wait
+Remove-Item $msiInstaller
+
+$suffix = "\\Microsoft\\Edge Dev\\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
+}
diff --git a/src/utils/registry.ts b/src/utils/registry.ts
index 76e2a49fd4..68334239d9 100644
--- a/src/utils/registry.ts
+++ b/src/utils/registry.ts
@@ -340,7 +340,11 @@ export class Registry {
'linux': '/opt/microsoft/msedge-dev/msedge',
'darwin': '/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev',
'win32': `\\Microsoft\\Edge Dev\\Application\\msedge.exe`,
- }));
+ }, () => this._installMSEdgeChannel('msedge-dev', {
+ 'darwin': 'reinstall_msedge_dev_mac.sh',
+ 'linux': 'reinstall_msedge_dev_linux.sh',
+ 'win32': 'reinstall_msedge_dev_win.ps1',
+ })));
this._executables.push(this._createChromiumChannel('msedge-canary', {
'linux': '',
@@ -561,11 +565,15 @@ export class Registry {
await fs.promises.writeFile(markerFilePath(descriptor.dir), '');
}
- private async _installMSEdgeChannel(channel: string, scripts: Record<'linux' | 'darwin' | 'win32', string>) {
+ private async _installMSEdgeChannel(channel: 'msedge'|'msedge-beta'|'msedge-dev', scripts: Record<'linux' | 'darwin' | 'win32', string>) {
const scriptArgs: string[] = [];
if (process.platform !== 'linux') {
const products = JSON.parse(await fetchData('https://edgeupdates.microsoft.com/api/products'));
- const productName = channel === 'msedge' ? 'Stable' : 'Beta';
+ const productName = {
+ 'msedge': 'Stable',
+ 'msedge-beta': 'Beta',
+ 'msedge-dev': 'Dev',
+ }[channel];
const product = products.find((product: any) => product.Product === productName);
const searchConfig = ({
darwin: {platform: 'MacOS', arch: 'universal', artifact: 'pkg'},