<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.31.2]</li>
<li>Operating System: [Windows 11]</li>
<li>Browser: [All, Chromium, Firefox, WebKit]</li>
</ul>
<p dir="auto"><strong>Steps</strong><br>
Let's suppose we have 10 test files -</p>
<p dir="auto">Test File 1 - 2 tests<br>
Test File 2 - 10 tests<br>
Test File 3 - 10 tests<br>
Test File 4 - 1 tests<br>
Test File 5 - 1 tests<br>
Test File 6 - 2 tests<br>
Test File 7 - 1 tests<br>
Test File 8 - 1 tests<br>
Test File 9 - 1 tests<br>
Test File 10 - 1 tests</p>
<p dir="auto">Now if we are executing the tests using 3 / 4 shards, ~equal number tests are not getting executed for each shard and it's causing a huge problem for us as we are having 1000+ cases across ~180 files. We are currently using 6 shards, but we see huge number of tests difference for each shard when using latest playwright 1.31.2.</p>
<p dir="auto">Observed the comment from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1601082867" data-permission-text="Title is private" data-url="https://github.com/microsoft/playwright/issues/21226" data-hovercard-type="issue" data-hovercard-url="/microsoft/playwright/issues/21226/hovercard" href="https://github.com/microsoft/playwright/issues/21226">#21226</a> that, with new playwright version sharding will be performed on test files.</p>
<p dir="auto">But I believe, it may cause a big problem for existing projects / new projects, where some feature may have more number of tests than other features. And every time, it will be very difficult for maintaining the count of tests in the test files from user side and instead I believe it should be automatically handled by the playwright framework itself as maintaining / re-factoring tests numbers for each test file will be a big challenge, where multiple users will be working on the repository.</p>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">Playwright sharding should divide the tests ~equally for each shard by the playwright framework itself and user don't need to maintain the framework seperately.</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">Playwright sharding is not dividing the tests ~equally for each shard when using 1.31.2.</p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.31.2, v1.30.0]</li>
<li>Operating System: [Ubuntu 20.04, Ubuntu 22.04]</li>
<li>Browser: [WebKit]</li>
<li>Other info: Works as expected on macOS</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>Link to the GitHub repository with the repro</strong><br>
I have created <a href="https://github.com/terryknowlton/double-goto-webkit-crash-linux">this repo </a> with an example test that reproduces the bug. I have also provided the test snippet below.</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { test } from '@playwright/test';

test('test', async ({ page }) =&gt; {
  await page.goto('https://mail.google.com/');
  await page.goto('https://mail.google.com/');
  await page.goto('https://github.com');
  await page.goto('https://github.com');
  await page.goto('https://www.disneyplus.com/account');
  await page.goto('https://www.disneyplus.com/account');
  await page.goto('https://app.mabl.com');
  await page.goto('https://app.mabl.com');
});"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">test</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'@playwright/test'</span><span class="pl-kos">;</span>

<span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">'test'</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-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">'https://mail.google.com/'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">'https://mail.google.com/'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">'https://github.com'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">'https://github.com'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">'https://www.disneyplus.com/account'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">'https://www.disneyplus.com/account'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">'https://app.mabl.com'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">'https://app.mabl.com'</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>Steps</strong></p>
<ul dir="auto">
<li>Run the test on Ubuntu 22.04 or 20.04</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<ul dir="auto">
<li>Test passes on all three browsers (WebKit, Chromium, Firefox)</li>
</ul>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">WebKit test fails with a browser crash on the second <code class="notranslate">await page.goto('https://app.mabl.com')</code> call but none of the other addresses.</p>