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

fix: cy.then shows wrong type when collection of HTMLElement's is provided #15869

merged 1 commit into from Apr 22, 2021


Copy link

@badeball badeball commented Apr 8, 2021

User facing changelog

cy.then will show correct type when collection of HTMLElement's is provided.

Additional details

  • Why was this change necessary? => When a collection of HTMLElement's is return from the previous cy.then, it is automatically wrapped with JQuery, but this behavior was not reflected in the function type.
  • What is affected by this change? => N/A
  • Any implementation details to explain? => Added new definition for the function.

Related issues / PRs:


How has the user experience changed?


PR Tasks

  • Have tests been added/updated?

@badeball badeball requested a review from a team as a code owner April 8, 2021 07:41
Copy link

cypress-bot bot commented Apr 8, 2021

Thanks for taking the time to open a PR!

Copy link

CLAassistant commented Apr 8, 2021

CLA assistant check
All committers have signed the CLA.

@jennifer-shehane jennifer-shehane requested review from sainthkh and removed request for a team April 21, 2021 14:49
Copy link

@sainthkh Any thoughts on needing this extra layer of types for .then?

Copy link

@badeball can you please review our code of conduct here

@cypress-io cypress-io deleted a comment from badeball Apr 21, 2021
@cypress-io cypress-io deleted a comment from badeball Apr 21, 2021
@cypress-io cypress-io deleted a comment from badeball Apr 21, 2021
Copy link

Dear @badeball if you don't think we (and I personally) eat our own food (which is the right expression, not the offensive version you used several times) by writing a lot of Cypress code, then (pun intended) I don't know what to say. Perhaps taking a break and approaching this problem after a cooling-off period would help you see this problem from our point of view.

Copy link

@sainthkh sainthkh left a comment

Choose a reason for hiding this comment

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


When cy.then() returns an array of HTMLElements, it wraps it with JQuery. I checked it with the code below:

it('t', () => {
  .then(($div) => {
    $div // $ExpectType JQuery<HTMLDivElement>

    return [$div[0], $div[0]]
  .then(($div) => {
    console.log($div) // => jQuery object.
    $div // $ExpectType JQuery<HTMLDivElement>

@jennifer-shehane jennifer-shehane merged commit d4e4885 into cypress-io:develop Apr 22, 2021
35 of 36 checks passed
tgriesser added a commit that referenced this pull request Apr 26, 2021
* develop: (49 commits)
  fix: `cy.type()` should not change the value attr of button-like inputs. (#16154)
  fix: properly detect `cy.intercept(url, routeMatcher, handler)` overload (#16167)
  fix: consider multiple routes when looking for aliases (#16180)
  fix: pass contextIsolation: true (#16165)
  chore: fix failing "should handle aborted requests" test (#16170)
  feat(issue-3741): added keyboard support for folder (#15648)
  fix(webpack-dev-server): remove hard dependency on html-webpack-plugin v4  (#16108)
  chore(deps): downgrade electron to v12.0.0-beta.14 (#16113)
  fix: accept absolute paths in vite dev server (#16148)
  fix: cy.then shows wrong type when collection of HTMLElement's is provided (#15869)
  fix: do not treat utf8 requests as binary (#15946)
  chore: fix types
  docs: fix broken links for @cypress/react example recipes (#15674)
  update circle yml
  ignore undefined beforeEach
  fix: make vite-dev-server work on windows (#16103)
  chore: add triple slash reference
  chore: remove conflicting types
  chore: rebuild yarn lock
  resolve conflicts in master(fe0b63c) and develop
Copy link

cypress-bot bot commented Apr 26, 2021

Released in 7.2.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

6 participants