Issue 1:
System info

Playwright Version: [v1.33.0]

Operating System: [M1 macOS 13.3.1 (a)]

Browser: [WebKit]

Other info:

This is sort of a 2 parter but I believe they are part of the same issue. When I run the test with Safari desktop, the test always fails because the after hook cannot close the browser context. When I run the test in debug mode I get the segmentation fault error. It doesn't happen every time but at least half the time it does.. The app I am testing should be in full-screen the whole time which I think contributes to this error. The test SHOULD be running headless but my test always runs Safari with the browser open. The example tests run Safari in headless mode without the browser. I have provided a repro repo and shown my files below. Lastly, I have tried increasing the timeout and that did not change anything.

I tried another test (different website) and it passes and runs headless no problem. I believe the key factor here may be that the browser becomes full-screen.

Error with npx playwright test:

Error with npx playwright test --debug:

Error: browserContext.close: Browser closed.
==================== Browser output: ====================
<launching> /Users/philipziolkowski/Library/Caches/ms-playwright/webkit-1837/pw_run.sh --inspector-pipe --no-startup-window
<launched> pid=36374
[pid=36374][err] Inspection is enabled by default for process or parent application with 'com.apple.security.get-task-allow' entitlement linked against old SDK. Use `inspectable` API to enable inspection on newer SDKs.
[pid=36374][err] /Users/philipziolkowski/Library/Caches/ms-playwright/webkit-1837/pw_run.sh: line 3: 36379 Bus error: 10 DYLD_FRAMEWORK_PATH="$DYLIB_PATH" DYLD_LIBRARY_PATH="$DYLIB_PATH" "$PLAYWRIGHT" "$@"

Source code

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

Link to the GitHub repository with the repro

[https://github.com/Zio-4/playwright-repro]

or

Config file

// playwright.config.ts
module.exports = defineConfig({
testDir: './tests/e2e',
/* 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: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1: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: 'webkit',
use: { ...devices['Desktop Safari'] },
},

});

Test file (self-contained)

test('should pass intros', async ({ page }) => {
await page.goto('https://roar-swr-demo.web.app/');
await page.getByRole('button', { name: 'Continue' }).click();
await page.getByText('Press ANY KEY to continue').press('ArrowRight');
await page.getByText('Press ANY KEY to continue').press('ArrowRight');
await page.getByText('Press ANY KEY to practice').press('ArrowRight');

const arrows = page.getByAltText('arrow-key')
expect(arrows).toBeDefined()
});

Steps

Created a new app with npx create-roar-app@latest my-roar-app (https://yeatmanlab.github.io/create-roar-app/developer-guide/installation/)

installed playwright with npm init playwright@latest

added e2e folder with test

ran npx playwright test and npx playwright test --debug

Expected

[Describe expected behavior]

For the normal test command I expect the test to pass (and run headless) and close the browser context.

For the debug test command I expect the test to pass and close the browser context.

Actual

For the normal test command, the test runs headfull (should be headless) and hangs at the end until the timeout occurs. It is in full-screen but the same happens out of full-screen.

For the debug test command the test passes and hangs on a black screen (due to being full-screen). Pressing escape runs the html report and shows the seg fault error.

Issue 2:
System info

Playwright Version: v1.32.1

Operating System: macOS 13.2

Browser: Chromium

Other info:

Source code

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

https://github.com/pdyck/short-link-management/blob/main/playwright.config.ts

Config file

// playwright.config.ts
import { defineConfig, devices } from "@playwright/test";

const baseURL = "http://localhost:3000";

export default defineConfig({
timeout: 30 * 1000,
testDir: "./tests",
testMatch: /.*\.e2e\.tsx?/,
retries: 2,

webServer: {
command: "yarn start",
timeout: 10 * 1000,
url: baseURL,
reuseExistingServer: false,
},

use: {
baseURL,
trace: "retry-with-trace",
},

projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
});

Test file (self-contained)

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

test("has title", async ({ page }) => {
await page.goto("/");

await expect(page).toHaveTitle(/Test/);
});

Steps

yarn playwright test

Expected

The web server starts and the tests run.

Actual

Playwright pings the baseURL until timeout and only starts the web server after that. Tested it with timeouts from 10s to 120s.

$ DEBUG=pw:webserver yarn playwright test
yarn run v1.22.19
$ .../node_modules/.bin/playwright test
pw:webserver HTTP GET: http://localhost:3000/ +0ms
pw:webserver Error while checking if http://localhost:3000/ is available: connect ECONNREFUSED ::1:3000 +309ms
pw:webserver Starting WebServer process yarn start... +0ms
pw:webserver Process started +16ms
pw:webserver Waiting for availability... +0ms
pw:webserver HTTP GET: http://localhost:3000/ +0ms
pw:webserver Error while checking if http://localhost:3000/ is available: connect ECONNREFUSED ::1:3000 +309ms
pw:webserver Waiting 100ms +0ms
pw:webserver HTTP GET: http://localhost:3000/ +101ms
pw:webserver Error while checking if http://localhost:3000/ is available: connect ECONNREFUSED ::1:80 +967ms
pw:webserver Waiting 250ms +0ms
pw:webserver HTTP GET: http://localhost:3000/ +253ms
pw:webserver Error while checking if http://localhost:3000/ is available: connect ECONNREFUSED ::1:80 +616ms
pw:webserver Waiting 500ms +1ms
pw:webserver HTTP GET: http://localhost:3000/ +501ms
pw:webserver Error while checking if http://localhost:3000/ is available: connect ECONNREFUSED ::1:80 +617ms
pw:webserver Waiting 1000ms +0ms
pw:webserver HTTP GET: http://localhost:3000/ +1s
pw:webserver Error while checking if http://localhost:3000/ is available: connect ECONNREFUSED ::1:80 +615ms
pw:webserver Waiting 1000ms +0ms
pw:webserver HTTP GET: http://localhost:3000/ +1s
pw:webserver Error while checking if http://localhost:3000/ is available: connect ECONNREFUSED ::1:80 +615ms
pw:webserver Waiting 1000ms +0ms
pw:webserver HTTP GET: http://localhost:3000/ +1s
pw:webserver Error while checking if http://localhost:3000/ is available: connect ECONNREFUSED ::1:80 +618ms
pw:webserver Waiting 1000ms +0ms
pw:webserver HTTP GET: http://localhost:3000/ +1s
pw:webserver Error while checking if http://localhost:3000/ is available: connect ECONNREFUSED ::1:80 +615ms
pw:webserver Waiting 1000ms +0ms
[WebServer] $ next start
[WebServer] ready - started server on 0.0.0.0:3000, url: http://localhost:3000
[WebServer] info - Loaded env from .../.env.local
Error: Timed out waiting 10000ms from config.webServer.

#16834