<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: v1.33</li>
<li>Operating System: Ubuntu 22.04</li>
<li>Browser: WebKit-1837</li>
<li>Other info: CodeceptJS 3.4.1 with Playwright helper</li>
</ul>
<p dir="auto"><strong>Steps</strong><br>
Unfortunately I'm not able to reproduce reliably. But it <strong>never</strong> happens with Playwright 1.32<br>
It crashes on random places in various CodeceptJS tests, mostly when clicking on a button or on a sidebar menu item in our application.<br>
It crashes in 100% of cases in the following test.</p>
<p dir="auto"><strong>Example:</strong> (it's a CodeceptJS log with <code class="notranslate">DEBUG=*browser*</code>, but no browser message is shown near the crash)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2023-05-03T12:39:03.447Z pw:browser &lt;launching&gt; /home/node/ms-playwright/webkit-1837/pw_run.sh --inspector-pipe --headless --no-startup-window
2023-05-03T12:39:03.471Z pw:browser &lt;launched&gt; 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 &quot;DND_Player_Correct_Target_Position&quot;, 
[2.dev:webkit]       I wait for invisible .dimmed .loader
[2.dev:webkit]       I take screenshot &quot;DND_Player_Correct_Target_Position_webkit_headless&quot;, &quot;actual&quot;, &quot;.content .konvajs-content&quot;
[2.dev:webkit]       I check visual differences &quot;DND_Player_Correct_Target_Position_webkit_headless&quot;
[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 &quot;Continue&quot; button
[2.dev:webkit]     I click &quot;.content .konvajs-content&quot;, , {&quot;position&quot;:{&quot;x&quot;:469,&quot;y&quot;:483}}
[2.dev:webkit]  › &lt;screenshotOnFail&gt; 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]  › &lt;Error: page.screenshot: Target crashed
=========================== logs ===========================
taking page screenshot
============================================================&gt; 
[2.dev:webkit]   ✖ FAILED in 50111ms
...
[2.dev:webkit]  › &lt;screenshotOnFail&gt; 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]  › &lt;Error: page.screenshot: Target crashed
=========================== logs ===========================
taking page screenshot
============================================================&gt; 
[2.dev:webkit]   ✖ FAILED in 50111ms

..."><pre class="notranslate"><code class="notranslate">2023-05-03T12:39:03.447Z pw:browser &lt;launching&gt; /home/node/ms-playwright/webkit-1837/pw_run.sh --inspector-pipe --headless --no-startup-window
2023-05-03T12:39:03.471Z pw:browser &lt;launched&gt; 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]  › &lt;screenshotOnFail&gt; 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]  › &lt;Error: page.screenshot: Target crashed
=========================== logs ===========================
taking page screenshot
============================================================&gt; 
[2.dev:webkit]   ✖ FAILED in 50111ms
...
[2.dev:webkit]  › &lt;screenshotOnFail&gt; 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]  › &lt;Error: page.screenshot: Target crashed
=========================== logs ===========================
taking page screenshot
============================================================&gt; 
[2.dev:webkit]   ✖ FAILED in 50111ms

...
</code></pre></div>
<p dir="auto">A test result summary with a stack:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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(&quot;.content .konvajs-content&quot;, , {&quot;position&quot;:{&quot;x&quot;:469,&quot;y&quot;:483}}) at Test.&lt;anonymous&gt; (./authorTemplates/AuthorTemplateDndGame_test.ts:231:7)
  - I.wait(1) at Test.&lt;anonymous&gt; (./authorTemplates/AuthorTemplateDndGame_test.ts:229:7)"><pre class="notranslate"><code class="notranslate">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.&lt;anonymous&gt; (./authorTemplates/AuthorTemplateDndGame_test.ts:231:7)
  - I.wait(1) at Test.&lt;anonymous&gt; (./authorTemplates/AuthorTemplateDndGame_test.ts:229:7)
</code></pre></div>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: 1.34.3</li>
<li>Operating System: N/A</li>
<li>Browser: N/A</li>
<li>Other info:</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I provided exact source code that allows reproducing the issue locally.</li>
</ul>




<p dir="auto"><strong>Config file</strong></p>
<p dir="auto">N/A</p>
<p dir="auto"><strong>Test file (self-contained)</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="test('has the correct title', async ({ page }) =&gt; {
  expect(
    // ❌ Oops, we forgot to `await`! This should be a type error.
    page.title(),
  ).toMatch(/foo/);
});"><pre class="notranslate"><span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">'has the correct title'</span><span class="pl-kos">,</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">{</span> page <span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-en">expect</span><span class="pl-kos">(</span>
    <span class="pl-c">// ❌ Oops, we forgot to `await`! This should be a type error.</span>
    <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">title</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
  <span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toMatch</span><span class="pl-kos">(</span><span class="pl-pds"><span class="pl-c1">/</span>foo<span class="pl-c1">/</span></span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">A type error.</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">There is no type error.</p>
<hr>
<p dir="auto">One way to fix this would be to change the type of the <code class="notranslate">Expect</code> signature as follows:</p>
<div class="highlight highlight-source-diff notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" export type Expect = {
-  &lt;T = unknown&gt;(actual: T, messageOrOptions?: string | { message?: string }): MakeMatchers&lt;void, T&gt;;
+  &lt;T = unknown&gt;(actual: T extends Promise&lt;any&gt; ? never : T, messageOrOptions?: string | { message?: string }): MakeMatchers&lt;void, T&gt;;"><pre class="notranslate"> export type Expect = {
<span class="pl-md"><span class="pl-md">-</span>  &lt;T = unknown&gt;(actual: T, messageOrOptions?: string | { message?: string }): MakeMatchers&lt;void, T&gt;;</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>  &lt;T = unknown&gt;(actual: T extends Promise&lt;any&gt; ? never : T, messageOrOptions?: string | { message?: string }): MakeMatchers&lt;void, T&gt;;</span></pre></div>
<p dir="auto">I'm not sure if this has other implications though.</p>