spectron icon indicating copy to clipboard operation
spectron copied to clipboard

NEED Chrome Browser Update - Spectron 13 - app.start() never resolves

Open DWboutin opened this issue 4 years ago • 10 comments

Hi! I'm trying to setup e2e tests with Spectron and I got some issues.

When I start my tests with:

  beforeEach(async () => {
    app = new Application({
      path: path.resolve(
        __dirname,
        '..',
        'out/type-relectron-darwin-x64/type-relectron.app/Contents/MacOS/type-relectron',
      ),
    })
    await app.start()
    console.log('app.start()')
  })

It keeps opening new windows and app.start() never resolve, it never logs "app.start()".

I added some console.log in the node_modules/spectron/lib/application.js file to check how far it goes.

Application.prototype.start = function () {
const self = this;
return self
  .exists()
  .then(function () {
    console.log('self.startChromeDriver();')
    return self.startChromeDriver();
  })
  .then(function () {
    console.log('self.createClient();')
    return self.createClient();
  })
  .then(function () {
    console.log('self.api.initialize();')
    return self.api.initialize();
  })
  .then(function () {
    console.log('self.client.setTimeouts(')
    return self.client.setTimeouts(
      self.waitTimeout,
      self.waitTimeout,
      self.waitTimeout
    );
  })
  .then(function () {
    console.log('self.running = true;')
    self.running = true;
  })
  .then(function () {
    console.log('return self;')
    return self;
  }).catch(err => {
    console.log(err)
  });
};

It never go pass self.createClient(); and with a newly added .catch it gives me this error.

Error: Failed to create session.
    session not created: This version of ChromeDriver only supports Chrome version 87
    Current browser version is 78.0.3904.126 with binary path /Users/mikaelboutin/Desktop/Qohash/electron-react-ts-starter/node_modules/spectron/lib/launcher.js
        at Object.startWebDriverSession (/Users/mikaelboutin/Desktop/Qohash/electron-react-ts-starter/node_modules/webdriver/build/utils.js:34:15)
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
        at Function.newSession (/Users/mikaelboutin/Desktop/Qohash/electron-react-ts-starter/node_modules/webdriver/build/index.js:35:45)
        at Object.<anonymous>.exports.remote (/Users/mikaelboutin/Desktop/Qohash/electron-react-ts-starter/node_modules/webdriverio/build/index.js:53:22)

Can you make something about this or show me the way to get a Chrome version 87 with Spectron?

Thank you

DWboutin avatar Jan 26 '21 22:01 DWboutin

Running into the same issue as well. Using Electron 10.1.6 and Spectron 12.0.0

Error: Failed to create session.
Timeout awaiting 'request' for 30000ms
      at Object.startWebDriverSession (node_modules/webdriver/build/utils.js:34:15)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at Promise.then (<anonymous>)
      at new Promise (<anonymous>)
      at Context.<anonymous> (node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12)
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:138:15)
      at initAsyncResource (internal/timers.js:153:5)
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:138:15)
      at initAsyncResource (internal/timers.js:153:5)
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:138:15)
      at initAsyncResource (internal/timers.js:153:5)
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:138:15)
      at initAsyncResource (internal/timers.js:153:5)
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:138:15)
      at initAsyncResource (internal/timers.js:153:5)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at Object.runCommand (node_modules/yargs/lib/command.js:242:26)
      at Object.parseArgs [as _parseArgs] (node_modules/yargs/yargs.js:1096:28)
      at Object.parse (node_modules/yargs/yargs.js:575:25)
      at Module._compile (internal/modules/cjs/loader.js:1137:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
      at Module.load (internal/modules/cjs/loader.js:985:32)
      at Function.Module._load (internal/modules/cjs/loader.js:878:14)
      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
      at internal/main/run_main_module.js:17:47

clai96 avatar Jan 27 '21 04:01 clai96

I see a similar error with Spectron 13, Electron 11.2.0 & chrome 87.0.4280.141 when trying to reference the app.start() return object. Is there a temporary workaround for this?

let testApp = await app.start(); ... javascript error: javascript error: Cannot convert undefined or null to object (Session info: chrome=87.0.4280.141)

quasivivo avatar Jan 27 '21 15:01 quasivivo

Same issue

jtoy avatar Jan 27 '21 16:01 jtoy

Me too, I am wondering if it a typescript issue in wdio....

pmerwin avatar Jan 27 '21 20:01 pmerwin

Is there a work around in the meantime?

jtoy avatar Jan 28 '21 17:01 jtoy

I saw that chromedriver seemed to be trying to launch Chrome with a remote debugging port of 0, so tried adding this: chromeDriverArgs: ["--remote-debugging-port=9515", "--verbose"], to the spectron Application options. It changed the error - Chrome at least launches now - but the chrome logs now report a series of entries like this

1612043442.902][DEBUG]: DevTools HTTP Request: http://localhost:9515/json/version
[1612043442.904][DEBUG]: DevTools HTTP Request failed

mykter avatar Jan 30 '21 21:01 mykter

so no one is using electron and spectron recently?

jtoy avatar Feb 18 '21 23:02 jtoy

Any workarounds found for this? Thanks :)

pmerwin avatar Mar 09 '21 19:03 pmerwin

Bumping this thread, is there a functioning pairing of spectron and electron? electrno 10.1.6 and spectron 12.0.0.

ashmortar avatar Apr 07 '21 19:04 ashmortar

I saw that chromedriver seemed to be trying to launch Chrome with a remote debugging port of 0, so tried adding this: chromeDriverArgs: ["--remote-debugging-port=9515", "--verbose"], to the spectron Application options. It changed the error - Chrome at least launches now - but the chrome logs now report a series of entries like this

1612043442.902][DEBUG]: DevTools HTTP Request: http://localhost:9515/json/version
[1612043442.904][DEBUG]: DevTools HTTP Request failed

@mykter have u try port 3000, 80, and 8080?

dhanyn10 avatar Jun 11 '21 02:06 dhanyn10