question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Tracing does not seem to work with `electron` support

See original GitHub issue

Context:

  • Playwright Version: 1.20.1
  • Operating System: macOS
  • Node.js version: 16.x
  • Browser: Electron

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and that we can run and debug locally. For example:

const { _electron: electron } = require('playwright');

(async () => {

    // Launch Electron app.
    const electronApp = await electron.launch({ args: ['main.js'] });

    // Evaluation expression in the Electron context.
    const appPath = await electronApp.evaluate(async ({ app }) => {
        // This runs in the main Electron process, parameter here is always
        // the result of the require('electron') in the main app script.
        return app.getAppPath();
    });
    console.log(appPath);

    // Get the first window that the app opens, wait if necessary.
    const window = await electronApp.firstWindow();

    await window.context().tracing.start({ name: 'ETracing', screenshots: true, snapshots: true });

    // Print the title.
    console.log(await window.title());

    await new Promise(resolve => {
        setTimeout(() => {
            resolve();
        }, 10000);
    });

    await window.context().tracing.stop({ path: '/Users/bpasero/Desktop/elec-playwright/trace.zip' });


    // Direct Electron console to Node terminal.
    window.on('console', console.log);
    // Click button.
    await window.click('text=Click me');
    // Exit app.
    await electronApp.close();
})();

Describe the bug

I start Electron and the window opens and I start to click around and the trace is created after 10 seconds, but it contains no screenshots.

Attaching the trace for reference:

trace.zip

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
bpaserocommented, Apr 4, 2022

I was able to revive my old branch and clean it up with latest and also verified that tracing does work (so I am fine closing this issue).

PR is up at https://github.com/microsoft/vscode/pull/146692 to verify the changes, so far I have not seen flakiness (did a test run of 7 across our platforms) 🤞 🤞

Let’s allocate some time and hack something together, it could be cool!

Happy to share our use of playwright in a meeting and get some feedback if we can improve things 👍

2reactions
pavelfeldmancommented, Mar 31, 2022

Understood, wouldn’t the Electron team itself be the best candidate for this? I am not sure if they already have smoke tests in place but it might be worthwhile reaching out to them.

I’d prefer to have someone with a real Electron app to test.

As for VSCode I cannot make promises, I had started a prototype a while ago but then was hitting a road block that now seems fixed, but my branch is horribly out of date and almost needs a rewrite…

Let’s allocate some time and hack something together, it could be cool!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug #1944468 “Electron applications all crash upon launch”
It would be very bad if Electron apps failed to function when 21.10 is released.
Read more >
Cannot make API requests with XMLHttpRequest in Electron
In my opinion, this is a bug/issue with Electron, not Bitbucket Server, and I think it's reasonable to work around it on that...
Read more >
Crash when attempting to print note (Ubuntu 22.04, deb ...
So, looks like it's not an Electron's bug. It could be an environment-dependent issue. I can see it failed to initialize a sandbox...
Read more >
Electron isn't Cancer but it is a Symptom of a Disease
Granted it doesn't have the performance or resource utilization of an Electron app and I'd say it's a better citizen on the platforms...
Read more >
How to properly debug Electron memory issues?
Another thing to mention is that it's not necessarily a memory ... It seems to me that Electron can use an absurd amount...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found