[solved] I get an error message if I don't prepend calls to findBy... with a get('body') call
See original GitHub issuecypress-testing-library
version: ^6.0.0node
version: v10.21.0npm
(oryarn
) version: 1.22.4 (yarn)
Relevant code or config
cy.visit('/email-verified')
.findByText(/okay/i)
What you did:
I visit a page and call findByText
What happened:
I get the following error message:
Timed out retrying: Expected container to be an Element, a Document or a DocumentFragment but got Window.
If I call get('body')
before calling findByText
it works:
cy.visit('/email-verified')
.get('body')
.findByText(/okay/i)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to perform an action only if the Mono is empty and throw ...
I call a method on the repository layer that will find a user by username and if not found it will return an...
Read more >Common mistakes with React Testing Library - Kent C. Dodds
Hi there I created React Testing Library because I wasn't satisfied with the testing landscape at the time. It expanded to DOM Testing ......
Read more >Automation in Selenium: Page Object Model and Page Factory
Proper test automation is the key to quality software. Explore maintainable test automation in Selenium, including Page Object model and Page Factory.
Read more >Document.getElementById() - Web APIs | MDN
If you need to get access to an element which doesn't have an ID, ... and not available as a method on all...
Read more >Searching: getElement*, querySelector*
If an element has the id attribute, we can get the element using the ... The method getElementById can be called only on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just posted this for anyone encoutering this. Turns out cypress-testing-library no longer supports chaining commands, so you have to write something like:
Oh sorry, it’s just a new API - you’re not supposed to chain stuff any more. Perhaps we could implement a better error message?