<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.32.2]</li>
<li>Operating System: [Windows10]</li>
<li>Browser: [Chromium]</li>
<li>Other info: Teamcity</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="import type { PlaywrightTestConfig } from '@playwright/test';
import { devices } from '@playwright/test';

/**
 * Read environment variables from file.
 * https://github.com/motdotla/dotenv
 */
// require('dotenv').config();

/**
 * See https://playwright.dev/docs/test-configuration.
 */
const config: PlaywrightTestConfig = {
  testDir: './tests',
  /* Maximum time one test can run for. */
  timeout: 1200 * 1000,
  /* Maximum time in milliseconds the whole test suite can run. Zero timeout (default) disables this behavior. */
  globalTimeout: 60 * 60 * 1000,
  expect: {
    /**
     * Maximum time expect() should wait for the condition to be met.
     * For example in `await expect(locator).toHaveText();`
     */
    timeout: 60000
  },
  /* Run tests in files in parallel */
  fullyParallel: true,
  /* Fail the build on CI if you accidentally left test.only in the source code. */
  forbidOnly: !!process.env.CI,
  /* Retry on CI only */
  retries: process.env.CI ? 2 : 0,
  /* Opt out of parallel tests on CI. */
  workers: process.env.CI ? 1 : undefined,
  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  reporter: 'html',
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  globalSetup: require.resolve('./global-setup'),
  use: {
    /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
    actionTimeout: 0,
    /* Base URL to use in actions like `await page.goto('/')`. */
    baseURL: process.env.BaseUrl || 'http://localhost:54195/',

    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
    trace: 'retain-on-failure',
    // Tell all tests to load signed-in state from 'storageState.json'.
    storageState: 'storageState.json',
    // Record a video for every test
    video: 'off',
    testIdAttribute: 'data-field'
  },

  /* Configure projects for major browsers */
  projects: [
    {
      name: 'chromium',
      use: {
        ...devices['Desktop Chrome'],
      },
    },

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

    {
      name: 'webkit',
      use: {
        ...devices['Desktop Safari'],
      },
    },

    /* Test against mobile viewports. */
    // {
    //   name: 'Mobile Chrome',
    //   use: {
    //     ...devices['Pixel 5'],
    //   },
    // },
    // {
    //   name: 'Mobile Safari',
    //   use: {
    //     ...devices['iPhone 12'],
    //   },
    // },

    /* Test against branded browsers. */
    // {
    //   name: 'Microsoft Edge',
    //   use: {
    //     channel: 'msedge',
    //   },
    // },
    // {
    //   name: 'Google Chrome',
    //   use: {
    //     channel: 'chrome',
    //   },
    // },
  ],

  /* Folder for test artifacts such as screenshots, videos, traces, etc. */
  outputDir: 'test-results/',

  /* Run your local dev server before starting the tests */
  //webServer: {
     //command: 'npm run start',
     //port: 3000,
     //reuseExistingServer: !process.env.CI
  //},
};

