playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[BUG] Electron firstWindow times out after upgrading to 1.28.1

Open quanglam2807 opened this issue 2 years ago • 5 comments

Issue has been reported with 1.28.0: https://github.com/microsoft/playwright/issues/18928 but it was not fixed with https://github.com/microsoft/playwright/pull/18972 (1.28.1)

Context:

  • Playwright Version: 1.28.1
  • Operating System: Tested on Windows and Mac
  • Node.js version: 16
  • Browser: Electron
  • Extra: Wasn't a problem in 1.27.1 or below. Repros 100% of the time after upgrading.

Code Snippet

import { ElectronApplication, Page, _electron as electron } from "playwright";

(async () => {
  const electronApp = await electron.launch({
            args: [path.join(__dirname, "../dist/App.js"),
            '--enable-logging',
            '--skip-welcome',
            '--disable-telemetry',
            '--no-cached-data',
            ],
            env: {
                automation: "1",
                authConfig: JSON.stringify(config),
            }
        });
  const page = await electronApp.firstWindow(); // times out after 30 seconds
})();

Describe the bug

After upgrading to 1.28.0 or 1.28.1, Electron tests are all timing out. Downgrading to 1.27.1 resolves the issue. Example test to assist in repro can be found here

quanglam2807 avatar Dec 03 '22 02:12 quanglam2807

See https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/5450 for more information. My assumption is that not all Playwright versions got updated, I cleaned up the Playwright dependencies in the project as well, so not all the browsers gets installed even tho they are not used.

mxschmitt avatar Dec 05 '22 19:12 mxschmitt

@quanglam2807 could you please verify that https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/5450 fixes things?

aslushnikov avatar Dec 06 '22 08:12 aslushnikov

@aslushnikov @mxschmitt Actually, the repro is copied from https://github.com/microsoft/playwright/issues/18928. I'm persoanlly not using https://github.com/AzureAD/microsoft-authentication-library-for-js

I have the same issue when using v1.28.1 with [email protected]. Downgrading to v1.27.1 fixes the problem.

quanglam2807 avatar Dec 08 '22 06:12 quanglam2807

Can you create a minimal repro for your scenario? This would help a ton, otherwise we cant act on it since there is no repro.

mxschmitt avatar Dec 08 '22 09:12 mxschmitt

There is a template repository https://github.com/cawa-93/vite-electron-builder Update of playwright is failing on https://github.com/cawa-93/vite-electron-builder/pull/874 due to a timeout (as described by this issue)

benoitf avatar Dec 12 '22 07:12 benoitf

It happens if you call electron.app.disableHardwareAcceleration() otherwise, the electron window is not created and the electronApp.firstWindow() is never resolved

cawa-93 avatar Dec 17 '22 19:12 cawa-93

Probably fixed in 1.29.1

cawa-93 avatar Dec 22 '22 05:12 cawa-93

Marking as closed then!

aslushnikov avatar Dec 22 '22 16:12 aslushnikov