Skip to content

Commit

Permalink
Merge branch 'develop' into issue-5772-ts-checks
Browse files Browse the repository at this point in the history
# Conflicts:
#	yarn.lock
  • Loading branch information
jennifer-shehane committed Mar 16, 2020
2 parents 5fc7cb5 + aeb851e commit 9faec67
Show file tree
Hide file tree
Showing 19 changed files with 141 additions and 141 deletions.
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ executors:
# the Docker image with Cypress dependencies and Chrome browser
cy-doc:
docker:
- image: cypress/browsers:node12.8.1-chrome80-ff72
- image: cypress/browsers:node12.13.0-chrome80-ff74
environment:
PLATFORM: linux

Expand Down
2 changes: 0 additions & 2 deletions cli/__snapshots__/verify_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ Cypress Version: 1.2.3
`

exports['fails verifying Cypress 1'] = `
It looks like this is your first time using Cypress: 1.2.3
✖ Verifying Cypress can run /cache/Cypress/1.2.3/Cypress.app
STRIPPED
Expand Down Expand Up @@ -309,7 +308,6 @@ Opening Cypress...
`

exports['verification with executable 1'] = `
It looks like this is your first time using Cypress: 1.2.3
✔ Verified Cypress! /cache/Cypress/1.2.3/Cypress.app
Expand Down
9 changes: 6 additions & 3 deletions cli/lib/tasks/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,12 @@ const runSmokeTest = (binaryDir, options) => {
function testBinary (version, binaryDir, options) {
debug('running binary verification check', version)

logger.log(stripIndent`
It looks like this is your first time using Cypress: ${chalk.cyan(version)}
`)
// if running from 'cypress verify', don't print this message
if (!options.force) {
logger.log(stripIndent`
It looks like this is your first time using Cypress: ${chalk.cyan(version)}
`)
}

logger.log()

Expand Down
4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"listr": "0.14.3",
"lodash": "4.17.15",
"log-symbols": "3.0.0",
"minimist": "1.2.0",
"minimist": "1.2.2",
"moment": "2.24.0",
"ospath": "1.2.2",
"pretty-bytes": "5.3.0",
Expand Down Expand Up @@ -83,7 +83,7 @@
"mocha": "6.2.2",
"mock-fs": "4.9.0",
"mocked-env": "1.2.4",
"nock": "9.6.1",
"nock": "12.0.2",
"postinstall-postinstall": "2.0.0",
"proxyquire": "2.1.0",
"resolve-pkg": "2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
},
"devDependencies": {
"@cypress/bumpercar": "2.0.12",
"@cypress/commit-message-install": "3.1.1",
"@cypress/commit-message-install": "3.1.2",
"@cypress/env-or-json-file": "2.0.0",
"@cypress/eslint-plugin-dev": "5.0.0",
"@cypress/github-commit-status-check": "1.5.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/desktop-gui/cypress/integration/specs_list_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,12 @@ describe('Specs List', function () {
})

context('collapsing specs', function () {
it('sets folder collapsed when clicked', function () {
it('sets folder collapsed when clicked with correct icon', () => {
cy.get('.folder:first').should('have.class', 'folder-expanded')
cy.get('.folder-collapse-icon:first').should('have.class', 'fa-caret-down')
cy.get('.folder .folder-name:first').click()

cy.get('.folder-collapse-icon:first').should('have.class', 'fa-caret-right')
cy.get('.folder:first').should('have.class', 'folder-collapsed')
})

Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-gui/src/specs/specs-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class SpecsList extends Component {
<div>
<div className="folder-name" onClick={this._selectSpecFolder.bind(this, spec)}>
<i className={`folder-collapse-icon fas fa-fw ${isExpanded ? 'fa-caret-down' : 'fa-caret-right'}`}></i>
<i className={`far fa-fw ${isExpanded ? 'fa-folder-open' : 'fa-folder'}`}></i>
{nestingLevel !== 0 ? <i className={`far fa-fw ${isExpanded ? 'fa-folder-open' : 'fa-folder'}`}></i> : null}
{
nestingLevel === 0 ?
<>
Expand Down
3 changes: 1 addition & 2 deletions packages/desktop-gui/src/specs/specs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,9 @@ $max-nesting-level: 14;
font-family: $font-sans;
display: flex;
flex-direction: row;
justify-content: space-between;

i {
display: none;
display: block;
margin-right: 5px;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"method-override": "3.0.0",
"methods": "1.1.2",
"minimatch": "3.0.4",
"minimist": "1.2.0",
"minimist": "1.2.2",
"mocha": "7.0.1",
"moment": "2.24.0",
"morgan": "1.9.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"electron-packager": "14.1.1",
"fs-extra": "8.1.0",
"lodash": "4.17.15",
"minimist": "1.2.0"
"minimist": "1.2.2"
},
"devDependencies": {
"electron": "7.1.13",
"electron": "8.1.1",
"mocha": "3.5.3"
},
"files": [
Expand Down
20 changes: 15 additions & 5 deletions packages/server/__snapshots__/request_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ exports['lib/request #sendPromise followRedirect gets + attaches the cookies at
"setCalls": [
{
"currentUrl": "http://localhost:1234/",
"setCookie": "one=1"
"setCookie": [
"one=1"
]
},
{
"currentUrl": "http://localhost:1234/second",
"setCookie": "two=2"
"setCookie": [
"two=2"
]
},
{
"currentUrl": "http://localhost:1234/third",
"setCookie": "three=3"
"setCookie": [
"three=3"
]
}
],
"getCalls": [
Expand All @@ -30,11 +36,15 @@ exports['lib/request #sendStream gets + attaches the cookies at each redirect 1'
"setCalls": [
{
"currentUrl": "http://localhost:1234/",
"setCookie": "one=1"
"setCookie": [
"one=1"
]
},
{
"currentUrl": "http://localhost:1234/second",
"setCookie": "two=2"
"setCookie": [
"two=2"
]
}
],
"getCalls": [
Expand Down
2 changes: 1 addition & 1 deletion packages/server/lib/browsers/cdp_automation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const CdpAutomation = (sendDebuggerCommandFn: SendDebuggerCommand) => {
case 'remote:debugger:protocol':
return sendDebuggerCommandFn(data.command, data.params)
case 'take:screenshot':
return sendDebuggerCommandFn('Page.captureScreenshot')
return sendDebuggerCommandFn('Page.captureScreenshot', { format: 'png' })
.catch((err) => {
throw new Error(`The browser responded with an error when Cypress attempted to take a screenshot.\n\nDetails:\n${err.message}`)
})
Expand Down
46 changes: 30 additions & 16 deletions packages/server/lib/browsers/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,36 @@ const tryToCall = function (win, method) {
}
}

const getAutomation = function (win) {
const _getAutomation = function (win, options) {
const sendCommand = Bluebird.method((...args) => {
return tryToCall(win, () => {
return win.webContents.debugger.sendCommand
.apply(win.webContents.debugger, args)
})
})

return CdpAutomation(sendCommand)
const automation = CdpAutomation(sendCommand)

if (!options.onScreencastFrame) {
// after upgrading to Electron 8, CDP screenshots can hang if a screencast is not also running
// workaround: start and stop screencasts between screenshots
// @see https://github.com/cypress-io/cypress/pull/6555#issuecomment-596747134
automation.onRequest = _.wrap(automation.onRequest, async (fn, message, data) => {
if (message !== 'take:screenshot') {
return fn(message, data)
}

await sendCommand('Page.startScreencast')

const ret = await fn(message, data)

await sendCommand('Page.stopScreencast')

return ret
})
}

return automation
}

const _installExtensions = function (extensionPaths = [], options) {
Expand All @@ -61,14 +82,12 @@ const _maybeRecordVideo = function (webContents, options) {
return async () => {
const { onScreencastFrame } = options

if (!onScreencastFrame) {
debug('options.onScreencastFrame is falsy')
debug('maybe recording video %o', { onScreencastFrame })

if (!onScreencastFrame) {
return
}

debug('starting screencast')

webContents.debugger.on('message', (event, method, params) => {
if (method === 'Page.screencastFrame') {
onScreencastFrame(params)
Expand Down Expand Up @@ -132,12 +151,12 @@ module.exports = {
return _.defaultsDeep({}, options, defaults)
},

_getAutomation: getAutomation,
_getAutomation,

_render (url, projectRoot, automation, options = {}) {
const win = Windows.create(projectRoot, options)

automation.use(getAutomation(win))
automation.use(_getAutomation(win, options))

return this._launch(win, url, options)
.tap(_maybeRecordVideo(win.webContents, options))
Expand Down Expand Up @@ -215,11 +234,9 @@ module.exports = {

_attachDebugger (webContents) {
try {
webContents.debugger.attach()
webContents.debugger.attach('1.3')
debug('debugger attached')
} catch (error) {
const err = error

} catch (err) {
debug('debugger attached failed %o', { err })
throw err
}
Expand Down Expand Up @@ -263,10 +280,7 @@ module.exports = {
_enableDebugger (webContents) {
debug('debugger: enable Console and Network')

return Bluebird.join(
webContents.debugger.sendCommand('Console.enable'),
webContents.debugger.sendCommand('Network.enable'),
)
return webContents.debugger.sendCommand('Console.enable')
},

_getPartition (options) {
Expand Down
41 changes: 0 additions & 41 deletions packages/server/lib/screenshots.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -166,47 +166,6 @@ pixelConditionFn = (data, image) ->

multipartImages = []

# compareUntilPixelsDiffer = (img1, img2) ->
## NOTE: this is for comparing pixel by pixel which is useful
## if you're trying to dig into the specific pixel differences
##
## we're making this as efficient as possible because
## there are significant performance problems
## getting a hash or buffer of all the image data.
##
## instead we will walk through two images comparing
## them pixel by pixel until they don't match.
#
# iterations = 0
#
# { width, height } = img2.bitmap
#
# data1 = img1.bitmap.data
# data2 = img2.bitmap.data
#
# ret = (differences) ->
# return {
# iterations
# differences
# }
#
# for y in [0...height]
# for x in [0...width]
# iterations += 1
#
# idx = (width * y + x) << 2
#
# pix1 = data1.readUInt32BE(idx)
# pix2 = data2.readUInt32BE(idx)
#
# if pix1 isnt pix2
# return ret([
# intToRGBA(pix1),
# intToRGBA(pix2)
# ])
#
# return ret(null)

clearMultipartState = ->
debug("clearing %d cached multipart images", multipartImages.length)
multipartImages = []
Expand Down
3 changes: 3 additions & 0 deletions packages/server/lib/util/electron-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const waitForReady = () => {
const Promise = require('bluebird')
const { app } = require('electron')

// @see https://github.com/electron/electron/issues/18397
app.allowRendererProcessReuse = true

// electron >= 5.0.0 will exit the app if all browserwindows are closed,
// this is obviously undesirable in run mode
// https://github.com/cypress-io/cypress/pull/4720#issuecomment-514316695
Expand Down
4 changes: 2 additions & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"md5": "2.2.1",
"mime": "1.6.0",
"minimatch": "3.0.4",
"minimist": "1.2.0",
"minimist": "1.2.2",
"mocha": "2.4.5",
"mocha-junit-reporter": "1.23.1",
"mocha-teamcity-reporter": "3.0.0",
Expand Down Expand Up @@ -168,7 +168,7 @@
"mocked-env": "1.2.4",
"mockery": "2.1.0",
"multiparty": "4.2.1",
"nock": "9.6.1",
"nock": "12.0.2",
"npm-install-version": "6.0.2",
"proxyquire": "2.1.0",
"react": "15.6.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/server/test/unit/request_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,14 @@ describe "lib/request", ->
"Request Headers": {"accept": "*/*", "accept-encoding": "gzip, deflate", "connection": "keep-alive", "host": "www.github.com"}
"Request URL": "http://www.github.com/dashboard"
"Response Body": null
"Response Headers": {"location": "/auth"}
"Response Headers": {"content-type": "application/json", "location": "/auth"}
"Response Status": 301
}, {
"Request Body": null
"Request Headers": {"accept": "*/*", "accept-encoding": "gzip, deflate", "connection": "keep-alive", "host": "www.github.com", "referer": "http://www.github.com/dashboard"}
"Request URL": "http://www.github.com/auth"
"Response Body": null
"Response Headers": {"location": "/login"}
"Response Headers": {"content-type": "application/json", "location": "/login"}
"Response Status": 302
}, {
"Request Body": null
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-docker-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set e+x

echo "This script should be run from cypress's root"

name=cypress/browsers:node12.8.1-chrome80-ff72
name=cypress/browsers:node12.13.0-chrome80-ff74
echo "Pulling CI container $name"

docker pull $name
Expand Down
Loading

0 comments on commit 9faec67

Please sign in to comment.