Skip to content

Commit

Permalink
feat(deps): electron@9.0.5 (#7791)
Browse files Browse the repository at this point in the history
* chore(deps): electron@9.0.5

BREAKING CHANGE: libgbm is a requirement

* update node, xcode, docker images

* lockfile

* chore(types): tsify lib/gui/windows and spec

* fix Electron extension loading

global extension loading was deprecated in 9, now has to be per-session

* make windows fns stubbable

* update electron_spec

* tsify issue_173_spec

* use upstream foxdriver to fix FF >= 75

see benmalka/foxdriver#7

* update test

* for now, install libgbm-dev at ci time

see cypress-io/cypress-docker-images#332

* fix open mode

* remove devtools-ext dir
  • Loading branch information
flotwig committed Jun 29, 2020
1 parent 8c998f1 commit ffcb036
Show file tree
Hide file tree
Showing 23 changed files with 419 additions and 452 deletions.
2 changes: 1 addition & 1 deletion .node-version
@@ -1 +1 @@
12.8.1
12.14.1
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -7,7 +7,7 @@ branches:
# https://www.appveyor.com/docs/lang/nodejs-iojs/
environment:
# use matching version of Node.js
nodejs_version: "12.8.1"
nodejs_version: "12.14.1"
# encode secure variables which will NOT be used
# in pull requests
# https://www.appveyor.com/docs/build-configuration/#secure-variables
Expand Down
11 changes: 7 additions & 4 deletions circle.yml
Expand Up @@ -43,14 +43,14 @@ executors:
# the Docker image with Cypress dependencies and Chrome browser
cy-doc:
docker:
- image: cypress/browsers:node12.13.0-chrome80-ff74
- image: cypress/browsers:node12.14.1-chrome83-ff77
environment:
PLATFORM: linux

# Docker image with non-root "node" user
non-root-docker-user:
docker:
- image: cypress/browsers:node12.13.0-chrome80-ff74
- image: cypress/browsers:node12.14.1-chrome83-ff77
user: node
environment:
PLATFORM: linux
Expand All @@ -60,8 +60,8 @@ executors:
# https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions
mac:
macos:
## Node 12.10.0 (yarn 1.17.3)
xcode: "11.0.0"
## Node 12.12.0 (yarn 1.19.1)
xcode: "11.2.1"
environment:
PLATFORM: mac

Expand Down Expand Up @@ -1144,6 +1144,9 @@ jobs:
- run: mkdir test-binary
- run: node --version
- run: npm --version
# TODO: this can be removed as soon as the minimum Node version is bumped to 10
# see https://github.com/cypress-io/cypress-docker-images/pull/332
- run: apt-get update && apt-get install -y libgbm-dev
- run:
name: Create new NPM package
working_directory: test-binary
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -187,7 +187,7 @@
"typescript": "3.7.4"
},
"engines": {
"node": ">=12.8.1",
"node": ">=12.14.1",
"yarn": ">=1.17.3"
},
"productName": "Cypress",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron/package.json
Expand Up @@ -24,7 +24,7 @@
"minimist": "1.2.5"
},
"devDependencies": {
"electron": "8.3.1",
"electron": "9.0.5",
"mocha": "3.5.3"
},
"files": [
Expand Down
16 changes: 8 additions & 8 deletions packages/server/lib/browsers/electron.js
Expand Up @@ -66,12 +66,12 @@ const _getAutomation = function (win, options) {
return automation
}

const _installExtensions = function (extensionPaths = [], options) {
Windows.removeAllExtensions()
const _installExtensions = function (win, extensionPaths = [], options) {
Windows.removeAllExtensions(win)

return extensionPaths.forEach((path) => {
return Bluebird.map(extensionPaths, (path) => {
try {
return Windows.installExtension(path)
return Windows.installExtension(win, path)
} catch (error) {
return options.onWarning(errors.get('EXTENSION_NOT_LOADED', 'Electron', path))
}
Expand Down Expand Up @@ -349,10 +349,10 @@ module.exports = {

debug('launching browser window to url: %s', url)

_installExtensions(launchOptions.extensions, options)

return this._render(url, projectRoot, automation, preferences)
.then((win) => {
.then(async (win) => {
await _installExtensions(win, launchOptions.extensions, options)

// cause the webview to receive focus so that
// native browser focus + blur events fire correctly
// https://github.com/cypress-io/cypress/issues/1939
Expand All @@ -363,7 +363,7 @@ module.exports = {
win.once('closed', () => {
debug('closed event fired')

Windows.removeAllExtensions()
Windows.removeAllExtensions(win)

return events.emit('exit')
})
Expand Down
2 changes: 1 addition & 1 deletion packages/server/lib/browsers/firefox-util.ts
Expand Up @@ -4,7 +4,7 @@ import _ from 'lodash'
import Marionette from 'marionette-client'
import { Command } from 'marionette-client/lib/marionette/message.js'
import util from 'util'
import Foxdriver from '@benmalka/foxdriver'
import Foxdriver from 'foxdriver'
import * as protocol from './protocol'

const errors = require('../errors')
Expand Down
9 changes: 7 additions & 2 deletions packages/server/lib/gui/events.js
Expand Up @@ -36,6 +36,11 @@ const nullifyUnserializableValues = (obj) => {
const handleEvent = function (options, bus, event, id, type, arg) {
debug('got request for event: %s, %o', type, arg)

_.defaults(options, {
windowOpenFn: Windows.open,
getWindowByWebContentsFn: Windows.getByWebContents,
})

const sendResponse = function (originalData = {}) {
try {
const data = nullifyUnserializableValues(originalData)
Expand Down Expand Up @@ -161,12 +166,12 @@ const handleEvent = function (options, bus, event, id, type, arg) {
.catch(sendErr)

case 'window:open':
return Windows.open(options.projectRoot, arg)
return options.windowOpenFn(options.projectRoot, arg)
.then(send)
.catch(sendErr)

case 'window:close':
return Windows.getByWebContents(event.sender).destroy()
return options.getWindowByWebContentsFn(event.sender).destroy()

case 'open:file':
return fileOpener.openFile(arg)
Expand Down

0 comments on commit ffcb036

Please sign in to comment.