playwright: [Bug]: playwright runner is slow to start tests

Version

1.49.1

Steps to reproduce

When i run any playwright tests it takes a very long time before they even start running.

https://stackoverflow.com/questions/79167011/playwright-is-slow-to-start-tests-long-delay-before-execution-begins

The behavior described in the stackoverflow post is exactly what i am seeing in vscode. It simply takes many seconds before playwright boots and starts running, also from command line “npx playwright test” . Is there anything i can check on my end?

Expected behavior

Quick iteration times when running playwright tests from both console and vscode

Actual behavior

Very slow startup times before tests are being ran

Additional context

No response

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12800H
    Memory: 13.35 GB / 31.69 GB
  Binaries:
    Node: 22.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.0 - ~\AppData\Roaming\npm\npm.CMD
  IDEs:
    VSCode: 1.98.0 - C:\Users\userxx\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  Languages:
    Bash: 5.2.21 - C:\WINDOWS\system32\bash.EXE
  npmPackages:
    @playwright/test: ^1.40.1 => 1.49.1

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 42 (14 by maintainers)

Most upvoted comments

The fix will be released soon in v1.53.

Can you create a sample repo with sad dependencies and share this repro with us?

I tried to create a reproducible example but couldn’t. I think it all comes down to the fact that the first build without cache increases in duration as the number of files grows. Since I have 4.5k files (only playwright test code and spec files), my first build takes 20 seconds, whereas subsequent ones take only 3.5 seconds. maybe @jcageman can provide more examples

same… tried to create a reproduction based on the initial playwright project and failed before… somehow i now managed to do it with a trivial example.

repro.zip

If you remove the faker import from the example it runs in around 8 seconds, while with faker it blows up easily towards 1 minute…

updated my comment

See:

Image. First is without faker, 2nd run is with faker.

@cwolf24 Looking through the release notes, try setting captureGitInfo: { commit: false, diff: false } in your config. Perhaps that could be the problem? Please let me know whether that helps. If it does, try setting commit: true, diff: false and check again.

FWIW, I have tried with and without @faker-js/faker. The difference is ~250ms on my macbook. I checked and Playwright does not transform faker source code, since it comes from node_modules, however Node.js still loads it. When loading faker as esm, it is ~4.5MB in ~150 files - I can see how this could slow down things a bit, but not drastically. If we don’t arrive to a repro, I will have to close this issue as non-actionable, unfortunately.

is there someone who could try repro’ing this on windows instead?

I already achieved some speed-ups:

  • Disable my virus scanner for node.exe processes which already makes it 15 sec instead of 1 minute… so this was the biggest win.
  • Faker seems to be downloading a lot… I was still using version 8 which is super slow by default. https://fakerjs.dev/guide/upgrading.html#fix-tree-shaking upgrade to version 9. Now overall running time of my repro is down to 7 seconds.

Still curious why i am seeing so much slowdown compared to you guys while my laptop is fast and you should also have issues with the faker download i would presume. In my opinion issue is clear and could be closed.