playwright-community / playwright-go

Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.
https://playwright-community.github.io/playwright-go/
MIT License
1.94k stars 144 forks source link

Strange timeout behaviour #406

Closed ivaylo321 closed 5 months ago

ivaylo321 commented 5 months ago

I am looking at this trace from one of my test executions - The test failed on asserting url p.Expect.Page(p.Page).ToHaveURL(regexp.MustCompile(expected))

Screenshot 2024-01-18 150428

I have configured the timeout to be 50000ms, but for some reason the assertion failed after less than 1 second - why could this happen, I am confused?

I received this log in my CI:

Page URL expected to be 'warning'
Actual value: <nil> 
Call log:
 with timeout 50000ms
waiting for locator(':root')
canstand commented 5 months ago

Page.Goto default timeout 30000ms, and ToHaveURL depends on playwright.NewPlaywrightAssertions(timeout), default 5000ms.

ivaylo321 commented 5 months ago

I did set the playwright.NewPlaywrightAssertions to 50000ms and I see that it is set correctly in the log.

From the debugging I did I think the problem is with the version of Chrome I use. I need to test with Chrome 83, so I have downloaded it separately and I am passing it when launching Chromium (with the ExecutablePath option). I noticed that every time the test fails in such a strange way it is always with Chrome 83 and never with the Chrome version that comes with Playwright. So it appears that somehow the Chrome 83 gets stuck or even crashes (sometimes I get Target crashed message in the logs). From what I understand using older versions of Chrome is not officially supported and issues can be expected, correct? If that is the case I guess I just have to assume the tests with Chrome 83 will be flaky.