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

[Bug]: Intermittent error "TypeError : xyz is not a function" "TypeError : Cannot read properties of undefined" #30431

Closed sunilsurana closed 5 months ago

sunilsurana commented 6 months ago

Version

1.42.1

Steps to reproduce

The issue is not reproducible in seperate the repository. In our internal repository it occurs intermittently

Expected behavior

The playwright test should execute all the functions

Actual behavior

We get error TypeError: (0 , TestSetupUtils_1.getTestEnvironmentInfo) is not a function. Even when this function is present and another similar error. Attaching screenshot of both errors TypeError: Cannot read properties of undefined (reading 'NONE')

image

image

Additional context

This is an intermittent issue we face. It is not reproducible on local machine and CI machine it occurs intermittently. If this fail then we try to retry which most of the time succeds. It was working fine till version 1.40.0

The error sometime says function is missing and sometime says enum property is missing. Although they are present in the other TS files.

Looks like some issue in typescript transpilation which is included in playwright is not loading typescript file correctly. This problem was there in 1.23 version also

Environment

OS: linux
Node - 18.17
yury-s commented 6 months ago

Can you share an example project where it fails so that we could run it locally?

sunilsurana commented 6 months ago

Sure. I'm trying to find repro steps. This issue has been difficult to repro on local machine and on CI machine it happens intermittently. Trying to find out repro steps. My initial suspect is the babel/typescript-preset version was update in 42.1 release and for some reason with our combination of code its running in some race condition.

I'll let know if i have repro.

yury-s commented 6 months ago

My initial suspect is the babel/typescript-preset version was update in 42.1 release and for some reason with our combination of code its running in some race condition.

That may well be the case. We need a repro to figure out what's going on.

yury-s commented 5 months ago

We need more information to act on this report. Please file a new one and link to this issue when you get back to it!

sunilsurana commented 5 months ago

By patching playwright to put logs we were able to track down the cause of the issue. SO created new issue https://github.com/microsoft/playwright/issues/30577 And also a PR to fix it https://github.com/microsoft/playwright/pull/30578