Issue 1:
System info

Playwright Version: v1.33

Operating System: Ubuntu 22.04

Browser: WebKit-1837

Other info: CodeceptJS 3.4.1 with Playwright helper

Steps

Unfortunately I'm not able to reproduce reliably. But it never happens with Playwright 1.32

It crashes on random places in various CodeceptJS tests, mostly when clicking on a button or on a sidebar menu item in our application.

It crashes in 100% of cases in the following test.

Example: (it's a CodeceptJS log with DEBUG=*browser*, but no browser message is shown near the crash)

2023-05-03T12:39:03.447Z pw:browser <launching> /home/node/ms-playwright/webkit-1837/pw_run.sh --inspector-pipe --headless --no-startup-window
2023-05-03T12:39:03.471Z pw:browser <launched> pid=3696
2023-05-03T12:39:03.599Z pw:browser [pid=3696][err] Could not determine the accessibility bus address
...
[2.dev:webkit] konvajsFragment: verifyGameArea "DND_Player_Correct_Target_Position",
[2.dev:webkit] I wait for invisible .dimmed .loader
[2.dev:webkit] I take screenshot "DND_Player_Correct_Target_Position_webkit_headless", "actual", ".content .konvajs-content"
[2.dev:webkit] I check visual differences "DND_Player_Correct_Target_Position_webkit_headless"
[2.dev:webkit] › Check differences in DND_Player_Correct_Target_Position_webkit_headless ...
[2.dev:webkit] › Load image from /home/node/workspace/tests/s4w/output/dev_webkit_2/DND_Player_Correct_Target_Position_webkit_headless.png ...
[2.dev:webkit] › Load image from /home/node/workspace/tests/s4w/screenshots/base/DND_Player_Correct_Target_Position_webkit_headless.png ...
[2.dev:webkit] › Difference: 0% | 0 / 679662 pixels
[2.dev:webkit] ✔ OK in 7263ms
[2.dev:webkit]
[2.dev:webkit] Leave the game
[2.dev:webkit] I wait 1
ERROR: Page has crashed, closing page!
ERROR: Page has crashed, closing page!
[2.dev:webkit] Click "Continue" button
[2.dev:webkit] I click ".content .konvajs-content", , {"position":{"x":469,"y":483}}
[2.dev:webkit] › <screenshotOnFail> Test failed, try to save a screenshot
[2.dev:webkit] › Screenshot is saving to /home/node/workspace/tests/s4w/output/dev_webkit_2/Leave_the__33370790-4a74-4f65-956b-6c8024a7d3d1.failed.png
[2.dev:webkit] › <Error: page.screenshot: Target crashed
=========================== logs ===========================
taking page screenshot
============================================================>
[2.dev:webkit] ✖ FAILED in 50111ms
...
[2.dev:webkit] › <screenshotOnFail> Test failed, try to save a screenshot
[2.dev:webkit] › Screenshot is saving to /home/node/workspace/tests/s4w/output/dev_webkit_2/Leave_the__33370790-4a74-4f65-956b-6c8024a7d3d1.failed.png
[2.dev:webkit] › <Error: page.screenshot: Target crashed
=========================== logs ===========================
taking page screenshot
============================================================>
[2.dev:webkit] ✖ FAILED in 50111ms

...

A test result summary with a stack:

1) AuthorTemplateDndGame
Leave the game:
page.$$: Target crashed
at Playwright.findElements (/home/node/workspace/node_modules/.pnpm/codeceptjs@3.4.1_o7lr63vpga6ylgrc3jy4rl4bhq/node_modules/codeceptjs/lib/helper/Playwright.js:2561:18)
at Playwright.findClickable (/home/node/workspace/node_modules/.pnpm/codeceptjs@3.4.1_o7lr63vpga6ylgrc3jy4rl4bhq/node_modules/codeceptjs/lib/helper/Playwright.js:2611:47)
at Playwright.proceedClick (/home/node/workspace/node_modules/.pnpm/codeceptjs@3.4.1_o7lr63vpga6ylgrc3jy4rl4bhq/node_modules/codeceptjs/lib/helper/Playwright.js:2584:35)

Scenario Steps:
- I.click(".content .konvajs-content", , {"position":{"x":469,"y":483}}) at Test.<anonymous> (./authorTemplates/AuthorTemplateDndGame_test.ts:231:7)
- I.wait(1) at Test.<anonymous> (./authorTemplates/AuthorTemplateDndGame_test.ts:229:7)

Issue 2:
System info

Playwright Version: 1.34.3

Operating System: N/A

Browser: N/A

Other info:

Source code

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

Config file

N/A

Test file (self-contained)

test('has the correct title', async ({ page }) => {
expect(
// ❌ Oops, we forgot to `await`! This should be a type error.
page.title(),
).toMatch(/foo/);
});

Expected

A type error.

Actual

There is no type error.

One way to fix this would be to change the type of the Expect signature as follows:

export type Expect = {
- <T = unknown>(actual: T, messageOrOptions?: string | { message?: string }): MakeMatchers<void, T>;
+ <T = unknown>(actual: T extends Promise<any> ? never : T, messageOrOptions?: string | { message?: string }): MakeMatchers<void, T>;

I'm not sure if this has other implications though.