<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.35.1]</li>
<li>Operating System: [macOS Ventura 13.0]</li>
<li>Browser: [All]</li>
<li>Other info: Nx monorepo, using <code class="notranslate">@nxkit/playwright</code> extension</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"> I provided exact source code that allows reproducing the issue locally.</li>
</ul>




<p dir="auto"><strong>Config file</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
    testDir: './src/e2e',
    retries: process.env.CI ? 2 : 0,
    maxFailures: 2,
    timeout: 30 * 1000,
    expect: {
      timeout: 5000,
    },
    use: {
      baseUrl: 'http://localhost:4200/',
      actionTimeout: 0,
      video: 'off',
      trace: 'off',
    },
    fullyParallel: true,
    forbidOnly: !!process.env.CI,
    workers: process.env.CI ? 1 : undefined,
    reporter: [
    ['html', { outputFolder: '../../.playwright/app-name' }],
    [
      'json',
      {
        outputFile: '../../.playwright/app-name/test-results.json',
      },
    ],
  ],
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'], },
    },
});"><pre class="notranslate"><span class="pl-c">// playwright.config.ts</span>
<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">'./src/e2e'</span><span class="pl-kos">,</span>
    <span class="pl-c1">retries</span>: <span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">env</span><span class="pl-kos">.</span><span class="pl-c1">CI</span> ? <span class="pl-c1">2</span> : <span class="pl-c1">0</span><span class="pl-kos">,</span>
    <span class="pl-c1">maxFailures</span>: <span class="pl-c1">2</span><span class="pl-kos">,</span>
    <span class="pl-c1">timeout</span>: <span class="pl-c1">30</span> <span class="pl-c1">*</span> <span class="pl-c1">1000</span><span class="pl-kos">,</span>
    <span class="pl-c1">expect</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">timeout</span>: <span class="pl-c1">5000</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">use</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">baseUrl</span>: <span class="pl-s">'http://localhost:4200/'</span><span class="pl-kos">,</span>
      <span class="pl-c1">actionTimeout</span>: <span class="pl-c1">0</span><span class="pl-kos">,</span>
      <span class="pl-c1">video</span>: <span class="pl-s">'off'</span><span class="pl-kos">,</span>
      <span class="pl-c1">trace</span>: <span class="pl-s">'off'</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</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">forbidOnly</span>: <span class="pl-c1">!</span><span class="pl-c1">!</span><span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">env</span><span class="pl-kos">.</span><span class="pl-c1">CI</span><span class="pl-kos">,</span>
    <span class="pl-c1">workers</span>: <span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">env</span><span class="pl-kos">.</span><span class="pl-c1">CI</span> ? <span class="pl-c1">1</span> : <span class="pl-c1">undefined</span><span class="pl-kos">,</span>
    <span class="pl-c1">reporter</span>: <span class="pl-kos">[</span>
    <span class="pl-kos">[</span><span class="pl-s">'html'</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">outputFolder</span>: <span class="pl-s">'../../.playwright/app-name'</span> <span class="pl-kos">}</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">[</span>
      <span class="pl-s">'json'</span><span class="pl-kos">,</span>
      <span class="pl-kos">{</span>
        <span class="pl-c1">outputFile</span>: <span class="pl-s">'../../.playwright/app-name/test-results.json'</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-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-kos"></span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Test file (self-contained)</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="it('should show homepage', async ({ page }) =&gt; {
  await page.goto(pageUrl);
  await page.screenshot({ path: 'folderOne/screenshot-name.png' }); // working fine
  await page.screenshot({ path: 'folderOne/folderTwo/screenshot-name.png' }); // not working
});"><pre class="notranslate"><span class="pl-en">it</span><span class="pl-kos">(</span><span class="pl-s">'should show homepage'</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-s1">pageUrl</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">screenshot</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">path</span>: <span class="pl-s">'folderOne/screenshot-name.png'</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// working fine</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">screenshot</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">path</span>: <span class="pl-s">'folderOne/folderTwo/screenshot-name.png'</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// not working</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]</li>
</ul>
<p dir="auto"><strong>Expected</strong><br>
The 1st screenshot is saved in <code class="notranslate">{root}/folderOne/screenshot-name.png</code>.<br>
The 2nd screenshot is saved in <code class="notranslate">{root}/folderOne/folderTwo/screenshot-name.png</code>.</p>
<p dir="auto"><strong>Actual</strong><br>
The 1st screenshot is saved in <code class="notranslate">{root}/folderOne/screenshot-name.png</code>.<br>
The 2nd screenshot is saved in <code class="notranslate">{root}</code>.</p>
<p dir="auto">Why is it not possible to save the screenshot in more than one layer of folders?<br>
The folder exists in the repo.</p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.34.3]</li>
<li>Operating System: [macOS 13.2.1]</li>
<li>Browser: [Chromium, Firefox]</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>




<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { test } from '@playwright/test';

test.describe('verify', async () =&gt; {
  test('test Case Name', async ({ page }) =&gt; {
    page.on('request', (request) =&gt; {
      if (request.method() === 'POST') {
        console.log(request.method());
        console.log(request.url());
        console.log(request.postData());
        console.log(request.postDataJSON());
        console.log(request.postDataBuffer());
      }
    });
    await page.goto('https://google.com');
    const inputs = await page.locator('[type=&quot;submit&quot;]').all();
    await inputs[3].click();
  });
});"><pre class="notranslate"><code class="notranslate">import { test } from '@playwright/test';

test.describe('verify', async () =&gt; {
  test('test Case Name', async ({ page }) =&gt; {
    page.on('request', (request) =&gt; {
      if (request.method() === 'POST') {
        console.log(request.method());
        console.log(request.url());
        console.log(request.postData());
        console.log(request.postDataJSON());
        console.log(request.postDataBuffer());
      }
    });
    await page.goto('https://google.com');
    const inputs = await page.locator('[type="submit"]').all();
    await inputs[3].click();
  });
});
</code></pre></div>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>[Run the test]</li>
</ul>
<p dir="auto"><strong>Expected</strong><br>
<code class="notranslate">postData</code> to return payload<br>
<code class="notranslate">postDataJSON</code> to return payload<br>
<code class="notranslate">postDataBuffer</code> to return payload</p>
<p dir="auto"><strong>Actual</strong><br>
returns null</p>
<p dir="auto">The test above returns null for <code class="notranslate">postDataJSON()</code> and for <code class="notranslate">postDataBuffer()</code> and for <code class="notranslate">postData()</code>. I also tried using page.WaitForRequest() to get the payload, but the same result, <code class="notranslate">null</code> instead of payload. I tried both Chromium and Firefox.</p>