-
Notifications
You must be signed in to change notification settings - Fork 273
Test fails when using react-navigation container and react-redux provider together #1118
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
Comments
@firas1220 In general using Re error 1: looks like there might be some automatic re-render that happens due to some async action inside the component which is not triggered by explicitly calling
As if you got
Re error 2: pls check if you do not mock If any of the errors persists, then pls create a minimal repro repository, it would be great if it could be based on ours |
Hello @mdjastrzebski 👋 I really appreciate these suggestions. I do have some questions to ask tbh, but first, as I agree to share a minimal example that would be useful for sure, Im going to built and share the link to it. Please stay close 🙏 thanks in advance |
Hi again @mdjastrzebski ! After a hard work 😤 trying to clear up code in order to extract a minimal sample. Finally, here it is. BTW, I solved the issue with provider + navigation ✔️. Now, the problem is still with that Following what you said, I used this : await waitForElementToBeRemoved(() => screen.getByText(/loading/, {exact: false})); So now I got this error: console.error
Warning: You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...); Also, I even get act error whithout that line, with the following code: const reduxRef = createApiStore(apiInstance, {item: itemSliceReducer})
describe('list screen tests', () => {
// scenario one : initialize screen
it('list initialization', async () => {
// wrap into bottom tab navigator and navigation container
const ComponentToRender = () => (
<NavigationContainer>
<SecuredBottomTabNavigator/>
</NavigationContainer>
)
// wrap inside react-redux provider
render(<ComponentToRender/>, {wrapper: reduxRef.wrapper});
// get 1st screen (NOT items screen)
const screenDashboardText = await screen.getByText(/Dashborad/, {exact: false});
expect(screenDashboardText).not.toBeFalsy();
// go to items screen!
const toClick = await screen.findByText('Items');
fireEvent(toClick, 'press'); // I got act() error here
// await waitForElementToBeRemoved(async () => await screen.findByText('Loading ...'));
});
}); NOTE: The test passes even with that act error. Which is weard :/ Please help. 🏳️ |
Hi 😃 is there anything wrong my latest msg? I don't get it, why I don't receive some help here ? is it delicate that much? Please HELP I really need this. 😭 |
Hey @firas1220. I'd like to make it clear, that this is not really a help forum, but an issue tracker. We have some dedicated capacity to look at the issues, but it's limited. Please be patient and try reaching out on StackOverflow or on Discord https://discord.com/channels/426714625279524876/497332049187962892 to increase your chances of getting help :) |
Hi @thymikee and thanks for reploying: I'd like to answer on your msg, by spliting it into pieces, that would help both of us; I guess! You said:
My answer:
You said:
My answer:
Btw the link to discord channel is not working. It doesn't bring to anywhere. maybe an invitation will be better. As for Stackoverflow, that will be my last card. |
Try using the one we have in the readme: https://discord.gg/QbGezWe There's something in the works regarding these warnings (they're warnings, not errors, feel free to ignore them really): #1131 |
Thank @thymikee ! Do I consider this issue closed/resolved then?! 🤔 |
Let's see how #1131 evolves |
Right! I close this. See you there 😉 |
Hi! I have a weird annoying issue while I try to wrap my component (to render), inside redux provider + navigation container, following the examples such as the one in this Github repo, as for the other example from redux-toolkit repo.
👉 If I combine
<NavigationContainer/>
with<Provider/>
as follows:I get the following errors:
ERROR 1 🐞:
ERROR 2 🐞:
This is my test file code :
I use the following techs:
I can give you further information if needed, please help 🙏
Originally posted by @firas1220 in #1100 (comment)
The text was updated successfully, but these errors were encountered: