-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Selectors are failing when upgrading to React 18 #320
Comments
Hi, had been struggling with same. I found the problem to be in resq module, utils.js/findReactInstance
That fixed it - at least for my current use case, though more tweaks could be needed. I haven't tested all features (like lookup) but i was at least able to find the elements from the vdom. hope it helps, |
Hi @tuky191, I have resq 1.10.2 and it doesn't have any utils.js file. @abhinaba-ghosh, did you managed to use the library with React 18? Thanks, |
Hi @alvarp, I forked baruchvlz/resq, tweaked the code a bit and rebuilt. I really just needed it to 'work' for a proof of concept project I've been working on - My tests are passing on react18 but it's not finished yet. Anyways feel free to take a look at the fork. Michal |
Hello! I have the same problem. Is there any plan of updating this project to support react 18? |
For seeing if this resolves the issue I've patched the installed distributed version of |
resq 1.11.0 has been released, and this fixes
|
@thediveo I managed to get it working with this steps:
|
Using yarn, my "resolutions": {
"nth-check": "^2.0.1",
"resq": "^1.11.0"
}, The test code is as follows, you can find it here https://github.com/thediveo/lxkns/blob/develop/web/lxkns/src/components/extlink/Extlink.cy.tsx as part of my lxkns open source project: import React from 'react'
import ExtLink from './ExtLink'
describe('ExtLink', () => {
it('adorns external links', () => {
cy.mount(
<ExtLink href="http://endoftheinternet.null">End of The Internet</ExtLink>
)
cy.waitForReact()
cy.react('ExtLink').should('exist')
cy.react('ExtLink')
.find('svg')
.should('exist')
cy.react('ExtLink')
.find('a')
.contains('End of The Internet')
.should('have.attr', 'href', 'http://endoftheinternet.null')
.and('have.attr', 'target', '_blank')
.and('have.attr', 'rel').then((rel) => {
expect(rel).matches(/\bnoopener\b/)
expect(rel).matches(/\bnoreferrer\b/)
})
})
}) It simply goes down in flames with "Component not found ". Trying with passing in the req module path doesn't work either. |
I'm experiencing the same issue. I get the following error even when manually specifying
|
looks like the repo is dead |
Yeah. I ultimately uninstalled the dep and opted to grab the state directly from my store. However, this approach tightly couples my tests to the store, and I'm not sure if that's a correct practice. How did you handle retrieving your state? @thediveo |
Hopefully the repo owner is still well, even if abandoned this work. As there seems not much need for it and I'm well fed up with the terrible state of the Javascript ecosystem, I simply call it a day and remove cypress completely. I don't waste my life on this anymore. |
After upgrading to React 18, all the selectors are failing under the next message:
The project has the root initialized as the React upgrade guide explains and in the
cypress.json
we have the root element configured as recommended.Test example:
![image](https://user-images.githubusercontent.com/6916359/168320513-870fa878-d3c8-400f-af0a-674cbc984464.png)
Error example:
![image](https://user-images.githubusercontent.com/6916359/168320598-e48cf948-3d2b-4b41-85ca-242c4738bb11.png)
Is the package tested against React 18? Any hint on what could be happening?
The text was updated successfully, but these errors were encountered: