New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The `its` command doesn't accept a log option (logging can't be disabled) #1450

Open
cwohlman opened this Issue Mar 12, 2018 · 8 comments

Comments

6 participants
@cwohlman

cwohlman commented Mar 12, 2018

  • Operating System: N/A
  • Cypress Version: 2.1.0
  • Browser Version: N/A

Is this a Feature or Bug?

Feature

Current behavior:

cy.window({ log: false }).its('something', { log: false }) throws an error because no options object is supported. (The docs bear this out as well).

Desired behavior:

I should be able to suppress logging using its('something', { log: false }) or the its command should inherit the log level from the previous call (if this is currently the expected behavior I'll investigate further and create a reproduction, I didn't see a mention of this in the docs).

Also, I would think that the its command should accept a timeout property.

@brian-mann

This comment has been minimized.

Member

brian-mann commented Mar 12, 2018

Agree. Oversight on our part.

@jennifer-shehane

This comment has been minimized.

Member

jennifer-shehane commented Mar 13, 2018

We are open source and welcome contributions, even a 'work in progress' PR is helpful!

.its() and .invoke() both call into this invokeFn: https://github.com/cypress-io/cypress/blob/issue-1350/packages/driver/src/cy/commands/connectors.coffee#L124

You can see there is the log directly after it: https://github.com/cypress-io/cypress/blob/issue-1350/packages/driver/src/cy/commands/connectors.coffee#L138

Here is an example of accepting the log option and using it to log or not, for reference: https://github.com/cypress-io/cypress/blob/issue-1350/packages/driver/src/cy/commands/querying.coffee#L30

We would also need some tests around this new behavior for its and invoke

@cwohlman

This comment has been minimized.

cwohlman commented Mar 13, 2018

How do we deal with the arguments spread operator for invoke?

@bahmutov

This comment has been minimized.

Collaborator

bahmutov commented Mar 19, 2018

Also needs timeout option, just like other commands

@wildaces215

This comment has been minimized.

wildaces215 commented May 16, 2018

Is this open?

@wildaces215

This comment has been minimized.

wildaces215 commented May 16, 2018

I would like handle it!

@jennifer-shehane

This comment has been minimized.

Member

jennifer-shehane commented May 16, 2018

@wildaces215 There has been no work done on this issue. Feel free to open a pull request.

@simonhaenisch

This comment has been minimized.

simonhaenisch commented May 31, 2018

I also need this, but don't have any coffeescript experience :|

Is it that invokeFn = (subject, fn, args...) -> needs to be changed to

invokeFn = (subject, fn, options = { log: true }, args...) ->

and then replace options._log = Cypress.log with

if options.log
  options._log = Cypress.log

?

Or do you rather use

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

instead of function argument defaults?

Update: I actually don't really need this... in my custom command, instead of cy.request().its('body').then(body => ...) I just do cy.request().then(res => res.body ...).

Tried installing cypress on my machine to work on this, but the npm install failed with EINTEGRITY in the static package (maybe because I'm running node v8.11.2 not v.8.2.1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment