Skip to content
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

.its command with compound properties failing TypeScript check #6431

Closed
bahmutov opened this issue Feb 12, 2020 · 7 comments · Fixed by #6667
Closed

.its command with compound properties failing TypeScript check #6431

bahmutov opened this issue Feb 12, 2020 · 7 comments · Fixed by #6667
Labels
good first issue Good for newcomers stage: ready for work The issue is reproducible and in scope type: typings Issue related to Cypress types (for TypeScript)

Comments

@bahmutov
Copy link
Contributor

Cypress v3, v4

Our typescript definition for cy.its command "understands" the properties of the subject, thus it can do

cy.wrap({ foo: 1 }).its('foo') // yup, subject has property "foo"

but it does not understand nested (compound) properties that Lodash _.get can do and we use under the hood

cy.wrap({
  foo: {
    bar: 1
  }
}).its('foo.bar') // oops, TypeScript freaks out, "foo.bar" is invalid

Maybe someone can look at Lodash and its TypeScript definition for _.get to see if they have solved this problem and bring the solution?

@bahmutov
Copy link
Contributor Author

Work-around

Add // @ts-ignore above the its('foo.bar') command to ignore just this line

@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Feb 13, 2020
@jennifer-shehane jennifer-shehane added the good first issue Good for newcomers label Feb 13, 2020
@arshmakker
Copy link

can i work on this one?

@jennifer-shehane
Copy link
Member

@arshmakker yes we would love an open PR. Check out our contributing doc and ask us if you get stuck.

@arshmakker
Copy link

arshmakker commented Mar 3, 2020

Hi @jennifer-shehane

I am trying to write the test case:

cy.wrap({
   foo: {
    bar: 1
  }
}).its('foo.bar')

in the tests in 'CypressItsTests' namespace, I had two questions:

  1. is 'CypressItsTests' the right place for this?
  2. How to run exclusively the tests for 'CypressItsTests'

@jennifer-shehane jennifer-shehane added type: typings Issue related to Cypress types (for TypeScript) and removed topic: typescript labels Mar 3, 2020
@jennifer-shehane
Copy link
Member

  1. This seems correct.
  2. There is a Contributing Guide that covers how to contribute and get Cypress running locally in generally here: https://github.com/cypress-io/cypress/blob/develop/.github/CONTRIBUTING.md

Instructions for running the cli tests can be found here: https://github.com/cypress-io/cypress/blob/develop/cli/README.md

Please feel free to open a WIP PR where we can address questions about the specific code you're writing.

arshmakker added a commit to arshmakker/cypress that referenced this issue Mar 3, 2020
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope stage: work in progress stage: needs review The PR code is done & tested, needs review labels Mar 6, 2020
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Mar 10, 2020
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Mar 11, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 11, 2020

The code for this is done in cypress-io/cypress#6667, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 16, 2020

Released in 4.2.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.2.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Mar 16, 2020
@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers stage: ready for work The issue is reproducible and in scope type: typings Issue related to Cypress types (for TypeScript)
Projects
None yet
3 participants