electron-userland / spectron

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

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

Open DWboutin opened 3 years ago

DWboutin commented 3 years ago

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

clai96 commented 3 years ago

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
quasivivo commented 3 years ago

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)

jtoy commented 3 years ago

Same issue

pmerwin commented 3 years ago

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

jtoy commented 3 years ago

Is there a work around in the meantime?

mykter commented 3 years ago

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
jtoy commented 3 years ago

so no one is using electron and spectron recently?

pmerwin commented 3 years ago

Any workarounds found for this? Thanks :)

ashmortar commented 3 years ago

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

dhanyn10 commented 3 years ago

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?