Description
Hi Abhinaba,
this is my first contact with cypress-react-selector (and Cypress), so please bear with me especially in case of stupid mistakes.
I've also fallen victim to the dreaded cy.then() timed out after waiting 4100ms
when trying to locate a component using cypress-react-selector
. Searching for some time, I came across issue #58. At the end of that issue you're asking for a proper code example. Hoping that a public Github project exhibiting that problem qualifies as "proper code example" (of course, for a sufficient definition of "example) I'm opening this new issue.
From what I've read when it comes to not finding components it looks like that often happens in more complex situations. In my case this is the React UI to a Linux diagnosis service for discovering so-called "namespaces" which is one of the mechanisms building the foundations for (not only) containers (such as Docker containers).
To (hopefully) reproduce my issue, first clone the public Github thediveo/lxkns repo and check out branch "feature/test-webui"
git clone --branch feature/test-webui https://github.com/thediveo/lxkn
Please note that you do not need to build the containerized backend service, so simply skip that step and just start the frontend development server and Cypress...
Please start the web UI frontend development server on port 3030. When navigating to localhost:3030 you should be greeted with an app bar with hamburger menu button as well as a few more toolbar buttons.
(cd webui/lxkns && yarn start)
And finally fire up Cypress, then select the lxkns.spec.ts integration test ... and watch it burn in cy.react('Refresher')...
😢
(cd webui/lxkns && yarn cypress)
The root gets properly detected as far as I could cross-check by using a non-existing root selector. I don't know if that might be of any relevance: the Refresher component lives inside a <header>
element which in turn is inside the <div id="root">
.