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
66.41k stars 3.63k forks source link

[BUG] Timeout error in firefox when using playwright for UI automation. #14397

Closed ajayEngProd closed 2 years ago

ajayEngProd commented 2 years ago

Context: Hello , we are facing the issue with timeouts happening randomly. We are running close to 60k tests across multiple machines in 20 minutes. This problem happens when tests run in a pipeline and not when they are running in local.

OS: windows playwright version : 1.13.0 Dot net version : 5 and 6 any help in this regard will be very useful @zhanglei4333 @liuxingbaoyu @tillschander .

i am providing you with the code snippet below after removing all the framework related code.

code using Microsoft.Playwright;

using var playwright = await Playwright.CreateAsync(); await using var browser = await playwright.Firefox.LaunchAsync(); var page = await browser.NewPageAsync(); await page.GotoAsync("https://playwright.dev/dotnet"); await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot.png" });

Test method ABCD threw exception: System.TimeoutException: Timeout 30000ms exceeded. =========================== logs =========================== D:\app\testservices.ea981c19-b379-40ea-afbe-119cb65d6d73\Taef\Playwright.Browsers\firefox-1278\firefox\firefox.exe -no-remote -headless -profile D:\data\Temp\AgileTestQueueConsumer\playwright_firefoxdev_profile-yE0PDk -juggler-pipe -silent pid=34940 [pid=34940][err] *** You are running in headless mode. ============================================================

pavelfeldman commented 2 years ago

I don't think it'll repro if we just run the snippet, we need a reproduction to act on it. And you should use latest Playwright for sure, otherwise all our findings will be irrelevant.

Overall, Firefox is the most resource-demanding browser of the three. So it is likely that you run out of memory or startup latencies are contributing into the race conditions. Do you create a context per test? Do you close those contexts? How many contexts does each browser create and close before it fails?