export default config;
"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">type</span> <span class="pl-kos">{</span> <span class="pl-v">PlaywrightTestConfig</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">import</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-c">/**</span>
<span class="pl-c"> * Read environment variables from file.</span>
<span class="pl-c"> * https://github.com/motdotla/dotenv</span>
<span class="pl-c"> */</span>
<span class="pl-c">// require('dotenv').config();</span>

<span class="pl-c">/**</span>
<span class="pl-c"> * See https://playwright.dev/docs/test-configuration.</span>
<span class="pl-c"> */</span>
<span class="pl-k">const</span> <span class="pl-s1">config</span>: <span class="pl-v">PlaywrightTestConfig</span> <span class="pl-c1">=</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-c">/* Maximum time one test can run for. */</span>
  <span class="pl-c1">timeout</span>: <span class="pl-c1">1200</span> <span class="pl-c1">*</span> <span class="pl-c1">1000</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Maximum time in milliseconds the whole test suite can run. Zero timeout (default) disables this behavior. */</span>
  <span class="pl-c1">globalTimeout</span>: <span class="pl-c1">60</span> <span class="pl-c1">*</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">expect</span>: <span class="pl-kos">{</span>
    <span class="pl-c">/**</span>
<span class="pl-c">     * Maximum time expect() should wait for the condition to be met.</span>
<span class="pl-c">     * For example in `await expect(locator).toHaveText();`</span>
<span class="pl-c">     */</span>
    <span class="pl-c1">timeout</span>: <span class="pl-c1">60000</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Run tests in files in parallel */</span>
  <span class="pl-c1">fullyParallel</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Fail the build on CI if you accidentally left test.only in the source code. */</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-c">/* Retry on CI only */</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-c">/* Opt out of parallel tests on CI. */</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-c">/* Reporter to use. See https://playwright.dev/docs/test-reporters */</span>
  <span class="pl-c1">reporter</span>: <span class="pl-s">'html'</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */</span>
  <span class="pl-c1">globalSetup</span>: <span class="pl-en">require</span><span class="pl-kos">.</span><span class="pl-en">resolve</span><span class="pl-kos">(</span><span class="pl-s">'./global-setup'</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-c">/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */</span>
    <span class="pl-c1">actionTimeout</span>: <span class="pl-c1">0</span><span class="pl-kos">,</span>
    <span class="pl-c">/* Base URL to use in actions like `await page.goto('/')`. */</span>
    <span class="pl-c1">baseURL</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">BaseUrl</span> <span class="pl-c1">||</span> <span class="pl-s">'http://localhost:54195/'</span><span class="pl-kos">,</span>

    <span class="pl-c">/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */</span>
    <span class="pl-c1">trace</span>: <span class="pl-s">'retain-on-failure'</span><span class="pl-kos">,</span>
    <span class="pl-c">// Tell all tests to load signed-in state from 'storageState.json'.</span>
    <span class="pl-c1">storageState</span>: <span class="pl-s">'storageState.json'</span><span class="pl-kos">,</span>
    <span class="pl-c">// Record a video for every test</span>
    <span class="pl-c1">video</span>: <span class="pl-s">'off'</span><span class="pl-kos">,</span>
    <span class="pl-c1">testIdAttribute</span>: <span class="pl-s">'data-field'</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>

  <span class="pl-c">/* Configure projects for major browsers */</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-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-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-c">/* Test against mobile viewports. */</span>
    <span class="pl-c">// {</span>
    <span class="pl-c">//   name: 'Mobile Chrome',</span>
    <span class="pl-c">//   use: {</span>
    <span class="pl-c">//     ...devices['Pixel 5'],</span>
    <span class="pl-c">//   },</span>
    <span class="pl-c">// },</span>
    <span class="pl-c">// {</span>
    <span class="pl-c">//   name: 'Mobile Safari',</span>
    <span class="pl-c">//   use: {</span>
    <span class="pl-c">//     ...devices['iPhone 12'],</span>
    <span class="pl-c">//   },</span>
    <span class="pl-c">// },</span>

    <span class="pl-c">/* Test against branded browsers. */</span>
    <span class="pl-c">// {</span>
    <span class="pl-c">//   name: 'Microsoft Edge',</span>
    <span class="pl-c">//   use: {</span>
    <span class="pl-c">//     channel: 'msedge',</span>
    <span class="pl-c">//   },</span>
    <span class="pl-c">// },</span>
    <span class="pl-c">// {</span>
    <span class="pl-c">//   name: 'Google Chrome',</span>
    <span class="pl-c">//   use: {</span>
    <span class="pl-c">//     channel: 'chrome',</span>
    <span class="pl-c">//   },</span>
    <span class="pl-c">// },</span>
  <span class="pl-kos">]</span><span class="pl-kos">,</span>

  <span class="pl-c">/* Folder for test artifacts such as screenshots, videos, traces, etc. */</span>
  <span class="pl-c1">outputDir</span>: <span class="pl-s">'test-results/'</span><span class="pl-kos">,</span>

  <span class="pl-c">/* Run your local dev server before starting the tests */</span>
  <span class="pl-c">//webServer: {</span>
     <span class="pl-c">//command: 'npm run start',</span>
     <span class="pl-c">//port: 3000,</span>
     <span class="pl-c">//reuseExistingServer: !process.env.CI</span>
  <span class="pl-c">//},</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-s1">config</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Steps</strong><br>
Run a test using Teamcity</p>
<p dir="auto">test starts to run normally</p>
<p dir="auto">[Describe expected behavior]</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">When running a single test using Teamcity I get a message that playwright is just installed and needs to download browsers. For some reason it looks for Chromium inside the Windows folder? I couldn't find anything about this in the playwright documentation. When I run the test without Teamcity it runs perfectly fine. I've tried setting PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers, but it still looks for Chromium in the windows directory.</p>
<code class="notranslate">
[12:46:07 ](http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13916&amp;logView=linear&amp;linesState=13916)Step 3/108: Install Playwright (Command Line)
[12:46:07 ](http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13919&amp;logView=linear&amp;linesState=13919)  Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script16450937878911554956.cmd
[12:46:07 ](http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13920&amp;logView=linear&amp;linesState=13920)  in directory: C:\TeamCity\buildAgent\work\4c9a3925e6c1abd3\playwright
[12:46:15 ](http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13921&amp;logView=linear&amp;linesState=13921)  
[12:46:15 ](http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13922&amp;logView=linear&amp;linesState=13922)  added 5 packages, and audited 6 packages in 5s
[12:46:15 ](http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13923&amp;logView=linear&amp;linesState=13923)  
[12:46:15 ](http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13924&amp;logView=linear&amp;linesState=13924)  found 0 vulnerabilities
[12:46:15 ](http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13925&amp;logView=linear&amp;linesState=13925)  Process exited with code 0
</code><p dir="auto"><code class="notranslate"><a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13928&amp;logView=linear&amp;linesState=13928" rel="nofollow">12:46:15 </a>Step 4/108: Run playwright single test (Command Line)<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13931&amp;logView=linear&amp;linesState=13931" rel="nofollow">12:46:15 </a>  Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script6789073163919943269.cmd<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13932&amp;logView=linear&amp;linesState=13932" rel="nofollow">12:46:15 </a>  in directory: C:\TeamCity\buildAgent\work\4c9a3925e6c1abd3\playwright<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13933&amp;logView=linear&amp;linesState=13933" rel="nofollow">12:46:17 </a><br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13934&amp;logView=linear&amp;linesState=13934" rel="nofollow">12:46:17 </a><br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13935&amp;logView=linear&amp;linesState=13935" rel="nofollow">12:46:17 </a>   [1A [2KError: browserType.launch: Executable doesn't exist at C:\windows\system32\config\systemprofile\pw-browsers\pw-browsers\chromium-1055\chrome-win\chrome.exe<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13936&amp;logView=linear&amp;linesState=13936" rel="nofollow">12:46:17 </a>  â•”â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•—<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13937&amp;logView=linear&amp;linesState=13937" rel="nofollow">12:46:17 </a>  â•‘ Looks like Playwright Test or Playwright was just installed or updated. â•‘<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13938&amp;logView=linear&amp;linesState=13938" rel="nofollow">12:46:17 </a>  â•‘ Please run the following command to download new browsers:              â•‘<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13939&amp;logView=linear&amp;linesState=13939" rel="nofollow">12:46:17 </a>  â•‘                                                                         â•‘<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13940&amp;logView=linear&amp;linesState=13940" rel="nofollow">12:46:17 </a>  â•‘     npx playwright install                                              â•‘<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13941&amp;logView=linear&amp;linesState=13941" rel="nofollow">12:46:17 </a>  â•‘                                                                         â•‘<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13942&amp;logView=linear&amp;linesState=13942" rel="nofollow">12:46:17 </a>  â•‘ &lt;3 Playwright Team                                                      â•‘<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13943&amp;logView=linear&amp;linesState=13943" rel="nofollow">12:46:17 </a>  â•šâ•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�â•�<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13944&amp;logView=linear&amp;linesState=13944" rel="nofollow">12:46:17 </a><br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13945&amp;logView=linear&amp;linesState=13945" rel="nofollow">12:46:17 </a>     at ..\global-setup.ts:6<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13956&amp;logView=linear&amp;linesState=13956" rel="nofollow">12:46:17 </a><br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13957&amp;logView=linear&amp;linesState=13957" rel="nofollow">12:46:17 </a><br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13958&amp;logView=linear&amp;linesState=13958" rel="nofollow">12:46:17 </a>   [1A [2K<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13959&amp;logView=linear&amp;linesState=13959" rel="nofollow">12:46:17 </a>  To open last HTML report run:<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13960&amp;logView=linear&amp;linesState=13960" rel="nofollow">12:46:17 </a><br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13961&amp;logView=linear&amp;linesState=13961" rel="nofollow">12:46:17 </a>    npx playwright show-report<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13962&amp;logView=linear&amp;linesState=13962" rel="nofollow">12:46:17 </a><br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13963&amp;logView=linear&amp;linesState=13963" rel="nofollow">12:46:17 </a>  Process exited with code 1<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13965&amp;logView=linear&amp;linesState=13965" rel="nofollow">12:46:17 </a>  Process exited with code 1 (Step: Run playwright single test (Command Line))<br>
<a href="http://localhost:8111/buildConfiguration/Inx2283Playwright_Ci/412?buildTab=log&amp;focusLine=13966&amp;logView=linear&amp;linesState=13966" rel="nofollow">12:46:17 </a>  Step Run playwright single test (Command Line) failed<br>
</code></p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.31.2]</li>
<li>Operating System: [All]</li>
<li>Browser: [Chromium ( maybe all )]</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>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// playwright.config.ts

  trace: &quot;retain-on-failure&quot;,
"><pre class="notranslate"><span class="pl-c">// playwright.config.ts</span>

  <span class="pl-s1">trace</span>: <span class="pl-s">"retain-on-failure"</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="test.describe(&quot;Sample test&quot;, () =&gt; {
    test('How to kill trace', async ({page}) =&gt; {
        await page.goto('https://playwright.dev/');

        await page.locator(&quot;[class*=github-btn] a]&quot;).click()
    })
})"><pre class="notranslate"><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">"Sample test"</span><span class="pl-kos">,</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-en">test</span><span class="pl-kos">(</span><span class="pl-s">'How to kill trace'</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://playwright.dev/'</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">locator</span><span class="pl-kos">(</span><span class="pl-s">"[class*=github-btn] a]"</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">click</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>Steps</strong></p>
<ul dir="auto">
<li>[Run the test]</li>
<li>test fails</li>
<li>open trace</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">trace opened, with errors from the console</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">blank screen in place of a trace, only after opening browser's console one could see a broken locator</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="index.f6c909e6.js:40 Error: Unexpected token &quot;]&quot; while parsing selector &quot;[class*=github-btn] a]&quot;
    at h (index.f6c909e6.js:41:3984)
    at A (index.f6c909e6.js:41:5695)
    at M (index.f6c909e6.js:41:4966)
    at S (index.f6c909e6.js:41:4664)
    at T (index.f6c909e6.js:41:4572)
    at HS (index.f6c909e6.js:41:5837)
    at index.f6c909e6.js:41:6507
    at Array.map (&lt;anonymous&gt;)
    at W0 (index.f6c909e6.js:41:6383)
    at B0 (index.f6c909e6.js:41:10836)
Cc @ index.f6c909e6.js:40
index.f6c909e6.js:41 Uncaught (in promise) Error: Unexpected token &quot;]&quot; while parsing selector &quot;[class*=github-btn] a]&quot;
    at h (index.f6c909e6.js:41:3984)
    at A (index.f6c909e6.js:41:5695)
    at M (index.f6c909e6.js:41:4966)
    at S (index.f6c909e6.js:41:4664)
    at T (index.f6c909e6.js:41:4572)
    at HS (index.f6c909e6.js:41:5837)
    at index.f6c909e6.js:41:6507
    at Array.map (&lt;anonymous&gt;)
    at W0 (index.f6c909e6.js:41:6383)
    at B0 (index.f6c909e6.js:41:10836)"><pre class="notranslate"><span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">f6c909e6</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">40</span> Error: <span class="pl-v">Unexpected</span> <span class="pl-s1">token</span> <span class="pl-s">"]"</span> <span class="pl-s1">while</span> <span class="pl-s1">parsing</span> <span class="pl-s1">selector</span> <span class="pl-s">"[class*=github-btn] a]"</span>
    <span class="pl-en">at</span> <span class="pl-s1">h</span> <span class="pl-kos">(</span><span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">f6c909e6</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">41</span>:<span class="pl-c1">3984</span><span class="pl-kos">)</span>
    <span class="pl-en">at</span> <span class="pl-v">A</span> <span class="pl-kos">(</span><span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">f6c909e6</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">41</span>:<span class="pl-c1">5695</span><span class="pl-kos">)</span>
    <span class="pl-en">at</span> <span class="pl-v">M</span> <span class="pl-kos">(</span><span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">f6c909e6</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">41</span>:<span class="pl-c1">4966</span><span class="pl-kos">)</span>
    <span class="pl-en">at</span> <span class="pl-v">S</span> <span class="pl-kos">(</span><span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">f6c909e6</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">41</span>:<span class="pl-c1">4664</span><span class="pl-kos">)</span>
    <span class="pl-en">at</span> <span class="pl-v">T</span> <span class="pl-kos">(</span><span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">f6c909e6</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">41</span>:<span class="pl-c1">4572</span><span class="pl-kos">)</span>
    <span class="pl-en">at</span> <span class="pl-c1">HS</span> <span class="pl-kos">(</span><span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">f6c909e6</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">41</span>:<span class="pl-c1">5837</span><span class="pl-kos">)</span>
    <span class="pl-s1">at</span> <span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">f6c909e6</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">41</span>:<span class="pl-c1">6507</span>
    <span class="pl-s1">at</span> <span class="pl-v">Array</span><span class="pl-kos">.</span><span class="pl-c1">map</span> <span class="pl-kos">(</span><span class="pl-c1">&lt;</span><span class="pl-ent">anonymous</span><span class="pl-c1">&gt;</span>)
    at W0 (index.f6c909e6.js:41:6383)
    at B0 (index.f6c909e6.js:41:10836)
Cc @ index.f6c909e6.js:40
index.f6c909e6.js:41 Uncaught (in promise) Error: Unexpected token "]" while parsing selector "[class*=github-btn] a]"
    at h (index.f6c909e6.js:41:3984)
    at A (index.f6c909e6.js:41:5695)
    at M (index.f6c909e6.js:41:4966)
    at S (index.f6c909e6.js:41:4664)
    at T (index.f6c909e6.js:41:4572)
    at HS (index.f6c909e6.js:41:5837)
    at index.f6c909e6.js:41:6507
    at Array.map (<span class="pl-c1">&lt;</span><span class="pl-ent">anonymous</span><span class="pl-c1">&gt;</span>)
    at W0 (index.f6c909e6.js:41:6383)
    at B0 (index.f6c909e6.js:41:10836)</pre></div>