Skip to content

Commit

Permalink
Merge pull request #418 from gemini-testing/feat/session.id
Browse files Browse the repository at this point in the history
feat: send session id on browser session events
  • Loading branch information
j0tunn authored Jul 7, 2019
2 parents bcb131f + 189faff commit 0215315
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/browser-pool/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ exports.create = function(config, emitter) {
};

function emitSessionEvent(emitter, browser, event) {
return emitter.emitAndWait(event, browser.publicAPI, {browserId: browser.id});
return emitter.emitAndWait(event, browser.publicAPI, {browserId: browser.id, sessionId: browser.sessionId});
}
13 changes: 10 additions & 3 deletions test/lib/browser-pool/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ describe('browser-pool', () => {

describe('browser manager', () => {
const getBrowserManager = () => CoreBrowserPool.create.lastCall.args[0];
const stubBrowser = (id, publicAPI) => {
const stubBrowser = ({id, sessionId, publicAPI} = {}) => {
return {
id,
sessionId,
publicAPI,
init: sandbox.stub(),
quit: sandbox.stub()
Expand Down Expand Up @@ -76,8 +77,14 @@ describe('browser-pool', () => {

emitter.on(event, onEvent);

return BrowserManager[method](stubBrowser('bro', {public: 'api'}))
.then(() => assert.calledOnceWith(onEvent, {public: 'api'}, {browserId: 'bro'}));
const browser = stubBrowser({
id: 'bro',
sessionId: '100500',
publicAPI: {public: 'api'}
});

return BrowserManager[method](browser)
.then(() => assert.calledOnceWith(onEvent, {public: 'api'}, {browserId: 'bro', sessionId: '100500'}));
});

it('should wait all async listeners', () => {
Expand Down

0 comments on commit 0215315

Please sign in to comment.