electron-userland / spectron

DEPRECATED: 🔎 Test Electron apps using ChromeDriver
http://electronjs.org/spectron
MIT License
1.68k stars 228 forks source link

Electron 5 Support? #358

Open agirorn opened 5 years ago

agirorn commented 5 years ago

Now that Electron 5.00 is out, are there any plans to make spectron also support that version? Maybe it is a tall order since Electron 4 does not seem to be fully supported #346. At least what I have noticed is that Spectron is very tightly connected to electron@3.0.5 and all the tests are being run on that version.

When I upgrade the devDependencies version to 4.1.5 or 5.0.0, then a lot of tests brake.

pumano commented 5 years ago

@codebytere can you help with that?

codebytere commented 5 years ago

There are PRs in progress already to this end: https://github.com/electron/spectron/pull/361 https://github.com/electron/spectron/pull/364.

sindresorhus commented 5 years ago

Even with those PRs merged and released, it still doesn't work with Electron 5: https://github.com/electron-userland/spectron/issues/254#issuecomment-489574565

/Users/sindresorhus/dev/oss/electron-serve/node_modules/spectron/lib/application.js:230

  Rejected promise returned by test. Reason:

  TypeError {
    message: 'waitUntilWindowLoaded Cannot read property \'isLoading\' of undefined',
  }
const app = new Application({
    path: electron,
    args: ['fixture.js']
});
await app.start();
const {client} = app;
await client.waitUntilWindowLoaded();
await client.waitUntilTextExists('h1', '🦄', 5000);
dhuang612 commented 5 years ago

Hi,

I was able to solve this issue by following this: https://github.com/electron-userland/spectron/issues/174

florin05 commented 5 years ago

Here is a working sample with Electron 6 https://github.com/florin05/electron-spectron-example. See the last commit for changes to support Electron upgrade.

prathyu1616 commented 5 years ago

Hi @florin05 ,After the completion of test, application isn't terminating. We've tried different ways to stop the application by keeping stop(), quit(), process.kill(), process.exit(0). However none of them worked to terminate the console after all the actions has been done.

florin05 commented 5 years ago

@prathyu1616 , I don't see other windows open after test finishes, only the console that invoked the tests

npm run test

> electron-spectron-example@1.0.0 test .....\electron-spectron-example
> node ./node_modules/mocha/bin/_mocha

  Sample Test
    √ opens a window
    √ should get a url (596ms)
    √ should search (3718ms)

  3 passing (17s)