pmme
pmme

Reputation: 11

Spectron test failing with bizarre reason

New user to spectron ***

I am trying to write a simple test to check the app window count using spectron. Below is the code.

const Application = require('spectron').Application
const assert = require('assert')
const electronPath = require('electron')
const path = require('path')
const { doesNotReject } = require('assert')
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');


 describe('Launch app', function() {

let app =  new Application({
  
  path: 'C:/Users/ts/Downloads/file.exe',
  chromeDriverArgs: ["--disable-extensions"],
  env: {
    SPECTRON: true,
    ELECTRON_ENABLE_LOGGING: true,
    ELECTRON_ENABLE_STACK_DUMPING: true
  },
  connectionRetryCount:0
});

beforeEach(async () => { 
  this.timeout(5000); 
  await app.start();
});

it('Shows an initial window', async () => {
  await app.client.waitUntilWindowLoaded();
  await app.browserWindow.focus();
  await app.browserWindow.setAlwaysOnTop(true);
  await app.client.getWindowCount();
    assert.equal(count, 1);
});

after(async () => {
     await app.stop();
  });

})

Unfortunately the test fails with a bizarre reason :

Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

Additionally I also get to see multiple black processes spamming and I am unable to catch the application window focus.

Appreciate help !

Thanks

Upvotes: 1

Views: 174

Answers (0)

Related Questions