<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.32.3]</li>
<li>Operating System: [ubuntu-20.04]</li>
<li>Browser: [Chromium]</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"> I provided exact source code that allows reproducing the issue locally.</li>
</ul>




<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/46001464/234200275-135abaa7-4449-4f9d-a559-5ecf0cf9d095.png"><img src="https://user-images.githubusercontent.com/46001464/234200275-135abaa7-4449-4f9d-a559-5ecf0cf9d095.png" alt="VRT Failure1" style="max-width: 100%;"></a></p>
<p dir="auto">implementing based on <a href="https://www.npmjs.com/package/@web/test-runner-visual-regression" rel="nofollow">https://www.npmjs.com/package/@web/test-runner-visual-regression</a></p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: v1.32.0-focal, v1.35.1</li>
<li>Operating System: Ubuntu 22.04.2 LTS</li>
<li>Browser: Chromium</li>
<li>Docker version 24.0.4, build 3713ee1</li>
<li>Docker Compose version v2.19.1</li>
<li>self-hosted azure devops agent (3.217.1, 3.220.2 и 3.220.5 (latest))</li>
<li>we use m6i.2xlarge AWS instance type</li>
</ul>
<h3 dir="auto">Other info:</h3>
<details>
<summary>
Dockerfile 
</summary>
<div class="highlight highlight-source-dockerfile notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
FROM mcr.microsoft.com/playwright:v1.28.1-focal as ci-stage

WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH

COPY package*.json .npmrc ./
RUN npm ci
RUN npx playwright install --with-deps chromium
COPY . .

FROM ci-stage as build-stage
ARG BUILD_TYPE
RUN npm run build:$BUILD_TYPE
"><pre class="notranslate"><span class="pl-k">FROM</span> mcr.microsoft.com/playwright:v1.28.1-focal as ci-stage

<span class="pl-k">WORKDIR</span> /app
<span class="pl-k">ENV</span> PATH /app/node_modules/.bin:$PATH

<span class="pl-k">COPY</span> package*.json .npmrc ./
<span class="pl-k">RUN</span> npm ci
<span class="pl-k">RUN</span> npx playwright install --with-deps chromium
<span class="pl-k">COPY</span> . .

<span class="pl-k">FROM</span> ci-stage as build-stage
<span class="pl-k">ARG</span> BUILD_TYPE
<span class="pl-k">RUN</span> npm run build:$BUILD_TYPE
</pre></div>
</details>
<details>
<summary>docker-compose.yml</summary>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="version: '3.4'

# Command to run docker-compose
#docker-compose -f docker-compose-playwright.yml up --build --abort-on-container-exit

services:
  database:
    image: &quot;postgres&quot;
    restart: always
    ports:
      - &quot;5447:5432&quot;
    environment:
      - POSTGRES_NAME=
      - POSTGRES_USER=
      - POSTGRES_PASSWORD=

  api:
    ports:
      - &quot;7002:80&quot;
    build:
      context: .
      dockerfile: ./Docker-Compose.Dockerfile
    depends_on:
      - database
    entrypoint: [&quot;dotnet&quot;, &quot;Entry.dll&quot;]

  playwright:
    build:
      context: ../Frontend
      dockerfile: ../Frontend/Playwright.Dockerfile
      args:
        - BUILD_TYPE=docker-compose
    entrypoint: [&quot;/bin/sh&quot;, &quot;-c&quot; , &quot;sleep 30 &amp;&amp; npm run test:pw:headless&quot;]
    environment:
      - NODE_ENV=docker-compose
      - CI=true
    ports:
      - &quot;8082:8080&quot;
    volumes:
      - /opt/vsts/work/_temp/playwright-report:/app/playwright-report
    depends_on:
      - api
"><pre class="notranslate"><span class="pl-ent">version</span>: <span class="pl-s"><span class="pl-pds">'</span>3.4<span class="pl-pds">'</span></span>

<span class="pl-c"><span class="pl-c">#</span> Command to run docker-compose</span>
<span class="pl-c"><span class="pl-c">#</span>docker-compose -f docker-compose-playwright.yml up --build --abort-on-container-exit</span>

