electron-userland / spectron

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

Can not obtain main process logs after app.stop() #138

Open salomvary opened 7 years ago

salomvary commented 7 years ago

Given an application based on the Electron quick-start example plus some console.logs (eg. first line of main.js) and start-stop.js as below:

'use strict'

const { Application } = require('spectron')

new Application({
  args: [ 'main.js' ],
  path: 'node_modules/.bin/electron'
})
.start()
.then(app => app.stop())
.then(app => {
  app.client.getMainProcessLogs().then(function (logs) {
    logs.forEach(function (log) {
      console.log(log)
    })
  })
})

Expected: all logs during application run are printed out. Actual: nothing is printed out.

Use case: debugging events triggered during quitting the application.

Electron 1.4.4 Spectron 3.4.0 Node 6.2.2

zeke commented 7 years ago

Can you revise your code to call getMainProcessLogs just before stopping the app?

salomvary commented 7 years ago

@zeke Do you mean getting logs before stop in addition to getting it after stop?

The whole problem here is getting logs that are potentially created during application quit.

zeke commented 7 years ago

The whole problem here is getting logs that are potentially created during application quit.

Sorry, didn't realize that was your intent. In that case, I'm not sure.