Skip to content

Commit

Permalink
Addresses #2953 (#5174)
Browse files Browse the repository at this point in the history
* Addresses #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
  • Loading branch information
ryan-snyder authored and jennifer-shehane committed Sep 23, 2019
1 parent 9f082d9 commit e0fb38f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/driver/src/cy/commands/querying.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ module.exports = (Commands, Cypress, cy, state, config) ->

get: (selector, options = {}) ->
ctx = @


if options is null or Array.isArray(options) or typeof options isnt 'object' then return $utils.throwErrByPath "get.invalid_options", {
args: { options }
}
_.defaults(options, {
retry: true
withinSubject: cy.state("withinSubject")
Expand All @@ -78,7 +81,6 @@ module.exports = (Commands, Cypress, cy, state, config) ->
})

consoleProps = {}

start = (aliasType) ->
return if options.log is false

Expand Down Expand Up @@ -467,4 +469,4 @@ module.exports = (Commands, Cypress, cy, state, config) ->
cy.state("withinSubject", null)

return subject
})
})
1 change: 1 addition & 0 deletions packages/driver/src/cypress/error_messages.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ module.exports = {
get:
alias_invalid: "'{{prop}}' is not a valid alias property. Only 'numbers' or 'all' is permitted."
alias_zero: "'0' is not a valid alias property. Are you trying to ask for the first response? If so write @{{alias}}.1"
invalid_options: "#{cmd('get')} only accepts an options object for its second argument. You passed {{options}}"

getCookie:
invalid_argument: "#{cmd('getCookie')} must be passed a string argument for name."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,14 @@ describe "src/cy/commands/querying", ->
.server()
.route(/users/, {}).as("getUsers")
.get("@getUsers.all ")
_.each ["", "foo", [], 1, null ], (value) =>
it "throws when options property is not an object. Such as: #{value}", (done) ->
cy.on "fail", (err) ->
expect(err.message).to.include "only accepts an options object for its second argument. You passed #{value}"
done()

cy.get("foobar", value)

it "logs out $el when existing $el is found even on failure", (done) ->
button = cy.$$("#button").hide()

Expand Down

4 comments on commit e0fb38f

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on e0fb38f Sep 23, 2019

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/3.5.0/linux-x64/circle-develop-e0fb38fcab6cde257ef54f357b6c9aff135ce600-153743/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-e0fb38fcab6cde257ef54f357b6c9aff135ce600-153751/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on e0fb38f Sep 23, 2019

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 ia32 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.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-e0fb38fcab6cde257ef54f357b6c9aff135ce600-27606396/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-ia32/appveyor-develop-e0fb38fcab6cde257ef54f357b6c9aff135ce600-27606396/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on e0fb38f Sep 23, 2019

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.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-e0fb38fcab6cde257ef54f357b6c9aff135ce600-27606396/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.0/win32-x64/appveyor-develop-e0fb38fcab6cde257ef54f357b6c9aff135ce600-27606396/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on e0fb38f Sep 23, 2019

Choose a reason for hiding this comment

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

Circle has built the darwin 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/3.5.0/darwin-x64/circle-develop-e0fb38fcab6cde257ef54f357b6c9aff135ce600-153776/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-e0fb38fcab6cde257ef54f357b6c9aff135ce600-153774/cypress.tgz

Please sign in to comment.