microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
67.39k stars 3.71k forks source link

[Bug]: Screenshots timing out when using chrome extension in new headless mode #33770

Open jeff-an opened 1 week ago

jeff-an commented 1 week ago

Version

1.44.1, 1.48.2

Steps to reproduce

Minimal reproduction is available in this pull request in my public demo repository: https://github.com/jeff-an/playwright-shadow-dom-repro/pull/1. The main Playwright script is here while the github action workflow is defined here.

The failure can be seen in the Github actions failure, which only attempts to take a screenshot of Google.com but fails.

The Chrome extension being used is the popular https://darkreader.org/. It works totally fine on my official Chrome build and on Chromium when ran on my Mac OS laptop. However, it does not work when running on Linux.

Interestingly this flow used to work last week and I don't think I changed the Playwright version used or any dependencies. Maybe something on the default Github Actions runners changed? DEBUG=pw:api just says screenshot started and then screenshot failed with nothing useful in between.

Expected behavior

Screenshot should succeed within a reasonable time.

Actual behavior

Screenshot fails after 3 seconds. Tried the following:

Additional context

No response

Environment

System:
    OS: Linux 6.5 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (4) x64 AMD EPYC [7](https://github.com/jeff-an/playwright-shadow-dom-repro/actions/runs/12031941610/job/33542600882?pr=1#step:6:8)763 64-Core Processor
    Memory: 14.48 GB / 15.61 GB
    Container: Yes
  Binaries:
    Node: 20.1[8](https://github.com/jeff-an/playwright-shadow-dom-repro/actions/runs/12031941610/job/33542600882?pr=1#step:6:9).1 - /opt/hostedtoolcache/node/20.18.1/x64/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: [10](https://github.com/jeff-an/playwright-shadow-dom-repro/actions/runs/12031941610/job/33542600882?pr=1#step:6:11).8.2 - /opt/hostedtoolcache/node/20.18.1/x64/bin/npm
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
  npmPackages:
    @playwright/test: ^1.48.2 => 1.48.2
mxschmitt commented 1 week ago

Minmal reproduction: https://github.com/mxschmitt/playwright-shadow-dom-repro/tree/jeff/ext

It isn't related to https://github.com/microsoft/playwright/issues/33330 since removing the Emulation.setFocusEmulationEnabled call does't fix it in that case. Also running it headed doesn't make it work