Cypress: 3.1.1 -> 3.1.2 breaks commands using element arrays

Created on 21 Nov 2018  路  9Comments  路  Source: cypress-io/cypress

Current behavior:

click() fails with the following error
related to https://github.com/kentcdodds/cypress-testing-library/pull/25

CypressError: cy.click() failed because it requires a DOM element.

The subject received was:

  > [<button>, <button>]

The previous command that ran was:

  > cy.then()
      at Object.cypressErr (http://localhost:13370/__cypress/runner/cypress_runner.js:63008:11)
      at Object.throwErr (http://localhost:13370/__cypress/runner/cypress_runner.js:62973:18)
      at Object.throwErrByPath (http://localhost:13370/__cypress/runner/cypress_runner.js:63000:17)
      at ensureElement (http://localhost:13370/__cypress/runner/cypress_runner.js:56011:21)
      at validateType (http://localhost:13370/__cypress/runner/cypress_runner.js:55897:16)
      at Object.ensureSubjectByType (http://localhost:13370/__cypress/runner/cypress_runner.js:55919:9)
      at pushSubjectAndValidate (http://localhost:13370/__cypress/runner/cypress_runner.js:58778:15)
      at Context.<anonymous> (http://localhost:13370/__cypress/runner/cypress_runner.js:58940:18)
      at http://localhost:13370/__cypress/runner/cypress_runner.js:58649:33
      at tryCatcher (http://localhost:13370/__cypress/runner/cypress_runner.js:124249:23)
      at Promise._settlePromiseFromHandler (http://localhost:13370/__cypress/runner/cypress_runner.js:122267:31)
      at Promise._settlePromise (http://localhost:13370/__cypress/runner/cypress_runner.js:122324:18)
      at Promise._settlePromiseCtx (http://localhost:13370/__cypress/runner/cypress_runner.js:122361:10)
      at Async._drainQueue (http://localhost:13370/__cypress/runner/cypress_runner.js:119178:12)
      at Async._drainQueues (http://localhost:13370/__cypress/runner/cypress_runner.js:119183:10)
      at Async.drainQueues (http://localhost:13370/__cypress/runner/cypress_runner.js:119057:14)

Desired behavior:

click() to work. (works on 3.1.1)

Steps to reproduce:

clone https://github.com/kentcdodds/cypress-testing-library
run npm setup
confirm test fails.
run npm install [email protected]
run npm run test:cypress:run
confirm test passes

Versions

cypress: 3.1.2

regression

Most helpful comment

Released in 3.1.3.

All 9 comments

I'd like to resolve this if someone could point me to the right direction :)

@misoguy this doesn't seem like click is broken, but the command before the .click that yielded [button, button], an array of elements, instead of a Jquery array

It appears that cy.wrap no longer works for dom element arrays. A bug on our end for sure

@Bkucera If the difficulty to fix this is somewhat easy, could I try it?

@misoguy this is high priority for us. We'll have a fix soon, but thank you!

the array-wrapping functionality of cy.wrap wasn't purposeful, so this wasn't captured in a test. we are now adding it to a spec

Understood 馃槃 Hope to have a fix soon 馃憤

Released in 3.1.3.

I have a feeling this also fixed a regression to my custom commands which yielded jquery arrays which stopped working in 3.1.2, but was working again in 3.1.3. Though i didnt use cy.wrap i suspect the underlying mechanism was the same, If so then thank you!

@egucciar yes, you are correct this would have broken any command who's subject was an element array

Was this page helpful?
0 / 5 - 0 ratings