Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
feat: install media pack on windows with `npx playwright install-deps` (#6836)
Andrey Lushnikov17b6f06b9895
diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.ymlindex ad923734de..ef9d24cefa 100644--- a/.github/workflows/tests_secondary.yml+++ b/.github/workflows/tests_secondary.yml@@ -85,9 +85,6 @@ jobs:browser: [chromium, firefox, webkit]runs-on: windows-lateststeps:- - name: Install Media Pack- shell: powershell- run: Install-WindowsFeature Server-Media-Foundation- uses: actions/checkout@v2- uses: actions/setup-node@v2with:@@ -222,9 +219,6 @@ jobs:name: "Chrome Stable (Win)"runs-on: windows-lateststeps:- - name: Install Media Pack- shell: powershell- run: Install-WindowsFeature Server-Media-Foundation- uses: actions/checkout@v2- uses: actions/setup-node@v2with:@@ -302,9 +296,6 @@ jobs:name: "Firefox Stable (Win)"runs-on: windows-lateststeps:- - name: Install Media Pack- shell: powershell- run: Install-WindowsFeature Server-Media-Foundation- uses: actions/checkout@v2- uses: actions/setup-node@v2with:@@ -313,6 +304,7 @@ jobs:env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1- run: npm run build+ - run: node lib/cli/cli install-deps chromium- run: node lib/cli/cli install firefox-stable chromium- run: npm run ftestshell: bash@@ -355,9 +347,6 @@ jobs:name: "Edge Stable (Win)"runs-on: windows-lateststeps:- - name: Install Media Pack- shell: powershell- run: Install-WindowsFeature Server-Media-Foundation- uses: actions/checkout@v2- uses: actions/setup-node@v2with:@@ -409,9 +398,6 @@ jobs:runs-on: windows-lateststeps:- uses: actions/checkout@v2- - name: Install Media Pack- shell: powershell- run: Install-WindowsFeature Server-Media-Foundation- uses: actions/setup-node@v2with:node-version: 12diff --git a/bin/install_media_pack.ps1 b/bin/install_media_pack.ps1new file mode 100644index 0000000000..7812422d5f--- /dev/null+++ b/bin/install_media_pack.ps1@@ -0,0 +1 @@+Install-WindowsFeature Server-Media-Foundationdiff --git a/src/install/installDeps.ts b/src/install/installDeps.tsindex cc858db735..2badc4cc80 100644--- a/src/install/installDeps.ts+++ b/src/install/installDeps.ts@@ -16,15 +16,27 @@import childProcess from 'child_process';import os from 'os';+import path from 'path';import { getUbuntuVersion } from '../utils/ubuntuVersion';+import * as utils from '../utils/utils';const { deps } = require('../nativeDeps');+const SCRIPTS_DIRECTORY = path.join(__dirname, '..', '..', 'bin');+export async function installDeps(browserTypes: string[]) {- if (os.platform() !== 'linux')- return;if (!browserTypes.length)browserTypes = ['chromium', 'firefox', 'webkit'];+ if (os.platform() === 'win32') {+ if (browserTypes.includes('chromium')) {+ const {code} = await utils.spawnAsync('powershell.exe', [path.join(SCRIPTS_DIRECTORY, 'install_media_pack.ps1')], { cwd: SCRIPTS_DIRECTORY, stdio: 'inherit' });+ if (code !== 0)+ throw new Error('Failed to install windows dependencies!');+ }+ return;+ }+ if (os.platform() !== 'linux')+ return;browserTypes.push('tools');const ubuntuVersion = await getUbuntuVersion();