Issue 1:
Playwright transpiles test files with Babel. However, by default, Babel reads browserslist config although Playwright actually doesn't need it. This introduces conflicts when the root project uses browserslist.

For example, when the package.json contains:

"browserslist": [
"chrome 113"
],

Running npx playwright test with Playwright 1.32 will get Error: Unknown version 113 of chrome. To fix the issue, we have to upgrade Playwright to 1.33. This behavior forces us to always upgrade Playwright if we want to specify some latest browser versions in browserslist config even if our root project depends on the latest version of browserslist.

To fix this issue, the following change works for me:

diff --git a/packages/playwright-test/bundles/babel/src/babelBundleImpl.ts b/packages/playwright-test/bundles/babel/src/babelBundleImpl.ts
index 0f4ab2979..2a9b24624 100644
--- a/packages/playwright-test/bundles/babel/src/babelBundleImpl.ts
+++ b/packages/playwright-test/bundles/babel/src/babelBundleImpl.ts
@@ -76,6 +76,7 @@ function babelTransformOptions(isTypeScript: boolean, isModule: boolean, plugins
}

return {
+ browserslistConfigFile: false,
babelrc: false,
configFile: false,
assumptions: {

System info

Playwright Version: 1.33.0

Operating System: macOS 13

Browser: All

Source code

package.json:

{
"name": "playwright-babel-demo",
"browserslist": [
"chrome 119"
],
"devDependencies": {
"@playwright/test": "^1.33.0"
}
}

tests/test.spec.ts

import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/);
});

Steps

Create the two files as listed above.

Run npx playwright test.

Expected

The tests run successfully.

Actual

It shows an error:

$ npx playwright test

Error: Unknown version 119 of chrome

Error: No tests found

Issue 2:
System info

Playwright Version: 1.31.2

Source code

I provided exact source code that allows reproducing the issue locally.

Repo

name: Playwright Tests
on:
push:
branches:
- main

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 6.32.9
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
env:
NEXT_PUBLIC_API_BASE_URL: ${{ secrets.NEXT_PUBLIC_API_BASE_URL }}
API_KEY: ${{ secrets.API_KEY }}
run: pnpm exec playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30

import { defineConfig, devices } from '@playwright/test'
import dotenv from 'dotenv'
import path from 'path'

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
require('dotenv').config()

// Alternatively, read from "../my.env" file.
dotenv.config({ path: path.resolve(__dirname, '.env.local') })

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './src/tests/e2e/',
/* Maximum time one test can run for. */
timeout: 30 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 5000,
},
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://localhost:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { channel: 'chrome' },
// },
],

/* Folder for test artifacts such as screenshots, videos, traces, etc. */
// outputDir: 'test-results/',

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// port: 3000,
// },
})

Expected

Test should pass

Actual

Passing tests locally