question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: container.querySelectorAll is not a function

See original GitHub issue
  • cypress-testing-library version: 5.1.1
  • node version: 12.4.0
  • npm (or yarn) version: 1.21.1 (yarn)

Relevant code or config


describe('anonymous calculator', () => {
  it('can make calculations', () => {
    cy.visit('/')
      .findByText(/^1$/)
      .click()
      .findByText(/^\+$/)
      .click()
      .findByText(/^2$/)
      .click()
      .findByText(/^=$/)
      .click()
      .findByTestId('total')
      .should('have.text', '3')
  })
})

What you did: Attempted to run tjs/cypress-04 branch of https://github.com/kentcdodds/jest-cypress-react-babel-webpack/tree/tjs/cypress-04

What happened:

Screen Shot 2020-01-30 at 1 52 55 PM

Reproduction repository: https://github.com/kentcdodds/jest-cypress-react-babel-webpack/tree/tjs/cypress-04

Problem description:

TypeError: container.querySelectorAll is not a function

Suggested solution:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

10reactions
ayush000commented, Apr 4, 2020

For people who came across this issue, from what I understand, starting from @testing-library/cypress@6.0.0, they are no longer supporting chaining of multiple find* commands. So, you’ll have to write it as

    cy.visit('/')
    cy.findByText(/^1$/).click()
    cy.findByText(/^\+$/).click()
    cy.findByText(/^2$/).click()
    cy.findByText(/^=$/).click()
    cy.findByTestId('total').should('have.text', '3')

More discussion about this decision on: https://github.com/testing-library/cypress-testing-library/issues/110

@kentcdodds @tlrobinson please correct me if I’m wrong. Also, it would be helpful to add this change to release changelog: https://github.com/testing-library/cypress-testing-library/releases.

2reactions
kentcdoddscommented, Feb 2, 2020

🎉 This issue has been resolved in version 5.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

querySelectorAll is not a function - Stack Overflow
You are trying to call it on the return value of a call to querySelectorAll which returns a Node List (which is an...
Read more >
TypeError container.queryselectorall is not a function #526
collapse › encountered a declaration exception TypeError: container.querySelectorAll is not a function. Here is my collapse implementation.
Read more >
TypeError: querySelectorAll is not a function in JS | bobbyhadz
To solve the "querySelectorAll is not a function" error, make sure to only call the querySelectorAll method on a valid DOM element or...
Read more >
Uncaught TypeError: t.querySelectorAll is not a function
getElementsByClassName("containers") );. I'm getting this error inside Twitter's widget.js: Uncaught TypeError: t.querySelectorAll is not a ...
Read more >
Document.querySelectorAll() - Web APIs | MDN
The Document method querySelectorAll() returns a static (not live) NodeList ... querySelector("#test"); const matches = container.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found