Skip to content

Commit

Permalink
Merge pull request #7162 from sainthkh/decaff-driver-2
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-shehane committed May 4, 2020
2 parents 4290a85 + 145bea0 commit a904d46
Show file tree
Hide file tree
Showing 22 changed files with 3,328 additions and 2,730 deletions.
77 changes: 0 additions & 77 deletions packages/driver/src/cy/commands/location.coffee

This file was deleted.

100 changes: 100 additions & 0 deletions packages/driver/src/cy/commands/location.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
const _ = require('lodash')
const Promise = require('bluebird')

const $errUtils = require('../../cypress/error_utils')

module.exports = (Commands, Cypress, cy) => {
Commands.addAll({
url (options = {}) {
const userOptions = options

options = _.defaults({}, userOptions, { log: true })

if (options.log !== false) {
options._log = Cypress.log({
message: '',
})
}

const getHref = () => {
return cy.getRemoteLocation('href')
}

const resolveHref = () => {
return Promise.try(getHref).then((href) => {
return cy.verifyUpcomingAssertions(href, options, {
onRetry: resolveHref,
})
})
}

return resolveHref()
},

hash (options = {}) {
const userOptions = options

options = _.defaults({}, userOptions, { log: true })

if (options.log !== false) {
options._log = Cypress.log({
message: '',
})
}

const getHash = () => {
return cy.getRemoteLocation('hash')
}

const resolveHash = () => {
return Promise.try(getHash).then((hash) => {
return cy.verifyUpcomingAssertions(hash, options, {
onRetry: resolveHash,
})
})
}

return resolveHash()
},

location (key, options) {
let userOptions = options

// normalize arguments allowing key + options to be undefined
// key can represent the options
if (_.isObject(key) && _.isUndefined(userOptions)) {
userOptions = key
}

userOptions = userOptions || {}

options = _.defaults({}, userOptions, { log: true })

const getLocation = () => {
const location = cy.getRemoteLocation()

return _.isString(key)
// use existential here because we only want to throw
// on null or undefined values (and not empty strings)
? location[key] ?? $errUtils.throwErrByPath('location.invalid_key', { args: { key } })
: location
}

if (options.log !== false) {
options._log = Cypress.log({
message: key != null ? key : '',
})
}

const resolveLocation = () => {
return Promise.try(getLocation).then((ret) => {
return cy.verifyUpcomingAssertions(ret, options, {
onRetry: resolveLocation,
})
})
}

return resolveLocation()
},
})
}
45 changes: 0 additions & 45 deletions packages/driver/src/cy/commands/misc.coffee

This file was deleted.

58 changes: 58 additions & 0 deletions packages/driver/src/cy/commands/misc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const _ = require('lodash')

const $dom = require('../../dom')

module.exports = (Commands, Cypress, cy) => {
Commands.addAll({ prevSubject: 'optional' }, {
end () {
return null
},
})

Commands.addAll({
noop (arg) {
return arg
},

log (msg, args) {
Cypress.log({
end: true,
snapshot: true,
message: [msg, args],
consoleProps () {
return {
message: msg,
args,
}
},
})

return null
},

wrap (arg, options = {}) {
const userOptions = options

options = _.defaults({}, userOptions, { log: true })

if (options.log !== false) {
options._log = Cypress.log({
message: arg,
})

if ($dom.isElement(arg)) {
options._log.set({ $el: arg })
}
}

const resolveWrap = () => {
return cy.verifyUpcomingAssertions(arg, options, {
onRetry: resolveWrap,
})
.return(arg)
}

return resolveWrap()
},
})
}
Loading

2 comments on commit a904d46

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on a904d46 May 4, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.5.1/linux-x64/circle-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-313464/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.5.1/circle-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-313449/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on a904d46 May 4, 2020

Choose a reason for hiding this comment

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

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

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.5.1/win32-x64/appveyor-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-32625498/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.5.1/appveyor-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-32625498/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/4.5.1/win32-x64/appveyor-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-32625498/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.5.1/appveyor-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-32625498/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.5.1/win32-x64/appveyor-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-32625498/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.5.1/appveyor-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-32625498/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.5.1/win32-x64/appveyor-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-32625498/cypress.zip npm install https://cdn.cypress.io/beta/npm/4.5.1/appveyor-develop-a904d46f47708d9c0b24e74c76d10aef94b60806-32625498/cypress.tgz

Please sign in to comment.