Skip to content

[BUG] - Electron hangs closing the context #13874

@andreabisello

Description

@andreabisello

Context:

  • Playwright Version: 1.20
  • Operating System: Windows 11
  • Node.js version: v16.13.0
  • Browser: ELECTRON

I use playwright to test both browser and electron.
application is created with vue, vite and electron 18.2.0, and i cannot share sources in a repo for this issue.
test is the same on browser and on electron,
on browser,
browser is opened with this


const browserContext = await webBrowser.newContext({
            locale: language,
            recordVideo: {
                dir: 'browser-videos/',
                size: { width: 640, height: 480 },
            },
            recordHar:{
                path:"browser-network.har"
            }
        })

application = await browserContext.newPage()      

on electron , electron is opened with this


const electronApp = await electron.launch({
recordVideo: {
        dir:"./electron-test-run-videos",
        size:{
            width:1280,
            height:720
        }
    },
    recordHar:{
        path:"electron-network.har"
    }
})
application = electronApp.firstWindow
 

due i want to store the har, has documented, i need to close the context.
So at the end of the test, i do

await application.context().close
await application.close

Describe the bug

  • with browser, it works: i close the context and the har file is generated.
  • with electron, if i don't close the contest, test pass but har file is not generated.

image

  • with electron, test hangs waiting until general timeout closing the context without trhow any exception, and at the end, the har file is generated.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions