Skip to content

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

chore: relax npm version constraint in installation tests (#16427)

Ross Wollmana3836de1823f
diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml
index abfb285e3b..b49d374c93 100644
--- a/.github/workflows/tests_primary.yml
+++ b/.github/workflows/tests_primary.yml
@@ -176,7 +176,7 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
- - run: npm i -g [email protected] # This should NOT be pinned beyond major version once https://github.com/microsoft/playwright/issues/16281 is resolved.
+ - run: npm i -g npm@8
- run: npm ci
env:
DEBUG: pw:install
diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml
index 08f99d75aa..26a4feb39b 100644
--- a/.github/workflows/tests_secondary.yml
+++ b/.github/workflows/tests_secondary.yml
@@ -128,7 +128,7 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
- - run: npm i -g [email protected] # This should NOT be pinned beyond major version once https://github.com/microsoft/playwright/issues/16281 is resolved.
+ - run: npm i -g npm@8
- run: npm ci
env:
DEBUG: pw:install
diff --git a/tests/installation/npx-global-help.spec.ts b/tests/installation/npx-global-help.spec.ts
index 154104d420..ba8d68fed8 100755
--- a/tests/installation/npx-global-help.spec.ts
+++ b/tests/installation/npx-global-help.spec.ts
@@ -16,7 +16,7 @@
import { test, expect } from './npmTest';
test('npx playwright --help should not download browsers', async ({ exec, installedSoftwareOnDisk }) => {
- const result = await exec('npx playwright --help');
+ const result = await exec('npx playwright --help', { env: { npm_config_prefix: '' } }); // global npx and npm_config_prefix do not work together nicely (https://github.com/npm/cli/issues/5268)
expect(result).toHaveLoggedSoftwareDownload([]);
expect(await installedSoftwareOnDisk()).toEqual([]);
expect(result).not.toContain(`To avoid unexpected behavior, please install your dependencies first`);
diff --git a/tests/installation/npx-global-install.spec.ts b/tests/installation/npx-global-install.spec.ts
index 876a2d1186..0643903c09 100755
--- a/tests/installation/npx-global-install.spec.ts
+++ b/tests/installation/npx-global-install.spec.ts
@@ -17,7 +17,7 @@ import { test, expect } from './npmTest';
test('npx playwright install global', async ({ exec, installedSoftwareOnDisk }) => {
test.skip(process.platform === 'win32', 'isLikelyNpxGlobal() does not work in this setup on our bots');
- const result = await exec('npx playwright install');
+ const result = await exec('npx playwright install', { env: { npm_config_prefix: '' } }); // global npx and npm_config_prefix do not work together nicely (https://github.com/npm/cli/issues/5268)
expect(result).toHaveLoggedSoftwareDownload(['chromium', 'ffmpeg', 'firefox', 'webkit']);
expect(await installedSoftwareOnDisk()).toEqual(['chromium', 'ffmpeg', 'firefox', 'webkit']);
expect(result).not.toContain(`Please run the following command to download new browsers`);
diff --git a/tests/installation/npx-global-spec-codegen.spec.ts b/tests/installation/npx-global-spec-codegen.spec.ts
index 0bf1ccc151..ba0a7acf35 100755
--- a/tests/installation/npx-global-spec-codegen.spec.ts
+++ b/tests/installation/npx-global-spec-codegen.spec.ts
@@ -16,7 +16,7 @@
import { test, expect } from './npmTest';
test('npx playwright codegen', async ({ exec, installedSoftwareOnDisk }) => {
- const stdio = await exec('npx playwright codegen', { expectToExitWithError: true });
+ const stdio = await exec('npx playwright codegen', { expectToExitWithError: true, env: { npm_config_prefix: '' } }); // global npx and npm_config_prefix do not work together nicely (https://github.com/npm/cli/issues/5268)
expect(stdio).toHaveLoggedSoftwareDownload([]);
expect(await installedSoftwareOnDisk()).toEqual([]);
expect(stdio).toContain(`Please run the following command to download new browsers`);