Skip to content

Commit

Permalink
feat(browser): add browser_info event
Browse files Browse the repository at this point in the history
fixes #2192
  • Loading branch information
maksimr committed Mar 29, 2017
1 parent 28e77e0 commit 09ac7d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/browser.js
Expand Up @@ -112,6 +112,13 @@ var Browser = function (id, fullName, /* capturedBrowsers */ collection, emitter
emitter.emit('browser_log', this, info.log, info.type)
}

if (
!helper.isDefined(info.log) &&
!helper.isDefined(info.dump)
) {
emitter.emit('browser_info', this, info)
}

refreshNoActivityTimeout()
}

Expand Down
10 changes: 10 additions & 0 deletions test/unit/browser.spec.js
Expand Up @@ -106,6 +106,16 @@ describe('Browser', () => {
expect(spy).to.have.been.calledWith(browser, 'something', 'info')
})

it('should emit "browser_info"', () => {
var spy = sinon.spy()
var infoData = {}
emitter.on('browser_info', spy)

browser.state = Browser.STATE_EXECUTING
browser.onInfo(infoData)
expect(spy).to.have.been.calledWith(browser, infoData)
})

it('should ignore if browser not executing', () => {
var spy = sinon.spy()
emitter.on('browser_dump', spy)
Expand Down

0 comments on commit 09ac7d7

Please sign in to comment.