Skip to content

Commit

Permalink
fix: close chrome when closing electron (#19322)
Browse files Browse the repository at this point in the history
  • Loading branch information
estrada9166 authored Dec 9, 2021
1 parent 65cf6e8 commit f79bdd6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/server/lib/browsers/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,13 @@ export = {
const originalBrowserKill = launchedBrowser.kill

/* @ts-expect-error */
launchedBrowser.kill = async (...args) => {
launchedBrowser.kill = (...args) => {
debug('closing remote interface client')

await criClient.close()
criClient.close()
debug('closing chrome')

await originalBrowserKill.apply(launchedBrowser, args)
originalBrowserKill.apply(launchedBrowser, args)
}

await this._maybeRecordVideo(criClient, options, browser.majorVersion)
Expand Down
1 change: 0 additions & 1 deletion packages/server/lib/browsers/cri-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export const create = Bluebird.method((target: websocketUrl, onAsynchronousError
maybeDebugCdpMessages(cri)

cri.send = Bluebird.promisify(cri.send, { context: cri })
cri.close = Bluebird.promisify(cri.close, { context: cri })

// @see https://github.com/cyrus-and/chrome-remote-interface/issues/72
cri._notifier.on('disconnect', reconnect)
Expand Down
5 changes: 2 additions & 3 deletions packages/server/test/unit/browsers/chrome_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,9 @@ describe('lib/browsers/chrome', () => {
.then(() => {
expect(this.launchedBrowser.kill).to.be.a('function')

return this.launchedBrowser.kill()
}).then(() => {
expect(this.criClient.close).to.be.calledOnce
this.launchedBrowser.kill()

expect(this.criClient.close).to.be.calledOnce
expect(kill).to.be.calledOnce
})
})
Expand Down

3 comments on commit f79bdd6

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f79bdd6 Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.2/circle-develop-f79bdd665ada815fbfa238baac7a66c38d3b5d82/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f79bdd6 Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.2/circle-develop-f79bdd665ada815fbfa238baac7a66c38d3b5d82/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f79bdd6 Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.2/circle-develop-f79bdd665ada815fbfa238baac7a66c38d3b5d82/cypress.tgz

Please sign in to comment.