Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Playwright 1.45.0 raises an error ENOENT: no such file or directory, open '/path/to/test-results/.playwright-artifacts-0/hash.zip' with Electron #31473

Closed
mtsmfm opened this issue Jun 28, 2024 · 5 comments · Fixed by #31437
Labels

Comments

@mtsmfm
Copy link
Contributor

mtsmfm commented Jun 28, 2024

Version

1.45.0

Steps to reproduce

  1. Clone my repo https://github.com/mtsmfm/electron-playwright-with-trace-issue
  2. cd pw-145
  3. npm install
  4. npx playwright test test.spec.ts --trace on

Expected behavior

Running 1 test using 1 worker

  ✓  1 test.spec.ts:15:1 › should work (651ms)

  1 passed (1.4s)

Actual behavior

Running 1 test using 1 worker

  ✘  1 test.spec.ts:15:1 › should work (415ms)


  1) test.spec.ts:15:1 › should work ───────────────────────────────────────────────────────────────

    Error: ENOENT: no such file or directory, open '/home/mtsmfm/ghq/github.com/mtsmfm/electron-playwright-example/pw-145/test-results/.playwright-artifacts-0/7e647ec48523e8dd0434626c5a1420a7.zip'

  1 failed
    test.spec.ts:15:1 › should work ────────────────────────────────────────────────────────────────

Additional context

Perhaps the error is thrown by await app.close(); as I don't see any error if I remove the line.

Environment

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    Memory: 11.28 GB / 15.54 GB
    Container: Yes
  Binaries:
    Node: 20.13.1 - ~/.local/share/mise/installs/node/20/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 10.8.0 - ~/.local/share/mise/installs/node/20/bin/npm
  IDEs:
    VSCode: 1.90.2 - /home/mtsmfm/.vscode-server/bin/5437499feb04f7a586f677b155b039bc2b3669eb/bin/remote-cli/code
  Languages:
    Bash: 5.0.17 - /usr/bin/bash
@arnaud-lacroix-lm
Copy link

@mtsmfm Do you still have the issue after the update 1.45.1 ?
I still have the same issue on my side on my own project

@mxschmitt
Copy link
Member

I tried to reproduce with the repository above and 1.45.1 fixes the issue for that. Maybe you issue is different or you didn't update?

@mtsmfm
Copy link
Contributor Author

mtsmfm commented Jul 4, 2024

I don't see the error with the latest version but it seems now it doesn't capture screenshots/snapshots with Electron for some reason.

@mxschmitt
Copy link
Member

@mtsmfm please file a separate bug with reproduction steps, since I'm not able to reproduce with your original reproduction. This works for me:

import { test as base } from "@playwright/test";

const test = base.extend({
  electronApp: async ({ playwright }, use) => {
    const app = await playwright._electron.launch({
      args: ["../electron-window-app.js"],
    });

    await use(app);

    await app.close();
  },
});

test("should work", async ({ electronApp }) => {
  await electronApp.context().tracing.start({ screenshots: true, snapshots: true });
  const window = await electronApp.firstWindow();
  await window.goto("http://facebook.com");
  await window.goto("http://microsoft.com");
  await new Promise((r) => setTimeout(r, 1000));
  await electronApp.context().tracing.stop({ path: "trace.zip"});
});

happy to look into it / fix!

@arnaud-lacroix-lm
Copy link

arnaud-lacroix-lm commented Jul 4, 2024

I tested the repo with 1.45.1 and it works well, yes. Sorry I think my issue seems not related to Electron specifically, but to a global issue :

  • When executing a test which takes 20 seconds to be executed, everything works well, but after the 20 seconds of exectuion, before closing, playwright is creating the trace, and it takes the 20 sec of execution + 30 seconds after until the global timeout which is 50 seconds. :
    image

So my issue is more about the time creation of the trace, which takes too much time compared to the execution time.
Also, during the execution, trace is creating :
image
And after the error encountered, the trace is completely deleted :
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants