Skip to content

Commit

Permalink
Merge branch 'develop' into renovate/graceful-fs-4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-shehane committed Oct 31, 2019
2 parents e6148f5 + c5b323a commit 89ba585
Show file tree
Hide file tree
Showing 51 changed files with 913 additions and 355 deletions.
28 changes: 24 additions & 4 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,10 @@ jobs:
- run:
environment:
DEBUG: electron-builder,electron-osx-sign*
command: npm run binary-build -- --platform $PLATFORM --version $NEXT_DEV_VERSION
# if this is a forked pull request, the NEXT_DEV_VERSION environment variable
# won't be set and we will use default version, since we are not going to
# upload the dev binary build anywhere
command: npm run binary-build -- --platform $PLATFORM --version ${NEXT_DEV_VERSION:-0.0.0-development}
- run: npm run binary-zip -- --platform $PLATFORM
# Cypress binary file should be zipped to cypress.zip
- run: ls -l *.zip
Expand Down Expand Up @@ -713,7 +716,7 @@ jobs:
at: ~/
- run:
name: bump NPM version
command: npm --no-git-tag-version version $NEXT_DEV_VERSION
command: npm --no-git-tag-version version ${NEXT_DEV_VERSION:-0.0.0-development}
- run:
name: build NPM package
working_directory: cli
Expand All @@ -735,8 +738,8 @@ jobs:
command: ls -l
# created file should have filename cypress-<version>.tgz
- run: mkdir /tmp/urls
- run: cp cli/build/cypress-$NEXT_DEV_VERSION.tgz cypress.tgz
- run: cp cli/build/cypress-$NEXT_DEV_VERSION.tgz /tmp/urls/cypress.tgz
- run: cp cli/build/cypress-${NEXT_DEV_VERSION:-0.0.0-development}.tgz cypress.tgz
- run: cp cli/build/cypress-${NEXT_DEV_VERSION:-0.0.0-development}.tgz /tmp/urls/cypress.tgz
- run: ls -l /tmp/urls
- store-npm-logs
- run: pwd
Expand Down Expand Up @@ -1114,11 +1117,20 @@ mac-workflow: &mac-workflow
- build:
name: Mac build
executor: mac
filters:
branches:
only:
- develop

- lint:
name: Mac lint
executor: mac
requires:
- Mac build
filters:
branches:
only:
- develop

# maybe run unit tests?

Expand All @@ -1127,6 +1139,10 @@ mac-workflow: &mac-workflow
executor: mac
requires:
- Mac build
filters:
branches:
only:
- develop

- upload-npm-package:
name: Mac NPM package upload
Expand Down Expand Up @@ -1164,6 +1180,10 @@ mac-workflow: &mac-workflow
- test-kitchensink:
name: Test Mac Kitchensink
executor: mac
filters:
branches:
only:
- develop
requires:
- Mac build

Expand Down
18 changes: 0 additions & 18 deletions cli/__snapshots__/spawn_spec.js

This file was deleted.

2 changes: 1 addition & 1 deletion cli/lib/exec/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module.exports = {
}

const { onStderrData, electronLogging } = overrides
const envOverrides = util.getEnvOverrides(options)
const envOverrides = util.getEnvOverrides()
const electronArgs = _.clone(args)
const node11WindowsFix = isPlatform('win32')

Expand Down
28 changes: 1 addition & 27 deletions cli/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const util = {
return isCi
},

