Skip to content

Commit

Permalink
Electron v5.0.10 (cypress-io#4720)
Browse files Browse the repository at this point in the history
* fix specs

* use debugger protocol for cookie handling in electron

* use latest gulp

* use rimraf instead of gulp-clean

* use electron 3.1.8 and node 10.2.1

* use gulp 4 in packages/static

* fix sendCommandAsync, log Schema.getDomains on CDP connect

* autofill e2e test name [skip ci]

* [email protected], see what new failures exist

* --no-sandbox for launching Electron

* update cookies logic for electron

* node 12

* update snapshot for new node

* update error message for new node

* stub sendCommandAsync

* only connect to socket if path has been replaced, fixes cypress-io#4776

* update node-sass to support node 12

* skip wacky socket tests for now

* snapshot

* fix run_plugins_spec snapshot, don't include stack trace

* use --no-sandbox on linux to run as root

* allow sendCommandAsync to resolve

* use euid for root check

* log domains even if undefined

* don't worry about ending 1xx responses immediately anymore

* use --max-http-header-size, change max size from 8kb to 1mb, fix cypress-io#76

* do not send 502 on failed websocket, just send back ECONNRESET

* update websocket spec port to not collide with other test

* update outdated expect

* Revert "only connect to socket if path has been replaced, fixes cypress-io#4776"

This reverts commit f179eda.

* update gulp in root

* update https-proxy unit tests

* update network spec to properly close server

* update reporter spec

* update https-proxy-agent to fix node 10.10.0 change

discussion: https://github.com/nodejs/node/issues/24474\#issuecomment-511963799

* only pass --max-http-header-size on node >=12

* use own server-destroy implementation that supports secureConnect events

* oops

* update socket_spec

* electron 6.0.0

* console.table introduced in node 10

* change browserify entry to init.js

* handle edge case when no response body

* console.table added in node 10

* do not exit app when all BrowserWindows are closed

* update e2e snapshots

* value may not be null

* update plugins spec

* correct cookie expiry, use browser.getversion for CDP version check

* fix snapshotting for require stacks

* reorder cookies in spec

* warn when depreated electron callback apis are used

* only report 1 plugin error per process

* cleanup

* node 12.4.0, cypress/browsers:node12.4.0-chrome76 docker image

* update shell.openExternal to promisified

* update dialog.showOpenDialog to promisified

* update webContents.session.setProxy to promisified

* updating native dependencies since we don't need ancient node ABI support anymore

* WIP: switch cookies to simpler, jar-less approach

* WIP: switch cookies to simpler, jar-less approach

* making tests pass

* improve cookie filtering logic

* Remove unneeded Promise.try

* filter what makes it to the extension

* properly re-set superdomain cookies on cross-origin cy.visit

* allow comma-separated list of e2e tests

* sort cookies in order of expiration date, ascending

* updating tests, cleanup

* update tests

* version electron as a devDependency, [email protected]

* cleanup, remove old automation

* cleanup, remove old automation

* bump chokidar to fix win10 + node12 issue

was seeing this on windows:
nuxt/nuxt#6035

fixed with version bump

* enable now-supported quit role, re-enable old tests

* don't need that arg there

* remove last deprecated callback electron invocations

* Delete cypress.json

* responding to PR feedback

* cleanup

* invoke

* use 'quit' role

* Use new appMenu role for Cypress menu on mac

* [email protected]

* [email protected]

* remove domain: cookie.domain and see what happens

* remove setErrorHandler

* Revert "remove domain: cookie.domain and see what happens"

This reverts commit 49e9168.

* add unit tests for cookies

* ci

* fix project-content css

* [email protected]

* fix specs_list test

* [email protected]

* some cleanup

* [email protected]

* Update 8_reporters_spec.coffee.js

* [email protected] - Chromium 73, Node 12

* cli: fix the STDIN pipe on Windows (cypress-io#5045)

* cli: pipe stdin

* uggh, here is the actual change

* update cli unit tests

* add unit test

* more permissive check for json to include application/vnd.api+j… (cypress-io#5166)

* more permissive check for json to include

* add json test for content-type application/vnd.api+json

* cruder solution passes e2e tests locally, so let's go with that

* Remove 'charset' from content-type before checking if JSON

* fix eslint for fixture specs (cypress-io#5176)

* update eslint to lint files within 'fixtures' in support files

- ignore some edge cases like jquery, jsx and obvious js files we wrote
with broken code

* Fixes from eslint to 'fixtures' files

* Catch env variable with reserved name CYPRESS_ENV 1621 (cypress-io#1626)

* server: check CYPRESS_ENV variable when merging configs

* catch invalid CYPRESS_ENV value in CLI, close cypress-io#1621

* linting

* sanitize platform in test snapshot

* linting

* update error message text

* add missing comma

* fix finally merge in JS code

* pass CLI linter

* fix log reference, should be debug

* use correct sinon reference

* update message, show first part in red

* update error message text

* Addresses cypress-io#2953 (cypress-io#5174)

* Addresses cypress-io#2953

* Added proper test for new error message

* Didn't realize it ran this test as well, whoops

* Implementing changes as suggested by @jennifer-shehane

* Fixing tests and error output. Moved the checks to the start of the get command to ensure we always catch improper options

* Removing issue test since the querying spec covers it

* Using coffescript isArray check

* depromisify things that were promisified b/t electron 5 <=> 6

Revert "update shell.openExternal to promisified"

This reverts commit 8b6460d.

Revert "update dialog.showOpenDialog to promisified"

This reverts commit 5f178b0.

Revert "update webContents.session.setProxy to promisified"

This reverts commit 727df3a.

* node12.4.0-chrome76 => node12.0.0-chrome75

* fix tests for electron downgrade

* node12.0.0-chrome75 => node12.0.0-chrome73


Co-authored-by: Zach Bloomquist <[email protected]>
Co-authored-by: Brian Mann <[email protected]>
  • Loading branch information
3 people authored and grabartley committed Oct 6, 2019
1 parent 6961ce3 commit f33c193
Show file tree
Hide file tree
Showing 79 changed files with 1,151 additions and 1,166 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Cached Theme Material Design.pak
packages/https-proxy/ca/

# from desktop-gui
packages/desktop-gui/cypress/videos
packages/desktop-gui/src/jsconfig.json

# from driver
Expand All @@ -32,9 +33,6 @@ packages/example/app
packages/example/build
packages/example/cypress

# from driver
packages/driver/test/cypress/videos

# from server
packages/server/.cy
packages/server/.projects
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.9.3
12.4.0
2 changes: 1 addition & 1 deletion .vscode/terminals.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"onlySingle": true,
"execute": false,
"cwd": "[cwd]/packages/server",
"command": "npm run test-e2e -- --spec name"
"command": "npm run test-e2e -- --spec [fileBasename]"
},
{
"name": "packages/runner watch",
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ branches:
# https://www.appveyor.com/docs/lang/nodejs-iojs/
environment:
# use matching version of Node.js
nodejs_version: "8.9.3"
nodejs_version: "12.4.0"
# encode secure variables which will NOT be used
# in pull requests
# https://www.appveyor.com/docs/build-configuration/#secure-variables
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ executors:
# the Docker image with Cypress dependencies and Chrome browser
cy-doc:
docker:
- image: cypress/browsers:node8.9.3-npm6.10.1-chrome75
- image: cypress/browsers:node12.0.0-chrome73
environment:
PLATFORM: linux

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"cloudflare-cli": "3.2.2",
"coffeelint": "1.16.2",
"common-tags": "1.8.0",
"console.table": "0.10.0",
"debug": "4.1.1",
"decaffeinate": "6.0.1",
"del": "3.0.0",
Expand Down Expand Up @@ -161,7 +160,7 @@
"vinyl-paths": "2.1.0"
},
"engines": {
"node": ">=8.9.3"
"node": "12.4.0"
},
"productName": "Cypress",
"license": "MIT",
Expand Down
9 changes: 0 additions & 9 deletions packages/desktop-gui/cypress/integration/login_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('Login', function () {
cy.stub(this.ipc, 'openProject').resolves(this.config)
cy.stub(this.ipc, 'getSpecs').yields(null, this.specs)
cy.stub(this.ipc, 'externalOpen')
cy.stub(this.ipc, 'clearGithubCookies')
cy.stub(this.ipc, 'logOut').resolves()

cy.stub(this.ipc, 'onAuthMessage').callsFake((function (_this) {
Expand Down Expand Up @@ -124,14 +123,6 @@ describe('Login', function () {
cy.get('.nav').contains('Log In')
})

it('calls clear:github:cookies', function () {
cy.get('nav a').contains('Jane').click()

cy.contains('Log Out').click().then(function () {
expect(this.ipc.clearGithubCookies).to.be.called
})
})

it('calls log:out', function () {
cy.get('nav a').contains('Jane').click()

Expand Down
1 change: 0 additions & 1 deletion packages/desktop-gui/src/auth/auth-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class AuthApi {
logOut () {
authStore.setUser(null)

ipc.clearGithubCookies()
ipc.logOut()
.catch((err) => {
err.name = 'An unexpected error occurred while logging out'
Expand Down
2 changes: 0 additions & 2 deletions packages/desktop-gui/src/lib/ipc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const ipc = {
handleUnauthed () {
authStore.setUser(null)

ipc.clearGithubCookies()
ipc.logOut()
},
}
Expand All @@ -32,7 +31,6 @@ const register = (eventName, isPromiseApi = true) => {
register('add:project')
register('begin:auth')
register('on:auth:message', false)
register('clear:github:cookies')
register('close:browser')
register('close:project')
register('external:open')
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-gui/src/project/project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
flex-grow: 2;
margin-bottom: 0;
width: 100%;
min-height: 0;
}
1 change: 1 addition & 0 deletions packages/desktop-gui/src/specs/specs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ $max-nesting-level: 14;
display: flex;
flex-direction: column;
width: 100%;
min-height: 0;

.empty-well code {
display: block;
Expand Down
10 changes: 5 additions & 5 deletions packages/driver/src/cy/stability.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ tryFn = (fn) ->
Promise.try(fn)

create = (Cypress, state) ->
isStable = (bool = true, event) ->
return if state("isStable") is bool
isStable = (stable = true, event) ->
return if state("isStable") is stable

## if we are going back to stable and we have
## a whenStable callback
if bool and whenStable = state("whenStable")
if stable and whenStable = state("whenStable")
## invoke it
whenStable()

state("isStable", bool)
state("isStable", stable)

## we notify the outside world because this is what the runner uses to
## show the 'loading spinner' during an app page loading transition event
Cypress.action("cy:stability:changed", bool, event)
Cypress.action("cy:stability:changed", stable, event)

whenStable = (fn) ->
## if we are not stable
Expand Down
13 changes: 11 additions & 2 deletions packages/electron/lib/electron.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
fs = require("fs-extra")
cp = require("child_process")
os = require("os")
path = require("path")
debug = require("debug")("cypress:electron")
Promise = require("bluebird")
Expand Down Expand Up @@ -59,6 +60,10 @@ module.exports = {
.then ->
execPath = paths.getPathToExec()

## if running as root, no-sandbox must be passed or Chrome will not start
if os.platform() == "linux" && process.geteuid() == 0
argv.unshift("--no-sandbox")

## we have an active debugger session
if inspector.url()
dp = process.debugPort + 1
Expand All @@ -70,15 +75,19 @@ module.exports = {
if opts.inspectBrk
argv.unshift("--inspect-brk=5566")

## max HTTP header size 8kb -> 1mb
## https://github.com/cypress-io/cypress/issues/76
argv.unshift("--max-http-header-size=#{1024*1024}")

debug("spawning %s with args", execPath, argv)

if debug.enabled
## enable the internal chromium logger
argv.push("--enable-logging")

cp.spawn(execPath, argv, {stdio: "inherit"})
.on "close", (code) ->
debug("electron closing with code", code)
.on "close", (code, errCode) ->
debug("electron closing %o", { code, errCode })

if code
debug("original command was")
Expand Down
4 changes: 2 additions & 2 deletions packages/electron/lib/install.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ log = require("debug")("cypress:electron")
fs = Promise.promisifyAll(fs)

## ensure we have an electronVersion set in package.json
if not electronVersion = pkg.electronVersion
throw new Error("Missing 'electronVersion' in ./package.json")
if not electronVersion = pkg.devDependencies.electron
throw new Error("Missing 'electron' devDependency in ./package.json")

module.exports = {
checkCurrentVersion: ->
Expand Down
4 changes: 2 additions & 2 deletions packages/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"minimist": "1.2.0"
},
"devDependencies": {
"electron": "5.0.10",
"mocha": "3.5.3"
},
"files": [
Expand All @@ -34,6 +35,5 @@
],
"bin": {
"cypress-electron": "./bin/cypress-electron"
},
"electronVersion": "2.0.18"
}
}
41 changes: 19 additions & 22 deletions packages/example/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
let gulp = require('gulp')
let ghPages = require('gulp-gh-pages-will')
let clean = require('gulp-clean')
let RevAll = require('gulp-rev-all')
const gulp = require('gulp')
const ghPages = require('gulp-gh-pages-will')
const gulpClean = require('gulp-clean')
const RevAll = require('gulp-rev-all')

gulp.task('assets', function () {
let revAllOpts = {
const assets = () => {
const revAllOpts = {
dontGlobal: ['.ico', 'fira.css', 'javascript-logo.png'],
dontRenameFile: ['.ico', '.html', /fonts/],
dontSearchFile: ['.js'],
Expand All @@ -14,28 +14,25 @@ gulp.task('assets', function () {
return gulp.src('./app/**/*')
.pipe(RevAll.revision(revAllOpts))
.pipe(gulp.dest('build'))
})
}

gulp.task('cname', function () {
return gulp.src('CNAME')
const cname = () => {
return gulp.src('CNAME', { allowEmpty: true })
.pipe(gulp.dest('build'))
})
}

gulp.task('gitignore', function () {
return gulp.src('.gitignore', { allowEmpty: true })
.pipe(gulp.dest('build'))
})

gulp.task('clean', function () {
const clean = () => {
return gulp.src('./build', { allowEmpty: true })
.pipe(clean())
})
.pipe(gulpClean())
}

gulp.task('push-gh-pages', function () {
const pushGhPages = () => {
return gulp.src('build/**/*')
.pipe(ghPages())
})
}

const build = gulp.series(clean, gulp.parallel(assets, cname))

gulp.task('build', gulp.series('clean', gulp.parallel('assets', 'cname', 'gitignore')))
exports.build = build

gulp.task('deploy', gulp.series('build', 'push-gh-pages'))
exports.deploy = gulp.series(build, pushGhPages)
8 changes: 7 additions & 1 deletion packages/extension/app/background.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ once = require("lodash/once")
Promise = require("bluebird")
client = require("./client")

COOKIE_PROPS = ['url', 'name', 'domain', 'path', 'secure', 'storeId']
GET_ALL_PROPS = COOKIE_PROPS.concat(['session'])
SET_PROPS = COOKIE_PROPS.concat(['value', 'httpOnly', 'expirationDate'])

httpRe = /^http/

firstOrNull = (cookies) ->
Expand Down Expand Up @@ -61,7 +65,7 @@ connect = (host, path) ->
ws.emit("automation:client:connected")

return ws

automation = {
connect

Expand All @@ -85,6 +89,7 @@ automation = {
.map(clear)

getAll: (filter = {}) ->
filter = pick(filter, GET_ALL_PROPS)
get = ->
new Promise (resolve) ->
chrome.cookies.getAll(filter, resolve)
Expand All @@ -105,6 +110,7 @@ automation = {
new Promise (resolve, reject) =>
## only get the url if its not already set
props.url ?= @getUrl(props)
props = pick(props, SET_PROPS)
chrome.cookies.set props, (details) ->
switch
when details
Expand Down
Loading

0 comments on commit f33c193

Please sign in to comment.