<h3 dir="auto">Context</h3>
<ul dir="auto">
<li>Playwright Version: 1.32.1</li>
<li>Operating System: Windows 11</li>
<li>Node.js Version: v18.14.0</li>
<li>Browser: Firefox</li>
</ul>
<h3 dir="auto">Test Repro</h3>
<p dir="auto">A repro can be found below to reproduce the issue in question. The issue is intermittent, thus the test is contained within a for loop for greater chance of the failure occurring. About 25 iterations will usually yield at least one test that comes across this issue, however should the failure in question not occur, you can increase the chances of the issue occurring by increasing the iteration count or simply rerunning the tests.</p>
<p dir="auto"><a href="https://github.com/microsoft/playwright/files/11109426/FirefoxRepro.zip">FirefoxRepro.zip</a></p>
<p dir="auto">The project contains 25 identical tests, wrapped in a for loop and located in the directory: <em>tests &gt; repro.spec.ts</em>. The tests are very simple, consisting of two steps:</p>
<ol dir="auto">
<li>Navigate to <a href="https://www.google.co.uk/" rel="nofollow">https://www.google.co.uk/</a>.</li>
<li>Close the page.</li>
</ol>
<h3 dir="auto">Code Snippet</h3>
<h4 dir="auto">repro.spec.ts</h4>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { test } from '@playwright/test';

test.describe('Repro', async () =&gt; {
    for (let i = 1; i &lt;= 25; i++) {
        test(`Test ${i}`, async ({ page }) =&gt; {
            await page.goto('https://www.google.co.uk/');
            await page.close();
        });
    }
});"><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-s1">test</span><span class="pl-kos">.</span><span class="pl-en">describe</span><span class="pl-kos">(</span><span class="pl-s">'Repro'</span><span class="pl-kos">,</span> <span class="pl-k">async</span> <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">for</span> <span class="pl-kos">(</span><span class="pl-k">let</span> <span class="pl-s1">i</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span> <span class="pl-s1">i</span> <span class="pl-c1">&lt;=</span> <span class="pl-c1">25</span><span class="pl-kos">;</span> <span class="pl-s1">i</span><span class="pl-c1">++</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">`Test <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">i</span><span class="pl-kos">}</span></span>`</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://www.google.co.uk/'</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">close</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-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h4 dir="auto">playwright.config.ts</h4>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  testDir: './tests',
  fullyParallel: true,
  workers: 5,
  timeout: 60 * 1000,
  reporter: 'html',

  use: {
    headless: false,
    trace: 'on',
  },

  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },

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

    {
      name: 'webkit',
      use: { ...devices['Desktop Safari'] },
    },
  ],
});"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">defineConfig</span><span class="pl-kos">,</span> <span class="pl-s1">devices</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-k">export</span> <span class="pl-k">default</span> <span class="pl-en">defineConfig</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">testDir</span>: <span class="pl-s">'./tests'</span><span class="pl-kos">,</span>
  <span class="pl-c1">fullyParallel</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
  <span class="pl-c1">workers</span>: <span class="pl-c1">5</span><span class="pl-kos">,</span>
  <span class="pl-c1">timeout</span>: <span class="pl-c1">60</span> <span class="pl-c1">*</span> <span class="pl-c1">1000</span><span class="pl-kos">,</span>
  <span class="pl-c1">reporter</span>: <span class="pl-s">'html'</span><span class="pl-kos">,</span>

  <span class="pl-c1">use</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">headless</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-c1">trace</span>: <span class="pl-s">'on'</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>

  <span class="pl-c1">projects</span>: <span class="pl-kos">[</span>
    <span class="pl-kos">{</span>
      <span class="pl-c1">name</span>: <span class="pl-s">'chromium'</span><span class="pl-kos">,</span>
      <span class="pl-c1">use</span>: <span class="pl-kos">{</span> ...<span class="pl-s1">devices</span><span class="pl-kos">[</span><span class="pl-s">'Desktop Chrome'</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-kos">{</span>
      <span class="pl-c1">name</span>: <span class="pl-s">'firefox'</span><span class="pl-kos">,</span>
      <span class="pl-c1">use</span>: <span class="pl-kos">{</span> ...<span class="pl-s1">devices</span><span class="pl-kos">[</span><span class="pl-s">'Desktop Firefox'</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-kos">{</span>
      <span class="pl-c1">name</span>: <span class="pl-s">'webkit'</span><span class="pl-kos">,</span>
      <span class="pl-c1">use</span>: <span class="pl-kos">{</span> ...<span class="pl-s1">devices</span><span class="pl-kos">[</span><span class="pl-s">'Desktop Safari'</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-kos">]</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">Describe the bug</h3>
<p dir="auto">Firefox intermittently fails when attempting to close the page and browserContext. The page never closes and hangs until eventually hitting the test timeout threshold and consequently failing the test. The repro uses a test timeout of 60 seconds, however the issue occurs with a test timeout of 4 minutes too. This issue only appears to affect Firefox; I am yet to encounter the problem using Webkit and Chromium.</p>
<p dir="auto">It should be noted that the issue occurs when running tests in parallel. In my case, the project is configured to use 5 workers. I am yet to see the issue when running the tests sequentially.</p>
<p dir="auto">A screenshot of the report can be found below, which shows the test failing to close the page, as well as the browserContext. My lack of domain knowledge prevents me from being able to produce a trace, as no trace is generated when the test fails for this reason.</p>
<table role="table">
<thead>
<tr>
<th align="center"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/110672482/228777822-3560c8ad-90f3-4515-a9f7-e028ec121799.png"><img src="https://user-images.githubusercontent.com/110672482/228777822-3560c8ad-90f3-4515-a9f7-e028ec121799.png" alt="FirefoxRepro_TestSteps" style="max-width: 100%;"></a></th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">Failing Steps Report</td>
</tr>
</tbody>
</table>
<p dir="auto">Thanks for any help or guidance in advance! This is my first BUG REPORT, so go easy on me should I have missed out any vital information.</p>
<p dir="auto">Hi Iam currenlty using Playwright Test Framework with Node.js:<br>
How can i run the below mentioned scripts with RunA &amp; RunB from package.json which is having different cross-env plugin value. Currently the only way iam seeing is to run it differently and generate reports separate. But how can i run both the scripts at the same time and get all the data in one html report only.</p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.35]</li>
<li>Operating System: [All, Windows 11, Ubuntu 20, macOS 13.2, etc.]</li>
<li>Browser: [All, Chromium, Firefox, WebKit]</li>
<li>Other info:</li>
</ul>
<h3 dir="auto">Source code</h3>
<p dir="auto">Scripts:{<br>
Run1:'cross-env plugin=org.CompA npx playwright test feature-a.spec.js',<br>
Run2:'cross-env plugin=org.CompB npx playwright test feature-b.spec.js'<br>
}</p>
<p dir="auto"><strong>Link to the GitHub repository with the repro</strong></p>
<p dir="auto">[https://github.com/your_profile/playwright_issue_title]</p>