getEnvOverrides (options = {}) {
getEnvOverrides () {
return _
.chain({})
.extend(util.getEnvColors())
Expand All @@ -193,35 +193,9 @@ const util = {
.mapValues((value) => { // stringify to 1 or 0
return value ? '1' : '0'
})
.extend(util.getNodeOptions(options))
.value()
},

getNodeOptions (options, nodeVersion) {
if (!nodeVersion) {
nodeVersion = Number(process.versions.node.split('.')[0])
}

if (options.dev && nodeVersion < 12) {
// `node` is used when --dev is passed, so this won't work if Node is too old
logger.warn('(dev-mode warning only) NODE_OPTIONS=--max-http-header-size could not be set. See https://github.com/cypress-io/cypress/pull/5452')

return
}

// https://github.com/cypress-io/cypress/issues/5431
const NODE_OPTIONS = `--max-http-header-size=${1024 * 1024}`

if (_.isString(process.env.NODE_OPTIONS)) {
return {
NODE_OPTIONS: `${NODE_OPTIONS} ${process.env.NODE_OPTIONS}`,
ORIGINAL_NODE_OPTIONS: process.env.NODE_OPTIONS || '',
}
}

return { NODE_OPTIONS }
},

getForceTty () {
return {
FORCE_STDIN_TTY: util.isTty(process.stdin.fd),
Expand Down
18 changes: 15 additions & 3 deletions cli/test/lib/exec/spawn_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ require('../../spec_helper')
const _ = require('lodash')
const cp = require('child_process')
const os = require('os')
const snapshot = require('snap-shot-it')
const tty = require('tty')
const path = require('path')
const EE = require('events')
Expand Down Expand Up @@ -288,7 +287,14 @@ describe('lib/exec/spawn', function () {

return spawn.start([], { env: {} })
.then(() => {
snapshot(cp.spawn.firstCall.args[2].env)
expect(cp.spawn.firstCall.args[2].env).to.deep.eq({
FORCE_COLOR: '1',
DEBUG_COLORS: '1',
MOCHA_COLORS: '1',
FORCE_STDERR_TTY: '1',
FORCE_STDIN_TTY: '1',
FORCE_STDOUT_TTY: '1',
})
})
})

Expand Down Expand Up @@ -320,7 +326,13 @@ describe('lib/exec/spawn', function () {

return spawn.start([], { env: {} })
.then(() => {
snapshot(cp.spawn.firstCall.args[2].env)
expect(cp.spawn.firstCall.args[2].env).to.deep.eq({
FORCE_COLOR: '0',
DEBUG_COLORS: '0',
FORCE_STDERR_TTY: '0',
FORCE_STDIN_TTY: '0',
FORCE_STDOUT_TTY: '0',
})
})
})

Expand Down
44 changes: 0 additions & 44 deletions cli/test/lib/util_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ require('../spec_helper')
const os = require('os')
const tty = require('tty')
const snapshot = require('../support/snapshot')
const mockedEnv = require('mocked-env')
const supportsColor = require('supports-color')
const proxyquire = require('proxyquire')
const hasha = require('hasha')
Expand All @@ -12,9 +11,6 @@ const la = require('lazy-ass')
const util = require(`${lib}/util`)
const logger = require(`${lib}/logger`)

// https://github.com/cypress-io/cypress/issues/5431
const expectedNodeOptions = `--max-http-header-size=${1024 * 1024}`

describe('util', () => {
beforeEach(() => {
sinon.stub(process, 'exit')
Expand Down Expand Up @@ -217,7 +213,6 @@ describe('util', () => {
FORCE_COLOR: '1',
DEBUG_COLORS: '1',
MOCHA_COLORS: '1',
NODE_OPTIONS: expectedNodeOptions,
})

util.supportsColor.returns(false)
Expand All @@ -229,46 +224,7 @@ describe('util', () => {
FORCE_STDERR_TTY: '0',
FORCE_COLOR: '0',
DEBUG_COLORS: '0',
NODE_OPTIONS: expectedNodeOptions,
})
})
})

context('.getNodeOptions', () => {
let restoreEnv

afterEach(() => {
if (restoreEnv) {
restoreEnv()
restoreEnv = null
}
})

it('adds required NODE_OPTIONS', () => {
restoreEnv = mockedEnv({
NODE_OPTIONS: undefined,
})

expect(util.getNodeOptions({})).to.deep.eq({
NODE_OPTIONS: expectedNodeOptions,
})
})

it('includes existing NODE_OPTIONS', () => {
restoreEnv = mockedEnv({
NODE_OPTIONS: '--foo --bar',
})

expect(util.getNodeOptions({})).to.deep.eq({
NODE_OPTIONS: `${expectedNodeOptions} --foo --bar`,
ORIGINAL_NODE_OPTIONS: '--foo --bar',
})
})

it('does not return if dev is set and version < 12', () => {
expect(util.getNodeOptions({
dev: true,
}, 11)).to.be.undefined
})
})

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"set-next-ci-version": "node ./scripts/binary.js setNextVersion",
"prestart": "npm run check-deps-pre",
"start": "node ./cli/bin/cypress open --dev --global",
"stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components --exclude e2e.coffee",
"stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,src --exclude e2e.coffee",
"stop-only-all": "npm run stop-only -- --folder packages",
"test": "echo '⚠️ This root monorepo is only for local development and new contributions. There are no tests.'",
"test-debug-package": "node ./scripts/test-debug-package.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"bluebird": "3.5.3",
"bootstrap-sass": "3.4.1",
"classnames": "2.2.6",
"cross-env": "5.2.0",
"cross-env": "5.2.1",
"fira": "cypress-io/fira#fb63362742eea8cdce0d90825ab9264d77719e3d",
"font-awesome": "4.7.0",
"gravatar": "1.8.0",
Expand Down
12 changes: 10 additions & 2 deletions packages/driver/src/cy/actionability.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
_ = require("lodash")
$ = require("jquery")
Promise = require("bluebird")
debug = require('debug')('cypress:driver:actionability')

$dom = require("../dom")
$utils = require("../cypress/utils")
Expand Down Expand Up @@ -49,8 +50,10 @@ ensureElIsNotCovered = (cy, win, $el, fromElViewport, options, log, onScroll) ->
## figure out the deepest element we are about to interact
## with at these coordinates
$elAtCoords = getElementAtPointFromViewport(fromElViewport)

debug('elAtCoords', $elAtCoords)
debug('el has pointer-events none?')
cy.ensureElDoesNotHaveCSS($el, 'pointer-events', 'none', log)
debug('is descendent of elAtCoords?')
cy.ensureDescendents($el, $elAtCoords, log)

return $elAtCoords
Expand All @@ -65,6 +68,8 @@ ensureElIsNotCovered = (cy, win, $el, fromElViewport, options, log, onScroll) ->
## from underneath this fixed position element until we can't
## anymore
$fixed = getFixedOrStickyEl($elAtCoords)

debug('elAtCoords is fixed', !!$fixed)

## if we dont have a fixed position
## then just bail, cuz we need to retry async
Expand Down Expand Up @@ -161,7 +166,10 @@ ensureElIsNotCovered = (cy, win, $el, fromElViewport, options, log, onScroll) ->

## and possibly recursively scroll past it
## if we haven't see it before
possiblyScrollMultipleTimes($fixed)
return possiblyScrollMultipleTimes($fixed)

## getElementAtPoint was falsey, so target element is no longer in the viewport
throw err
else
scrollContainers(scrollables)

Expand Down
15 changes: 12 additions & 3 deletions packages/driver/src/cy/commands/xhr.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ startXhrServer = (cy, state, config) ->
xhrUrl: config("xhrUrl")
stripOrigin: stripOrigin

emitIncoming: (id, route) ->
Cypress.backend('incoming:xhr', id, route)

## shouldnt these stubs be called routes?
## rename everything related to stubs => routes
onSend: (xhr, stack, route) =>
Expand Down Expand Up @@ -180,8 +183,10 @@ startXhrServer = (cy, state, config) ->
if log = logs[xhr.id]
log.snapshot("error").error(err)

if r = state("reject")
r(err)
## re-throw the error since this came from AUT code, and needs to
## cause an 'uncaught:exception' event. This error will be caught in
## top.onerror with stack as 5th argument.
throw err

onXhrAbort: (xhr, stack) =>
setResponse(state, xhr)
Expand Down Expand Up @@ -246,6 +251,10 @@ module.exports = (Commands, Cypress, cy, state, config) ->
## correctly
Cypress.on("window:unload", cancelPendingXhrs)

Cypress.on "test:before:run:async", ->
## reset any state on the backend
Cypress.backend('reset:xhr:server')

Cypress.on "test:before:run", ->
## reset the existing server
reset()
Expand All @@ -256,7 +265,7 @@ module.exports = (Commands, Cypress, cy, state, config) ->
## window such as if the last test ended
## with a cross origin window
try
server = startXhrServer(cy, state, config)
server = startXhrServer(cy, state, config, Cypress)
catch err
## in this case, just don't bind to the server
server = null
Expand Down
11 changes: 7 additions & 4 deletions packages/driver/src/cy/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ const shouldIgnoreEvent = <
}

const shouldUpdateValue = (el: HTMLElement, key: KeyDetails) => {
if (!key.text) return true
if (!key.text) return false

const bounds = $selection.getSelectionBounds(el)
const noneSelected = bounds.start === bounds.end
Expand Down Expand Up @@ -681,7 +681,9 @@ export class Keyboard {
const keysToType = keyDetailsArr.slice(currentKeyIndex, currentKeyIndex + _skipCheckUntilIndex)

_.each(keysToType, (key) => {
key.simulatedDefaultOnly = true
// singleValueChange inputs must have their value set once at the end
// performing the simulatedDefault for a key would try to insert text on each character
// we still send all the events as normal, however
key.simulatedDefault = _.noop
})

Expand All @@ -703,8 +705,9 @@ export class Keyboard {
debug('skipping validation due to *skipCheckUntilIndex*', _skipCheckUntilIndex)
}

if (key.simulatedDefaultOnly && key.simulatedDefault) {
key.simulatedDefault(activeEl, key, options)
// simulatedDefaultOnly keys will not send any events, and cannot be canceled
if (key.simulatedDefaultOnly) {
key.simulatedDefault!(activeEl, key, options)

return null
}
Expand Down

0 comments on commit 89ba585

Please sign in to comment.