nklayman / vue-cli-plugin-electron-builder

Easily Build Your Vue.js App For Desktop With Electron
https://nklayman.github.io/vue-cli-plugin-electron-builder/
MIT License
4.12k stars 278 forks source link

Unable to run electron unit test #1657

Closed ShubhamPalriwala closed 1 year ago

ShubhamPalriwala commented 2 years ago

Describe the bug The auto-generated electron.spec.js returns an error as follows:

Summary of all failing tests
 FAIL  tests/unit/electron.spec.js (53.491s)
  ● Window Loads Properly

    : Timeout - Async callback was not invoked within the 50000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 50000ms timeout specified by jest.setTimeout.Error:

       6 | jest.setTimeout(50000);
       7 |
    >  8 | test("Window Loads Properly", async () => {
         | ^
       9 |     // Wait for dev server to start
      10 |     const { app, stopServe } = await testWithSpectron(spectron);
      11 |     const win = app.browserWindow;

      at new Spec (node_modules/.pnpm/jest-jasmine2@24.9.0/node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
      at Object.<anonymous> (tests/unit/electron.spec.js:8:1)

A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

Expected behavior The auto-generated spectron test should pass as default!

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context I have upgraded Electron to the latest v17.0.0 and Spectron to v19.0.0. I tried with the latest alpha pre-release too but it still fails

MatthijsBurgh commented 1 year ago

The issue could be you need @electron/remote to have the newest spectron working. Which isn't supported yet by the current released and master version. A PR is open for this. But as I am working on getting Playwright support. As spectron is deprecated, don't expect any release untill the playwright support is fixed.

Check my own projects to see the changes I made to get electron 17 working in combination with spectron 19, https://github.com/tue-robotics/hero-dashboard or https://github.com/tue-robotics/hero-display