<span class="pl-ent">services</span>:
  <span class="pl-ent">database</span>:
    <span class="pl-ent">image</span>: <span class="pl-s"><span class="pl-pds">"</span>postgres<span class="pl-pds">"</span></span>
    <span class="pl-ent">restart</span>: <span class="pl-s">always</span>
    <span class="pl-ent">ports</span>:
      - <span class="pl-s"><span class="pl-pds">"</span>5447:5432<span class="pl-pds">"</span></span>
    <span class="pl-ent">environment</span>:
      - <span class="pl-s">POSTGRES_NAME=</span>
      - <span class="pl-s">POSTGRES_USER=</span>
      - <span class="pl-s">POSTGRES_PASSWORD=</span>

  <span class="pl-ent">api</span>:
    <span class="pl-ent">ports</span>:
      - <span class="pl-s"><span class="pl-pds">"</span>7002:80<span class="pl-pds">"</span></span>
    <span class="pl-ent">build</span>:
      <span class="pl-ent">context</span>: <span class="pl-s">.</span>
      <span class="pl-ent">dockerfile</span>: <span class="pl-s">./Docker-Compose.Dockerfile</span>
    <span class="pl-ent">depends_on</span>:
      - <span class="pl-s">database</span>
    <span class="pl-ent">entrypoint</span>: <span class="pl-s">["dotnet", "Entry.dll"]</span>

  <span class="pl-ent">playwright</span>:
    <span class="pl-ent">build</span>:
      <span class="pl-ent">context</span>: <span class="pl-s">../Frontend</span>
      <span class="pl-ent">dockerfile</span>: <span class="pl-s">../Frontend/Playwright.Dockerfile</span>
      <span class="pl-ent">args</span>:
        - <span class="pl-s">BUILD_TYPE=docker-compose</span>
    <span class="pl-ent">entrypoint</span>: <span class="pl-s">["/bin/sh", "-c" , "sleep 30 &amp;&amp; npm run test:pw:headless"]</span>
    <span class="pl-ent">environment</span>:
      - <span class="pl-s">NODE_ENV=docker-compose</span>
      - <span class="pl-s">CI=true</span>
    <span class="pl-ent">ports</span>:
      - <span class="pl-s"><span class="pl-pds">"</span>8082:8080<span class="pl-pds">"</span></span>
    <span class="pl-ent">volumes</span>:
      - <span class="pl-s">/opt/vsts/work/_temp/playwright-report:/app/playwright-report</span>
    <span class="pl-ent">depends_on</span>:
      - <span class="pl-s">api</span>
</pre></div>
</details>
<p dir="auto">npm script <code class="notranslate">test:pw:headless</code> launch frontend application and execute <code class="notranslate">playwright test</code> command</p>
<p dir="auto">Playwright config</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
{
  testDir: './playwright',
  /* Maximum time one test can run for. */
  timeout,
  expect: {
    /**
       * Maximum time expect() should wait for the condition to be met.
       * For example in `await expect(locator).toHaveText();`
       */
    timeout,
  },
  /* 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: 6,
  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  reporter: isDev ? [
    ['list'], ['html'],
  ] : [
    ['list'],
    ['html', { open: 'never' }],
    process.env.CI ? ['junit'] : ['list'],
  ],
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  globalSetup: require.resolve('./playwright.global-setup'),
  testMatch: 'playwright/specs/**/*.spec.ts',
  use: {
    /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
    actionTimeout: 0,
    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
    trace: 'retain-on-failure',
    /* Base URL to use in actions like `await page.goto('/')`. */
    baseURL: 'http://localhost:8080',
    screenshot: 'only-on-failure',
    testIdAttribute: 'data-test',
  },
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-c1">testDir</span>: <span class="pl-s">'./playwright'</span><span class="pl-kos">,</span>
  <span class="pl-c">/* Maximum time one test can run for. */</span>
  timeout<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>
    timeout<span class="pl-kos">,</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-c1">6</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-s1">isDev</span> ? <span class="pl-kos">[</span>
    <span class="pl-kos">[</span><span class="pl-s">'list'</span><span class="pl-kos">]</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-kos">]</span> : <span class="pl-kos">[</span>
    <span class="pl-kos">[</span><span class="pl-s">'list'</span><span class="pl-kos">]</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">open</span>: <span class="pl-s">'never'</span> <span class="pl-kos">}</span><span class="pl-kos">]</span><span class="pl-kos">,</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-s">'junit'</span><span class="pl-kos">]</span> : <span class="pl-kos">[</span><span class="pl-s">'list'</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">/* 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">'./playwright.global-setup'</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
  <span class="pl-c1">testMatch</span>: <span class="pl-s">'playwright/specs/**/*.spec.ts'</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">/* 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">/* Base URL to use in actions like `await page.goto('/')`. */</span>
    <span class="pl-c1">baseURL</span>: <span class="pl-s">'http://localhost:8080'</span><span class="pl-kos">,</span>
    <span class="pl-c1">screenshot</span>: <span class="pl-s">'only-on-failure'</span><span class="pl-kos">,</span>
    <span class="pl-c1">testIdAttribute</span>: <span class="pl-s">'data-test'</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">We have a 1-hour timeout for our builds. In the screenshot, you can see that consequent builds were cancelled by a timeout or cancelled manually.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/2903772/253110020-701957b7-25cb-4f45-b300-44d22dc71996.png"><img src="https://user-images.githubusercontent.com/2903772/253110020-701957b7-25cb-4f45-b300-44d22dc71996.png" alt="MicrosoftTeams-image (33)" style="max-width: 100%;"></a></p>
<h3 dir="auto">Solution</h3>
<p dir="auto">Downgrade to Playwright playwright:v1.28.1-focal solves the issue, and now everything works well.</p>
<p dir="auto">Also, there is no useful information even with <code class="notranslate">DEBUG=pw:browser*</code>.</p>
<p dir="auto">I think that issue is somehow related to the Docker image.</p>
<p dir="auto">I hope this issue will help somebody.</p>